I am trying to poll a Cisco router’s interfaces to get the current bit rate by polling the ifHCInOctets and ifHCOutOctets. This works fine and I get the numbers, however I want to get the delta between the last and current poll so I can see the current amount of traffic on the interface. I’ve tried processors and aggregators but nothing is working so far. Anyone have an idea how I can accomplish this? Thanks!
[agent]
debug = true
interval = "10s"
flush_interval = "10s"
omit_hostname = false
round_interval = true
[[inputs.snmp]]
agents = ["${ROUTER_IP}"]
version = 2
community = "${SNMP_COMMUNITY}"
interval = "10s"
agent_host_tag = "source"
# Port-channel40
[[inputs.snmp.field]]
name = "po40_ifInOctets"
oid = "IF-MIB::ifHCInOctets.61"
conversion = "int"
[[inputs.snmp.field]]
name = "po40_ifOutOctets"
oid = "IF-MIB::ifHCOutOctets.61"
conversion = "int"
[[aggregators.basicstats]]
drop_original = false
namepass = ["po40_ifInOctets", "po40_ifOutOctets"]
period = "10s"
# mqtt output
[[outputs.mqtt]]
data_format = "json"
protocol = "3.1.1"
servers = ["${MQTT_SERVER}:1883"]
topic = "router/${ROUTER_IP}"
This is the output I’m getting in MQTT:
{
"fields": {
"po40_ifInOctets": 26984590881118730,
"po40_ifOutOctets": 19059662710492224
},
"name": "snmp",
"tags": {
"host": "61b9377503b1",
"source": "10.15.11.14"
},
"timestamp": 1724182740
}