summaryrefslogtreecommitdiff
path: root/modules/monitoring.nix
diff options
context:
space:
mode:
authorKjetil Orbekk <kj@orbekk.com>2021-03-08 23:38:44 -0500
committerKjetil Orbekk <kj@orbekk.com>2021-03-08 23:38:44 -0500
commitaf7ac78b9715b37dc3b887c0ebb16ba36f0ec227 (patch)
treefaa0b09d21afe72d88102841338c4190d99217e2 /modules/monitoring.nix
parent013e7064626128039188db947e17962ef39fb910 (diff)
ap2 scrape
Diffstat (limited to 'modules/monitoring.nix')
-rw-r--r--modules/monitoring.nix28
1 files changed, 27 insertions, 1 deletions
diff --git a/modules/monitoring.nix b/modules/monitoring.nix
index 4530dd2..9f7287e 100644
--- a/modules/monitoring.nix
+++ b/modules/monitoring.nix
@@ -23,6 +23,14 @@ in
type = lib.types.int;
default = aliases.services.prometheus-exporter.port;
};
+ prometheus-snmp-exporter-port = lib.mkOption {
+ type = lib.types.int;
+ default = aliases.services.prometheus-snmp-exporter.port;
+ };
+ snmp-targets = lib.mkOption {
+ type = lib.types.listOf lib.types.str;
+ default = [ aliases.ip.ap2 ];
+ };
};
};
@@ -56,8 +64,21 @@ in
scrapeConfigs = [
{
job_name = "self";
+ static_configs = [
+ { targets = ["127.0.0.1:${toString cfg.prometheus-exporter-port}"]; }
+ ];
+ }
+ {
+ job_name = "snmp";
+ metrics_path = "/snmp";
+ params = { module = [ "if_mib" ]; };
+ relabel_configs = [
+ { source_labels = ["__address__"]; target_label = "__param_target"; }
+ { source_labels = ["__param_target"]; target_label = "instance"; }
+ { source_labels = []; target_label = "__address__"; replacement = "localhost:${toString cfg.prometheus-snmp-exporter-port}"; }
+ ];
static_configs = [{
- targets = ["127.0.0.1:${toString cfg.prometheus-exporter-port}"];
+ targets = cfg.snmp-targets;
}];
}
];
@@ -68,6 +89,11 @@ in
enabledCollectors = [ "systemd" ];
port = cfg.prometheus-exporter-port;
};
+ snmp = {
+ enable = true;
+ configurationPath = "${pkgs.prometheus-snmp-exporter.src}/snmp.yml";
+ port = cfg.prometheus-snmp-exporter-port;
+ };
};
};