{ config, pkgs, lib, ... }: { services.prometheus = { enable = true; globalConfig.scrape_interval = "15s"; extraFlags = [ # 3 years of retention "--storage.tsdb.retention=${toString (365 * 3)}d" "--web.enable-admin-api" ]; scrapeConfigs = [{ job_name = "node"; static_configs = [{ targets = [ "192.168.6.1:9100" "192.168.6.10:9100" "192.168.6.20:9100" ]; }]; relabel_configs = [ { source_labels = [ "__address__" ]; target_label = "instance"; replacement = "nas"; action = "replace"; regex = "192.168.6.10:(.*)"; } { source_labels = [ "__address__" ]; target_label = "instance"; replacement = "rtr"; action = "replace"; regex = "192.168.6.1:(.*)"; } { source_labels = [ "__address__" ]; target_label = "instance"; replacement = "tahoe"; action = "replace"; regex = "192.168.6.20:(.*)"; } ]; }]; }; }