Our SNMP-enabled devices are on a secure, non-routed subnet in our datacenter. To enable snmp monitoring of them, we use a snmpd proxy[1]. This allows us to grab snmp data from each device using the same IP address, but a different community name. For example:
# snmpget -v2c -On -c pdu1 snmpd.proxy.host .1.3.6.1.2.1.1.5.0.1.3.6.1.2.1.1.5.0 = STRING: DCS_PDU_10_1
# snmpget -v2c -On -c pdu2 snmpd.proxy.host .1.3.6.1.2.1.1.5.0 .1.3.6.1.2.1.1.5.0 = STRING: DCS_PDU_11_1
Our snmp_exporter(s) run on the same host as prometheus, which is not the same host that the snmp proxy is running on. I've generated a snmp_exporter snmp.yml config that specified a different module for each device:
servertech_sentry3: &servertech_sentry3
walk:
- 1.3.6.1.4.1.1718.3.2.2
- 1.3.6.1.4.1.1718.3.2.3
[...]
pdu1:
<<: *servertech_sentry3
auth:
community: pdu1
pdu2:
<<: *servertech_sentry3
auth:
community: pdu2
This lets us use a single exporter for all identical devices by specifying a different module, eg
However, I'm uncertain now to use this in my prometheus.yml file so that they show up as different targets under the same job. I wanted to do something like this:
- job_name: 'pdu'
static_configs:
- targets:
- 'prometheus.host:9116/snmp?target=snmpd.proxy.host&module=pdu1'
- 'prometheus.host:9116/snmp?target=snmpd.proxy.host&module=pdu2'
...but prometheus doesn't like having the url path in the target; it only wants a hostname:port. But in my case, I want to reuse the same hostname:port for multiple targets.
Is this something that is possible? If not, the only other option I see is to run a separate snmp_exporter instance (listening on different ports) for each snmp device (we have ~50 such devices). Ultimately I want to have a single job_name, but be able to select data for each individual proxied snmp device in grafana.
--Mike