mirror of
https://github.com/juspay/services-flake.git
synced 2024-11-09 16:35:24 +03:00
42 lines
1.2 KiB
Markdown
42 lines
1.2 KiB
Markdown
|
# 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.
|
||
|
|
||
|
[Prometheus]: https://github.com/prometheus/prometheus
|
||
|
|
||
|
## Getting Started
|
||
|
|
||
|
```nix
|
||
|
# In `perSystem.process-compose.<name>`
|
||
|
{
|
||
|
services.prometheus."pro1".enable = true;
|
||
|
}
|
||
|
```
|
||
|
|
||
|
{#tips}
|
||
|
## Tips & Tricks
|
||
|
|
||
|
{#scrape-configs}
|
||
|
### 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](https://github.com/prometheus/prometheus/blob/3f686cad8bee405229b2532584ef181ce9f6a8b3/documentation/examples/prometheus.yml) there is a single job, called prometheus. We can add it to `scrape_configs` using the following config:
|
||
|
|
||
|
```nix
|
||
|
{
|
||
|
services.prometheus."pro1" = {
|
||
|
enable = true;
|
||
|
# scrape prometheus
|
||
|
extraConfig = {
|
||
|
scrape_configs = [{
|
||
|
job_name = "prometheus";
|
||
|
static_configs = [{
|
||
|
targets = [ "localhost:9090" ];
|
||
|
}];
|
||
|
}];
|
||
|
};
|
||
|
};
|
||
|
}
|
||
|
```
|