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;
packages.snmp-yaml = pkgs.callPackage ./packages/snmp-yaml {};
});
}

View File

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

View File

@ -13,6 +13,7 @@
./node_exporter
./nsd-acme
./postfix
./snmp_exporter
./syncthing
./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
'';
}