Telegraf with snmp tables

Looking for a little support for my SNMP collection on my Buffalo NAS. All I’m trying to do is pull the SMART Drive status from the 4 drives in my NAS. Using snmptable, I can sell all the fileds:

#################################
[roott@system01 ~]$ snmptable -v 2c -c Public terastation BUFFALO-NAS-MIB::nasDiskTable
SNMP table: BUFFALO-NAS-MIB::nasDiskTable

 nasDiskStatus nasDiskCapacity nasDiskUsed **nasDiskSMARTStatus** nasDiskSMARTReallocatedSectorCtValue nasDiskSMARTReallocatedSectorCtWorst nasDiskSMARTReallocatedSectorCtThresh nasDiskSMARTReallocatedSectorCtRAW nasDiskSMARTCurrentPendingSectorValue nasDiskSMARTCurrentPendingSectorWorst nasDiskSMARTCurrentPendingSectorThresh nasDiskSMARTCurrentPendingSectorRAW nasDiskSMARTOfflineUncorrectableValue nasDiskSMARTOfflineUncorrectableWorst nasDiskSMARTOfflineUncorrectableThresh nasDiskSMARTOfflineUncorrectableRAW nasSSDSMARTRemainingLifeValue nasSSDSMARTRemainingLifeWorst nasSSDSMARTRemainingLifeThresh nasSSDSMARTBadBlockCountValue nasSSDSMARTBadBlockCountWorst nasSSDSMARTBadBlockCountThresh nasDiskCapacityGiB nasDiskCapacityLow nasDiskCapacityHigh nasDiskUsedGiB nasDiskUsedLow nasDiskUsedHigh

#################################

I’ve created my telegraf file looking only at the ‘nasDiskSMARTStatus’ in the BUFFALO-NAS-MIB and that works, but the issue is that separating out each drive to their own fields. It just keeps saving them under the same ‘NAS_Disk’ field so I only see one in Grafana.

#################################

terastation.conf

[[inputs.snmp.table]]
name = “NAS_drives”
inherit_tags = [ “hostname” ]
[[inputs.snmp.table.field]]
name = “Drive_1”
oid = “BUFFALO-NAS-MIB::nasDiskSMARTStatus”
#################################
[root@system01 ~]# telegraf --config /etc/telegraf/telegraf.d/terrastation.conf --test
2021-02-14T18:50:35Z I! Starting Telegraf 1.17.2

snmp,agent_host=terastation, host=system01,hostname=terastation Uptime=7263589i,Used_Percentage=63i 1613328636000000000
NAS_drives,agent_host=terastation,host=system01,hostname=terastation Drive=2i 1613328636000000000
NAS_drives,agent_host=terastation,host=system01,hostname=terastation Drive=2i 1613328636000000000
NAS_drives,agent_host=terastation,host=system01,hostname=terastation Drive=1i 1613328636000000000
NAS_drives,agent_host=terastation,host=system01,hostname=terastation Drive=1i 1613328636000000000
#################################

I’ve tried changing the OID’s to something like oid = “BUFFALO-NAS-MIB::nasDiskSMARTStatus.1” for each drive but that didn’t work. Can someone tell me how to alias each drive to its only entry in telegraf?

I hope this makes sense. Thanks for the help!

There’s an option to make a field into a tag, I believe it’s called is_tag. If you set that, the snmp field will be used as a tag in influxdb.

1 Like

Thank you Znkr, I think I tried that, but I’m going to give it another try. I ended up finding the long oid name for each drive and that works, but it just seems dirty to me, so I’m going to try to do it the right with the table options.

Sometimes snmp also encodes stuff in the index and there’s an option in Telegraf to make the index a tag too. That might be the reference you used to get the specific drive. If you want to give them custom names, you can use a regex processor to rename those ids to whatever you want, or use a starlark script to process them.

1 Like