diff options
author | Kjetil Orbekk <kj@orbekk.com> | 2021-03-08 23:38:44 -0500 |
---|---|---|
committer | Kjetil Orbekk <kj@orbekk.com> | 2021-03-08 23:38:44 -0500 |
commit | af7ac78b9715b37dc3b887c0ebb16ba36f0ec227 (patch) | |
tree | faa0b09d21afe72d88102841338c4190d99217e2 | |
parent | 013e7064626128039188db947e17962ef39fb910 (diff) |
ap2 scrape
-rw-r--r-- | config/router.nix | 2 | ||||
-rw-r--r-- | data/aliases.nix | 2 | ||||
-rw-r--r-- | modules/monitoring.nix | 28 |
3 files changed, 31 insertions, 1 deletions
diff --git a/config/router.nix b/config/router.nix index 735b1b2..87bda38 100644 --- a/config/router.nix +++ b/config/router.nix @@ -72,6 +72,8 @@ in interface $DEV_LAN @subchain "lan_services" { proto (tcp udp) dport (ssh domain bootpc bootps) ACCEPT; proto tcp dport (http https) ACCEPT; + # prometheus temp rule + proto tcp dport 11112 ACCEPT; # RTMP streaming proto (tcp udp) dport 1935 ACCEPT; diff --git a/data/aliases.nix b/data/aliases.nix index d179ff3..8445ecd 100644 --- a/data/aliases.nix +++ b/data/aliases.nix @@ -3,6 +3,7 @@ rec { dragon = "10.0.20.2"; shape = "10.0.20.15"; raigh = "raigh.orbekk.com"; + ap2 = "10.10.255.2"; }; services = { hydra = { address = ip.shape; port = 11101; }; @@ -20,5 +21,6 @@ rec { grafana = { port = 11111; }; prometheus = { port = 11112; }; prometheus-exporter = { port = 11113; }; + prometheus-snmp-exporter = { port = 11114; }; }; } 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; + }; }; }; |