From 0055de1c262154ffb3ce6288737eef2f20e20181 Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Sat, 4 Nov 2023 13:57:59 +0100 Subject: [PATCH] shinobu/snmp-exporter: Init --- machines/renge/services/prometheus.nix | 24 +++++++++++++++++++++ machines/shinobu/configuration.nix | 1 + machines/shinobu/services/snmp-exporter.nix | 9 ++++++++ 3 files changed, 34 insertions(+) create mode 100644 machines/shinobu/services/snmp-exporter.nix diff --git a/machines/renge/services/prometheus.nix b/machines/renge/services/prometheus.nix index 7f4dcc6..6f4db50 100644 --- a/machines/renge/services/prometheus.nix +++ b/machines/renge/services/prometheus.nix @@ -135,6 +135,30 @@ in regex = "(.*)\\.vpn\\.sbruder\\.de:9433"; }; } + { + job_name = "snmp"; + metrics_path = "/snmp"; + params = { + module = [ "if_mib" ]; + }; + static_configs = mkStaticTargets [ + "karibik.management.shinonome-lab.de" + ]; + relabel_configs = [ + { + source_labels = lib.singleton "__address__"; + target_label = "__param_target"; + } + { + source_labels = lib.singleton "__param_target"; + target_label = "instance"; + } + { + target_label = "__address__"; + replacement = "shinobu.vpn.sbruder.de:9116"; + } + ]; + } ]; rules = diff --git a/machines/shinobu/configuration.nix b/machines/shinobu/configuration.nix index 558c67b..fd925a9 100644 --- a/machines/shinobu/configuration.nix +++ b/machines/shinobu/configuration.nix @@ -6,6 +6,7 @@ ./services/co2_exporter.nix ./services/router + ./services/snmp-exporter.nix ]; sbruder = { diff --git a/machines/shinobu/services/snmp-exporter.nix b/machines/shinobu/services/snmp-exporter.nix new file mode 100644 index 0000000..24a77c6 --- /dev/null +++ b/machines/shinobu/services/snmp-exporter.nix @@ -0,0 +1,9 @@ +{ config, pkgs, ... }: + +{ + services.prometheus.exporters.snmp = { + enable = true; + listenAddress = config.sbruder.wireguard.home.address; + configurationPath = "${pkgs.prometheus-snmp-exporter.src}/snmp.yml"; + }; +}