snmp: from package back to module
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
./node_exporter
|
||||
./nsd-acme
|
||||
./postfix
|
||||
./snmp_exporter
|
||||
./syncthing
|
||||
./zfsunlock
|
||||
];
|
||||
|
||||
8
modules/services/snmp_exporter/README.md
Normal file
8
modules/services/snmp_exporter/README.md
Normal 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
|
||||
|
||||
21
modules/services/snmp_exporter/default.nix
Normal file
21
modules/services/snmp_exporter/default.nix
Normal 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;
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
50
modules/services/snmp_exporter/generator.yml
Normal file
50
modules/services/snmp_exporter/generator.yml
Normal 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
|
||||
5629
modules/services/snmp_exporter/snmp.yml
Normal file
5629
modules/services/snmp_exporter/snmp.yml
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user