I’m implementing the TICK stack on Debian Jessie and everything has been really smooth up to this point.
I’m trying to setup (using Telegraf 1.7.2) one of my Telegraf hosts so that it will monitor itself via SNMP and monitor a UPS also via SNMP.
The host monitoring itself part works like a champ with something like this in my telegraf.conf file:
[[inputs.snmp]]
agents = [ "127.0.0.1:161" ]
timeout = "5s"
version = 2c
community = "amazingString"
name = "snmp"
[[inputs.snmp.field]]
name = "hostname"
oid = "RFC1213-MIB::sysName.0"
is_tag = true
[[inputs.snmp.field}}
name = "prNames.1"
oid = "UCD-SNMP-MIB::prNames.1"
is_tag = true
This works great - I can see the SNMP agent when I test and I actually see data over in Chronograf.
When I add the next bit below to the same file the second agent doesn’t show up in the test but running snmpwalk manually shows that I have the right authorization, right OID, etc.
[[inputs.snmp]]
agents = [ "10.0.0.1:161" ]
timeout = "5s"
version = 1
community = "moreAmazingAction"
[[inputs.snmp.field]]
name = "hostname"
oid = "RFC1213-MIB::sysName.0"
is_tag = true
[[inputs.snmp.table]]
name = "ups-somewhere"
inherit_tags = [ "hostname" ]
[[inputs.snmp.table.field]]
name = "xupsBatTimeRemaining.0"
oid = "XUPS-MIB::xupsBatTimeRemaining.0"
is_tag = true
If I have both entries in telegraf.conf I only see the first one in my test and only the first one (localhost) logs data.
If I split out the second item to a config file under /etc/telegraf/telegraf.d that config isn’t recognized by the test unless I specifically point the test at that config file and at that point the test comes back fine but I don’t end up with data being logged across to Chronograf.
At first I thought this was because I was using SNMPv3 for my target remote SNMP host but the same issue happens with SNMPv1.
In both cases a straight snmpwalk from this same host using SNMPv3 or SNMPv1 works just fine.
I think my config is a little bit off and I’m not sure if I need/don’t need the inputs.snmp.table.field declaration or not with a remote host.
I’m missing something but I can’t figure out where things are off.
Does it work if you remove the is_tag = true for XUPS-MIB::xupsBatTimeRemaining.0, changing the collected data from a tag to a field? Recall that you must have at least one field for each point, it can’t only have tags.
Based on the OID name, you probably don’t want this value to be a tag anyway since it will be frequently changing and doesn’t identify the series in a meaningful way.
I finally worked it out through careful trial and error using diff files to track changes.
This is what works:
# Localhost snmp configuration
[[inputs.snmp]]
agents = [ "127.0.0.1:161" ]
timeout = "5s"
retries = 3
version = 1
community = "someString"
name = "snmp"
[[inputs.snmp.field]]
name = "hostname"
oid = "RFC1213-MIB::sysName.0"
is_tag = true
# Service name at index 1 in /etc/snmp/snmpd.conf
# example proc nginx
[[inputs.snmp.field]]
name = "prNames.1"
oid = "UCD-SNMP-MIB::prNames.1"
is_tag = true
# Service count for service index 1
[[inputs.snmp.field]]
name = "prCount.1"
oid = "UCD-SNMP-MIB::prCount.1"
# Now a remote UPS
[[inputs.snmp]]
agents = [ "10.0.0.1:161" ]
timeout = "5s"
retries = 3
version = 1
community = "SecretSquirrel"
name = "ups-somewhere"
[[inputs.snmp.field]]
name = "hostname"
oid = "RFC1213-MIB::sysName.0"
# is_tag = true
[[inputs.snmp.field]]
name = "xupsBatTimeRemaining.0"
oid = "XUPS-MIB::xupsBatTimeRemaining"
The key is the commented out ‘is_tag’ as with that in place the item drops out.
I can’t speak to the why yet just that the model works meaning I see it with ‘telegraf --test’ under the name I assigned to the remote SNMP host and in Chronograf I can see the data in the Data Explorer when I find the remote SNMP host now.