Prometheus

Prometheus is a systems and service monitoring system. It collects metrics from configured targets at given intervals, evaluates rule expressions, displays the results, and can trigger alerts when specified conditions are observed.

Getting Started

# In `perSystem.process-compose.<name>`
{
  services.prometheus."pro1".enable = true;
}

Tips & Tricks

Adding Scrape Configs

scrape_configs controls what resources Prometheus monitors.

Since Prometheus also exposes data about itself as an HTTP endpoint it can scrape and monitor its own health. In the default example configuration there is a single job, called prometheus. We can add it to scrape_configs using the following config:

{
  services.prometheus."pro1" = {
    enable = true;
    # scrape prometheus
    extraConfig = {
      scrape_configs = [{
        job_name = "prometheus";
        static_configs = [{
          targets = [ "localhost:9090" ];
        }];
      }];
    };
  };
}
Links to this page