snmp: from package back to module

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

View File

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

View File

@@ -0,0 +1,8 @@
How to upgrade snmp.yml
1. Extend generator.yml from the upstream generator.yml in snmp_exporter/generator/generator.yml
2. Generate snmp.yml:
snmp_exporter/generator$ make mibs
packages/snmp-yaml $ MIBDIRS=$HOME/code/snmp_exporter/generator/mibs /nix/store/wmymig1r9jfiaffbdpv1lyaj32rydbzc-snmp_exporter-0.21.0/bin/generator generate

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

@@ -0,0 +1,50 @@
modules:
# Default IF-MIB interfaces table with ifIndex.
if_mib:
walk: [sysUpTime, interfaces, ifXTable]
lookups:
- source_indexes: [ifIndex]
lookup: ifAlias
- source_indexes: [ifIndex]
# Uis OID to avoid conflict with PaloAlto PAN-COMMON-MIB.
lookup: 1.3.6.1.2.1.2.2.1.2 # ifDescr
- source_indexes: [ifIndex]
# Use OID to avoid conflict with Netscaler NS-ROOT-MIB.
lookup: 1.3.6.1.2.1.31.1.1.1.1 # ifName
overrides:
ifAlias:
ignore: true # Lookup metric
ifDescr:
ignore: true # Lookup metric
ifName:
ignore: true # Lookup metric
ifType:
type: EnumAsInfo
# Mikrotik Router
#
# http://download2.mikrotik.com/Mikrotik.mib
mikrotik:
walk:
- interfaces
- ifMIB
- laIndex
- sysUpTime
- sysDescr
- host
- mikrotik
lookups:
- source_indexes: [ifIndex]
lookup: ifName
- source_indexes: [mtxrInterfaceStatsIndex]
lookup: ifName
- source_indexes: [hrStorageIndex]
lookup: hrStorageDescr
- source_indexes: [laIndex]
lookup: laNames
drop_source_indexes: true
overrides:
ifName:
ignore: true # Lookup metric
ifType:
type: EnumAsInfo

File diff suppressed because it is too large Load Diff