Telegraf mixed SNMP config

Following my previous post about Grafana, once everything is installed you'll want to capture some data.  Otherwise, what's the point.  Telegraf is a data gathering tool made by Influxdata.  It's stupid simple to get working with InfluxDB.  After following the previous script, go to /etc/telegraf/ and edit telegraf.conf.  Near the top is the Output Plugins section.  Make sure that's modified for your InfluxDB install.  From there, scroll down to Input Plugins.  There's a ridiculous number of input plugins available.  We're focused on SNMP today, but it's worth looking through the list to see if a "need" can be solved with Telegraf before using some other custom script.

For me, I needed to add SNMP for my Ubiquiti ER-X firewall and my Nutanix CE cluster.  Here's my SNMP config section with the obvious security bits redacted:

max_repetitions = 50

sec_name = “username”
auth_protocol = "SHA" # Values: "MD5", "SHA", ""
auth_password = “password”
sec_level = "authPriv" # Values: "noAuthNoPriv", "authNoPriv", "authPriv"

priv_protocol = "AES" # Values: "DES", "AES", ""
priv_password = “password”

name = "nutanix"
[[inputs.snmp.field]]
name = "host1CPU"
oid = "1.3.6.1.4.1.41263.9.1.6.1"
[[inputs.snmp.field]]
name = "host2CPU"
oid = "1.3.6.1.4.1.41263.9.1.6.2"
[[inputs.snmp.field]]
name = "host3CPU"
oid = "1.3.6.1.4.1.41263.9.1.6.3"
[[inputs.snmp.field]]
name = "host4CPU"
oid = "1.3.6.1.4.1.41263.9.1.6.4"
[[inputs.snmp.field]]
name = "ClusterIOPS"
oid = "1.3.6.1.4.1.41263.506.0"
[[inputs.snmp.field]]
name = "Host1MEM"
oid = "1.3.6.1.4.1.41263.9.1.8.1"
[[inputs.snmp.field]]
name = "Host2MEM"
oid = "1.3.6.1.4.1.41263.9.1.8.2"
[[inputs.snmp.field]]
name = "Host3MEM"
oid = "1.3.6.1.4.1.41263.9.1.8.3"
[[inputs.snmp.field]]
name = "Host4MEM"
oid = "1.3.6.1.4.1.41263.9.1.8.4"

[[inputs.snmp]]
agents = [ "192.168.0.1:161" ] ##Firewall IP
timeout = "5s"
retries = 3
version = 2
community = “RO_community_string”
max_repetitions = 10

name = "ERX"
[[inputs.snmp.field]]

name = "Bytes.Out"
oid = "1.3.6.1.2.1.2.2.1.10.2"
[[inputs.snmp.field]]
name = "Bytes.In"
oid = "1.3.6.1.2.1.2.2.1.16.2"


You'll have to get Telegraf to read in the config again.  The sledgehammer method would be a reboot.  I think a Telegraf service restart would also do the trick.  Reboots for me take about 5 seconds (yep, really), so it's useful to make sure it's coming up clean on a reboot anyway.