Telegraf Config for use in Network monitoring through multiple SNMP inputs for InfluxDB and reading in Grafana - on a Raspberry Pi

Well. That's a mouthful huh?

I needed a way to monitor my network at home, so I set up a Raspberry Pi with Raspberry OS (really, Ubuntu for ARM but whatever). I then added InfluxDB, Grafana and Telegraf.

Setting this up this far took about an hour. Influx needs to be a specific version because ARM... And it's a bit old, but works just fine. Grafana and Telegraf was simple enough.

I'll make a full build guide one day, but here is my telegraf config, which was surprisingly complicated to get working properly.

This is written in the TOML language, which is more than human readable, but has a few quirks.

###
# Feel free to use if it helps.
# Forked from all over the place.
###

###############################################################################
#                            INPUT PLUGINS                                    #
###############################################################################

## ------------------------------------------- ##
## QNAP NAS
## ------------------------------------------- ##
[[inputs.snmp]]
# List of agents to poll
agents = [ ";XXX.XXX.XX.X" ]
interval = ";15s"
timeout = ";10s"
retries = 3
version = 2
community = ";community"
max_repetitions = 10
name = ";snmp.QNAP"

# CPU
	[[inputs.snmp.field]]
	name = ";name"
	oid  = ";NAS-MIB::enclosureName.1"

	[[inputs.snmp.table]]
	name = ";snmp.QNAP.cpuTable"
	oid  = ";NAS-MIB::cpuTable"

		[[inputs.snmp.table.field]]
		name = ";cpuIndex"
		oid  = ";NAS-MIB::cpuIndex"

		[[inputs.snmp.table.field]]
		name = ";cpuID"
		oid  = ";NAS-MIB::cpuID"

		[[inputs.snmp.table.field]]
		name = ";cpuUsage"
		oid  = ";NAS-MIB::cpuUsage"

	# Memory - Integers
	[[inputs.snmp.field]]
	name = ";systemTotalMemEX"
	oid  = ";NAS-MIB::systemTotalMemEX.0"

	[[inputs.snmp.field]]
	name = ";systemFreeMemEX"
	oid  = ";NAS-MIB::systemFreeMemEX.0"

	# Uptime
	[[inputs.snmp.field]]
	name = ";systemUptime"
	oid  = ";NAS-MIB::systemUptimeEX.0"

	# Temperature
	[[inputs.snmp.field]]
	name = ";systemTemperature"
	oid  = ";NAS-MIB::enclosureSystemTemp.1"

  #  Fan
  [[inputs.snmp.table]]
  name = ";snmp.QNAP.systemFanTableEx"
  oid  = ";NAS-MIB::systemFanTableEx"

	[[inputs.snmp.table.field]]
	name = ";sysFanIndexEX"
	oid  = ";NAS-MIB::sysFanIndexEX"

	[[inputs.snmp.table.field]]
	name = ";sysFanDescrEX"
	oid  = ";NAS-MIB::sysFanDescrEX"

	[[inputs.snmp.table.field]]
	name = ";sysFanSpeedEX"
	oid  = ";NAS-MIB::sysFanSpeedEX"

	#  Interfaces
[[inputs.snmp.table]]
name = ";snmp.QNAP.systemIfTableEx"
oid  = ";NAS-MIB::systemIfTableEx"

	[[inputs.snmp.table.field]]
	name = ";ifIndexEX"
	oid  = ";NAS-MIB::ifIndexEX"

	[[inputs.snmp.table.field]]
	name = ";ifDescrEX"
	oid  = ";NAS-MIB::ifDescrEX"

	[[inputs.snmp.table.field]]
	name = ";ifPacketsReceivedEX"
	oid  = ";NAS-MIB::ifPacketsReceivedEX"

	[[inputs.snmp.table.field]]
	name = ";ifPacketsSentEX"
	oid  = ";NAS-MIB::ifPacketsSentEX"

	[[inputs.snmp.table.field]]
	name = ";ifErrorPacketsEX"
	oid  = ";NAS-MIB::ifErrorPacketsEX"

#  Disk
[[inputs.snmp.table]]
name = ";snmp.QNAP.systemHdTableEX"
oid  = ";NAS-MIB::systemHdTableEX"

	[[inputs.snmp.table.field]]
	name = ";hdIndexEX"
	oid  = ";NAS-MIB::hdIndexEX"

	[[inputs.snmp.table.field]]
	name = ";hdDescrEX"
	oid  = ";NAS-MIB::hdDescrEX"

	[[inputs.snmp.table.field]]
	name = ";hdTemperatureEX"
	oid  = ";NAS-MIB::hdTemperatureEX"

	[[inputs.snmp.table.field]]
	name = ";hdStatusEX"
	oid  = ";NAS-MIB::hdStatusEX"

	[[inputs.snmp.table.field]]
	name = ";hdModelEX"
	oid  = ";NAS-MIB::hdModelEX"

	[[inputs.snmp.table.field]]
	name = ";hdSmartInfoEX"
	oid  = ";NAS-MIB::hdSmartInfoEX"

#  Volumes
[[inputs.snmp.table]]
name = ";snmp.QNAP.systemVolumeTable"
oid  = ";NAS-MIB::systemVolumeTable"

	[[inputs.snmp.table.field]]
	name = ";sysVolumeIndex"
	oid  = ";NAS-MIB::sysVolumeIndex"

	[[inputs.snmp.table.field]]
	name = ";sysVolumeDescr"
	oid  = ";NAS-MIB::sysVolumeDescr"

	[[inputs.snmp.table.field]]
	name = ";sysVolumeFS"
	oid  = ";NAS-MIB::sysVolumeFS"

	[[inputs.snmp.table.field]]
	name = ";sysVolumeTotalSize"
	oid  = ";NAS-MIB::sysVolumeTotalSize"

	[[inputs.snmp.table.field]]
	name = ";sysVolumeFreeSize"
	oid  = ";NAS-MIB::sysVolumeFreeSize"

	[[inputs.snmp.table.field]]
	name = ";sysVolumeStatus"
	oid  = ";NAS-MIB::sysVolumeStatus"

#  Disk Performance
[[inputs.snmp.table]]
name = ";snmp.QNAP.diskPerformanceTable"
oid  = ";NAS-MIB::diskPerformanceTable"

	[[inputs.snmp.table.field]]
	name = ";diskPerformanceIndex"
	oid  = ";NAS-MIB::diskPerformanceIndex"

	[[inputs.snmp.table.field]]
	name = ";blvID"
	oid  = ";NAS-MIB::blvID"

	[[inputs.snmp.table.field]]
	name = ";iops"
	oid  = ";NAS-MIB::iops"

	[[inputs.snmp.table.field]]
	name = ";latency"
	oid  = ";NAS-MIB::latency"



## ------------------------------------------- ##
## CISCO SMART SWITCH
## ------------------------------------------- ##
[[inputs.snmp]]
agents = [ ";XXX.XXX.XX.X" ]
interval = ";15s"
timeout = ";10s"
retries = 3
version = 2
community = ";community"
max_repetitions = 10
name = ";snmp.CISCO"
alias = ";cisco"


# hostname (main snmp.CISCO table)
[[inputs.snmp.field]]
name = ";hostname"
oid = ";SNMPv2-MIB::sysDescr.0"

# Instance Uptime (main snmp.CISCO table)
[[inputs.snmp.field]]
name = ";sysUpTime"
oid  = ";DISMAN-EVENT-MIB::sysUpTimeInstance"

# Port statuses
[[inputs.snmp.field]]
name = ";port1"
oid  = ";IF-MIB::ifOperStatus.49"

[[inputs.snmp.field]]
name = ";port2"
oid  = ";IF-MIB::ifOperStatus.50"

[[inputs.snmp.field]]
name = ";port3"
oid  = ";IF-MIB::ifOperStatus.51"

[[inputs.snmp.field]]
name = ";port4"
oid  = ";IF-MIB::ifOperStatus.52"

[[inputs.snmp.field]]
name = ";port5"
oid  = ";IF-MIB::ifOperStatus.53"

[[inputs.snmp.field]]
name = ";port6"
oid  = ";IF-MIB::ifOperStatus.54"

[[inputs.snmp.field]]
name = ";port7"
oid  = ";IF-MIB::ifOperStatus.55"

[[inputs.snmp.field]]
name = ";port8"
oid  = ";IF-MIB::ifOperStatus.56"

[[inputs.snmp.field]]
name = ";port9"
oid  = ";IF-MIB::ifOperStatus.57"

[[inputs.snmp.field]]
name = ";port10"
oid  = ";IF-MIB::ifOperStatus.58"

[[inputs.snmp.field]]
name = ";port11"
oid  = ";IF-MIB::ifOperStatus.59"

[[inputs.snmp.field]]
name = ";port12"
oid  = ";IF-MIB::ifOperStatus.60"

[[inputs.snmp.field]]
name = ";port13"
oid  = ";IF-MIB::ifOperStatus.61"

[[inputs.snmp.field]]
name = ";port14"
oid  = ";IF-MIB::ifOperStatus.62"

[[inputs.snmp.field]]
name = ";port15"
oid  = ";IF-MIB::ifOperStatus.63"

[[inputs.snmp.field]]
name = ";port16"
oid  = ";IF-MIB::ifOperStatus.64"

[[inputs.snmp.field]]
name = ";port17"
oid  = ";IF-MIB::ifOperStatus.65"

[[inputs.snmp.field]]
name = ";port18"
oid  = ";IF-MIB::ifOperStatus.66"

[[inputs.snmp.field]]
name = ";port19"
oid  = ";IF-MIB::ifOperStatus.67"

[[inputs.snmp.field]]
name = ";port20"
oid  = ";IF-MIB::ifOperStatus.68"

[[inputs.snmp.field]]
name = ";port21"
oid  = ";IF-MIB::ifOperStatus.69"

[[inputs.snmp.field]]
name = ";port22"
oid  = ";IF-MIB::ifOperStatus.70"

[[inputs.snmp.field]]
name = ";port23"
oid  = ";IF-MIB::ifOperStatus.71"

[[inputs.snmp.field]]
name = ";port24"
oid  = ";IF-MIB::ifOperStatus.72"


## ------------------------------------------- ##
## PFSENSE
## ------------------------------------------- ##
[[inputs.snmp]]
agents = [ ";XXX.XXX.XX.X" ]
interval = ";15s"
timeout = ";10s"
retries = 3
version = 2
community = ";community"
max_repetitions = 10
name = ";snmp.PFSENSE"
alias = ";pfsense"


# hostname (main snmp.CISCO table)
[[inputs.snmp.field]]
name = ";hostname"
oid = ";SNMPv2-MIB::sysName.0"
# is_tag = true

# Uptime (main snmp.CISCO table)
[[inputs.snmp.field]]
name = ";sysUpTime"
oid  = ";HOST-RESOURCES-MIB::hrSystemUptime.0"

# Ports (main snmp.CISCO table)
# 1 - up
# 5 - dormant (unplugged)
# 2 - down
[[inputs.snmp.field]]
name = ";port1"
oid  = ";IF-MIB::ifOperStatus.1"

[[inputs.snmp.field]]
name = ";port2"
oid  = ";IF-MIB::ifOperStatus.2"

[[inputs.snmp.field]]
name = ";port3"
oid  = ";IF-MIB::ifOperStatus.3"

[[inputs.snmp.field]]
name = ";port4"
oid  = ";IF-MIB::ifOperStatus.4"

[[inputs.snmp.field]]
name = ";port5"
oid  = ";IF-MIB::ifOperStatus.5"

[[inputs.snmp.field]]
name = ";port6"
oid  = ";IF-MIB::ifOperStatus.6"



## ------------------------------------------- ##
## LOCAL (rPI)
## ------------------------------------------- ##
[[inputs.cpu]]
percpu = true
totalcpu = true
collect_cpu_time = false
report_active = false