I’m using telegraf for pulling metrics from my switches and other devices using SNMP and API.
recently I’ve noticed that my switch CPU is affected by these pulling (not all vendors).
while telegraf is pulling data from these switches the CPU spikes up to 60-90%.
the data impulling is sysinfo and health (name/uptime/cpu/mem/temp) and interfaces information.
so I’ve used the below telegraf config in order to pull specific fields of the interfaces tables, and it decreased the spikes, but not eliminated them.
I would like to better optimaize my pulling, is there a way to add a sleep timer between OIDs pulling?
thanks
[[inputs.snmp.table]]
name = "interface"
inherit_tags = ["hostname"]
# Interface tag - used to identify interface in metrics database
[[inputs.snmp.table.field]]
name = "Descr"
oid = "IF-MIB::ifDescr"
is_tag = true
[[inputs.snmp.table.field]]
oid = "IF-MIB::ifInErrors"
[[inputs.snmp.table.field]]
oid = "IF-MIB::ifInDiscards"
[[inputs.snmp.table.field]]
oid = "IF-MIB::ifOutErrors"
[[inputs.snmp.table.field]]
oid = "IF-MIB::ifOutDiscards"
[[inputs.snmp.table.field]]
oid = "IF-MIB::ifOperStatus"
[[inputs.snmp.table.field]]
oid = "IF-MIB::ifSpeed"
[[inputs.snmp.table.field]]
oid = "IF-MIB::ifLastChange"
[[inputs.snmp.table]]
name = "ifXTable"
inherit_tags = ["hostname"]
[[inputs.snmp.table.field]]
name = "ifDescr"
oid = "IF-MIB::ifDescr"
is_tag = true
[[inputs.snmp.table.field]]
name = "ifName"
oid = "IF-MIB::ifName"
is_tag = true
[[inputs.snmp.table.field]]
oid = "IF-MIB::ifHCInOctets"
[[inputs.snmp.table.field]]
oid = "IF-MIB::ifHCOutOctets"
actually, the above config did help a bit, due to pulling fewer table fields.
but I wonder is there a way to insert a sleep timer between the OIDs I’m pulling? I think that this will shorten the pulling period for each query.
Yeah. Only way to do something like this is to split the table’s into a separate snmp config. Then you could use the offset parameter to wait a certain time to poll these oids
do you think that collection_jitter will be a good option as well?
something like this, that if i understand currently will randomly collect the IFtable (in my case, the config is below) in intervals of 60s to 10s.
thanks
# switches Juniper
[[inputs.snmp]]
agents = ["udp://172.17.x.x:161"]
version = 2
community = "XXX"
[[inputs.snmp.field]]
name = "sysDescr"
oid = "SNMPv2-MIB::sysDescr.0"
is_tag = true
[[inputs.snmp.field]]
name = "hostname"
oid = "RFC1213-MIB::sysName.0"
is_tag = true
[[inputs.snmp.field]]
name = "uptime"
oid = "DISMAN-EXPRESSION-MIB::sysUpTimeInstance"
[[inputs.snmp.field]]
name = "memory"
oid = "ARICENT-ISS-MIB::issSwitchCurrentRAMUsage.0"
[[inputs.snmp.field]]
name = "temp"
oid = "ARICENT-ISS-MIB::issSwitchCurrentTemperature.0"
[[inputs.snmp.table]]
name = "ifXTable"
inherit_tags = ["hostname"]
[[inputs.snmp.table.field]]
name = "ifDescr"
oid = "IF-MIB::ifDescr"
is_tag = true
[[inputs.snmp.table.field]]
name = "ifName"
oid = "IF-MIB::ifName"
is_tag = true
[[inputs.snmp.table.field]]
oid = "IF-MIB::ifHCInOctets"
[[inputs.snmp.table.field]]
oid = "IF-MIB::ifHCOutOctets"
# switches Juniper
[[inputs.snmp]]
agents = ["udp://172.17.x.x:161"]
version = 2
community = "XXXX"
collection_jitter = "10s"
[[inputs.snmp.field]]
name = "hostname"
oid = "RFC1213-MIB::sysName.0"
is_tag = true
[[inputs.snmp.table]]
name = "interface"
inherit_tags = ["hostname"]
# Interface tag - used to identify interface in metrics database
[[inputs.snmp.table.field]]
name = "Descr"
oid = "IF-MIB::ifDescr"
is_tag = true
[[inputs.snmp.table.field]]
oid = "IF-MIB::ifInErrors"
[[inputs.snmp.table.field]]
oid = "IF-MIB::ifInDiscards"
[[inputs.snmp.table.field]]
oid = "IF-MIB::ifOutErrors"
[[inputs.snmp.table.field]]
oid = "IF-MIB::ifOutDiscards"
[[inputs.snmp.table.field]]
oid = "IF-MIB::ifOperStatus"
[[inputs.snmp.table.field]]
oid = "IF-MIB::ifSpeed"
[[inputs.snmp.table.field]]
oid = "IF-MIB::ifLastChange"
That depends on where you store the results, In my case (graphite) that will result in unpredictable, unreliable unstable results because of the rounding of the timestamp to the configured interval.
Jitter will set the interval to configured interval + random between 0s and 10s.