add description of prometheus service

This commit is contained in:
2025-10-29 12:50:12 +01:00
parent aa4e7c7b45
commit 29845aa117
2 changed files with 42 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
This module enables collecting metrics from machines in clan, using Prometheus.
There are two roles:
- A `target` role for machines on which to collect and export metrics.
- A `scraper` roles for machines that fetch metrics from `target` machines and
store them in the long term.
```nix
inventory = {
machines = {
server01.tags.server = {};
server02.tags.server = {};
metrics.tags.server = {}; # metrics collector
};
instances = {
prometheus = {
module.name = "@rpqt/prometheus";
module.input = "self";
roles.scraper.machines."metrics" = {};
# Collect metrics on all servers
roles.target.tags.server = {
settings = {
exporters = {
# Enable the node-exporter metrics source
node.enabledCollectors = [ "systemd" ];
};
};
};
};
};
};
```

View File

@@ -3,10 +3,13 @@
{ {
_class = "clan.service"; _class = "clan.service";
manifest.name = "prometheus"; manifest.name = "prometheus";
manifest.description = "Prometheus metrics collection across the clan network.";
manifest.readme = builtins.readFile ./README.md;
# Only works with zerotier (until a unified network module is ready) # Only works with zerotier (until a unified network module is ready)
roles.scraper = { roles.scraper = {
description = "A server that scrapes metrics from exporters of machines that have the 'target' role.";
interface = { interface = {
options.extraScrapeConfigs = lib.mkOption { options.extraScrapeConfigs = lib.mkOption {
type = lib.types.listOf lib.types.attrs; type = lib.types.listOf lib.types.attrs;
@@ -63,6 +66,7 @@
}; };
roles.target = { roles.target = {
description = "A machine on which to collect and export metrics.";
interface = interface =
{ lib, ... }: { lib, ... }:
{ {