skip to Main Content

I used official documentation to install prometheus on debian 10. i use prometheus and grafana to monitor ubuntu server 18.04. All works good.

After one week, i restart my server and prometheus no longer work. when i restart prometheus service, i don’t have error. when i ask status of prometheus service, i have this error:

root@srv-pg:/# systemctl status prometheus
● 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 Wed 2021-02-17 16:38:19 GMT; 6min ago
     Docs: https://prometheus.io/docs/introduction/overview/
  Process: 2278 ExecStart=/usr/bin/prometheus $ARGS (code=exited, status=1/FAILURE)
 Main PID: 2278 (code=exited, status=1/FAILURE)
Feb 17 16:38:19 srv-pg systemd[1]: prometheus.service: Service RestartSec=100ms expired, scheduling restart.
Feb 17 16:38:19 srv-pg systemd[1]: prometheus.service: Scheduled restart job, restart counter is at 5.
Feb 17 16:38:19 srv-pg systemd[1]: Stopped Monitoring system and time series database.
Feb 17 16:38:19 srv-pg systemd[1]: prometheus.service: Start request repeated too quickly.
Feb 17 16:38:19 srv-pg systemd[1]: prometheus.service: Failed with result 'exit-code'.
Feb 17 16:38:19 srv-pg systemd[1]: Failed to start Monitoring system and time series database.
root@srv-pg:/#

This is my config file of prometheus.yml:

# Sample config for Prometheus.
global:
  scrape_interval:     5s
  evaluation_interval: 5s
rules_files:
scrape_configs:
  - job_name: prometheus
    static_configs:
      - targets: ['localhost:9090']
  - job_name: node_exporter
    static_configs:
      - targets: ['192.168.62.4:9100']
  - job_name: nginx_exporter
    static_configs:
      - targets: ['192.168.62.4:9113']

I looked for the error but i don’t see. Please help me.

2

Answers


  1. your problem is the rule_files field that you didn’t specify so it’s better to comment out the line and then it will work:
    here is the correct code:

    Sample config for Prometheus.

    global:
    scrape_interval: 5s
    evaluation_interval: 5s
    #rules_files:
    scrape_configs:

    • job_name: node_exporter
      static_configs:

      • targets: [‘192.168.62.4:9100’]
    • job_name: nginx_exporter
      static_configs:

      • targets: [‘192.168.62.4:9113’]
    Login or Signup to reply.
  2. Sample config for Prometheus.

    global:
    scrape_interval: 5s
    evaluation_interval: 5s
    #rules_files:
    scrape_configs:

    • job_name: prometheus
      static_configs:

      • targets: [‘localhost:9090’]
    • job_name: node_exporter
      static_configs:

      • targets: [‘192.168.62.4:9100’]
    • job_name: nginx_exporter
      static_configs:

      • targets: [‘192.168.62.4:9113’]
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search