snmp: from package back to module

This commit is contained in:
Motiejus Jakštys 2023-09-05 14:41:52 +03:00
parent dae3c590ce
commit 5c1cccb8a4
8 changed files with 24 additions and 27 deletions

View File

@ -173,7 +173,5 @@
}; };
formatter = pkgs.alejandra; formatter = pkgs.alejandra;
packages.snmp-yaml = pkgs.callPackage ./packages/snmp-yaml {};
}); });
} }

View File

@ -100,6 +100,8 @@
gitea.enable = true; gitea.enable = true;
snmp_exporter.enable = true;
headscale = { headscale = {
enable = true; enable = true;
clientOidcPath = config.age.secrets.headscale-client-oidc.path; clientOidcPath = config.age.secrets.headscale-client-oidc.path;
@ -300,12 +302,6 @@
evaluation_interval = "15s"; evaluation_interval = "15s";
}; };
exporters.snmp = {
enable = true;
listenAddress = "127.0.0.1";
configuration = {};
};
scrapeConfigs = let scrapeConfigs = let
port = builtins.toString myData.ports.exporters.node; port = builtins.toString myData.ports.exporters.node;
in [ in [

View File

@ -13,6 +13,7 @@
./node_exporter ./node_exporter
./nsd-acme ./nsd-acme
./postfix ./postfix
./snmp_exporter
./syncthing ./syncthing
./zfsunlock ./zfsunlock
]; ];

View File

@ -0,0 +1,21 @@
{
config,
lib,
myData,
...
}: {
options.mj.services.snmp_exporter = with lib.types; {
enable = lib.mkEnableOption "Enable prometheus snmp_exporter";
};
config = lib.mkIf config.mj.services.snmp_exporter.enable {
mj.services.friendlyport.vpn.ports = [config.services.prometheus.exporters.snmp.port];
services.prometheus.exporters.snmp = {
enable = true;
listenAddress = "127.0.0.1";
configurationPath = ./snmp.yml;
};
};
}

View File

@ -1,19 +0,0 @@
{
stdenv,
pkgs,
prometheus-snmp-exporter,
}:
stdenv.mkDerivation {
name = "snmp-yaml";
inherit (prometheus-snmp-exporter) version src;
buildInputs = [prometheus-snmp-exporter];
buildPhase = ''
mkdir -p $out
set -x
cd $src/generator
${prometheus-snmp-exporter}/bin/generator generate \
--output-path=$out/snmp.yml
'';
}