From b5e87117aa5db286ad8cb0f197c7f250bde907ea Mon Sep 17 00:00:00 2001 From: Garionion Date: Sun, 24 Jul 2022 16:52:54 +0200 Subject: [PATCH] monitoring: add snmp exporter --- hosts/monitoring/configuration.nix | 44 ++++++++++++++++++++++++++---- hosts/monitoring/snmp.yml | 0 2 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 hosts/monitoring/snmp.yml diff --git a/hosts/monitoring/configuration.nix b/hosts/monitoring/configuration.nix index ca5376d..c9e120a 100644 --- a/hosts/monitoring/configuration.nix +++ b/hosts/monitoring/configuration.nix @@ -21,13 +21,27 @@ with lib; networking.defaultGateway = { address = "10.42.10.1"; interface = "ens18"; }; networking.defaultGateway6 = { address = "2a01:4f8:1c0c:8221::1"; interface = "ens18"; }; + environment = { + etc = { + "snmp-exporter/snmp.yml".source = ./snmp.yml; + }; + }; + services.influxdb2.enable = true; - services.prometheus.exporters.blackbox = { - enable = true; - listenAddress = "[::1]"; - port = 9115; - configFile = ./blackbox.yml; + services.prometheus.exporters = { + blackbox = { + enable = true; + listenAddress = "[::1]"; + port = 9115; + configFile = ./blackbox.yml; + }; + snmp = { + enable = true; + port= 9116; + listenAddress = "[::1]"; + configurationPath = "/etc/snmp-exporter/snmp.yml"; + }; }; services.prometheus.exporters.node.enable = true; @@ -253,6 +267,17 @@ with lib; } ]; } + { + job_name = "snmp"; + scrape_interval = "5m"; + static_configs = [ + { + targets = [ + "[::1]:9116" + ]; + } + ]; + } ]; alertmanagers = [ { @@ -289,16 +314,25 @@ with lib; enable = true; virtualHosts = { "prometheus.bula22.de" = { + serverAliases = [ + "prometheus" + ]; enableACME = true; forceSSL = true; locations."/".proxyPass = "http://[::1]:9090/"; }; "grafana.bula22.de" = { + serverAliases = [ + "grafana" + ]; enableACME = true; forceSSL = true; locations."/".proxyPass = "http://[::1]:3001/"; }; "influxdb.bula22.de" = { + serverAliases = [ + "influxdb" + ]; enableACME = true; forceSSL = true; locations."/".proxyPass = "http://[::1]:8086/"; diff --git a/hosts/monitoring/snmp.yml b/hosts/monitoring/snmp.yml new file mode 100644 index 0000000..e69de29