prometheus.yml and prometheus.service setup configured but status message failed

2.4k Views Asked by At

There is a specific error that has presented itself each time I had modified the configuration file for Prometheus as well as configuring the Prometheus start up service. See status below:

prometheus.service - Monitoring system and time series database
     Loaded: loaded (/lib/systemd/system/prometheus.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Mon 2022-04-11 17:35:37 UTC; 3s ago
       Docs: https://prometheus.io/docs/introduction/overview/
    Process: 1192591 ExecStart=/usr/bin/prometheus $ARGS (code=exited, status=2)
   Main PID: 1192591 (code=exited, status=2)

Apr 11 17:35:37 * systemd[1]: prometheus.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Apr 11 17:35:37 * systemd[1]: prometheus.service: Failed with result 'exit-code'.
Apr 11 17:35:37 * systemd[1]: prometheus.service: Scheduled restart job, restart counter is at 5.
Apr 11 17:35:37 *  systemd[1]: Stopped Monitoring system and time series database.
Apr 11 17:35:37 * systemd[1]: prometheus.service: Start request repeated too quickly.
Apr 11 17:35:37 * systemd[1]: prometheus.service: Failed with result 'exit-code'.
Apr 11 17:35:37 * systemd[1]: Failed to start Monitoring system and time series database.

Located below is the configuration of prometheus.yml

global:
  scrape_interval:     15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s).

  # Attach these labels to any time series or alerts when communicating with
  # external systems (federation, remote storage, Alertmanager).
  external_labels:
      monitor: 'example'

# Alertmanager configuration
alerting:
  alertmanagers:
  - static_configs:
    - targets: ['localhost:9093']

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: 'prometheus'

    # Override the global default and scrape targets from this job every 5 seconds.
    scrape_interval: 5s
    scrape_timeout: 5s

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
      - targets: ['localhost:9090']

  - job_name: test
    # If prometheus-node-exporter is installed, grab stats about the local
    # machine by default.
    static_configs:
      - targets: ['localhost:9100']

Here is the prometheus.service

[Unit]
Description=Monitoring system and time series database
Documentation=https://prometheus.io/docs/introduction/overview/

[Service]
Restart=always
User=prometheus
EnvironmentFile=/etc/default/prometheus
ExecStart=/usr/bin/prometheus $ARGS
ExecReload=/bin/kill -HUP $MAINPID
TimeoutStopSec=20s
SendSIGKILL=no
LimitNOFILE=8192

[Install]

Finally, the file that is called upon

ARGS="--config.file /etc/prometheus/prometheus.yml \
  --storage.tsdb.path /monitoring/prometheus/prometheus_data/ \
  --web.console.templates=/etc/prometheus/consoles \
  --web.console.libraries=/etc/prometheus/console_libraries \
  --web.external-url=https://prom.example.com \
  --web.listen-address=:9090 \
  --web.listen-address=:9100 \
  --web.listen-address=:9101 \
  --web.enable-lifecycle \
  --web.enable-admin-api \
  --log.level=info"

I am unsure if something is wrong with how I am installing Prometheus (through sudo apt install prometheus). I have rebuilt this machine twice to see if it was something with configuration, but still have the same error.

0

There are 0 best solutions below