I’m currently collecting data using telegraf and the input SNMP plugin which is working great but I need a higher level of precision.
I tried to set the following in my telegraf.conf file:
[agent]
## By default or when set to "0s", precision will be set to the same
## timestamp order as the collection interval, with the maximum being 1s.
## ie, when interval = "10s", precision will be "1s"
## when interval = "250ms", precision will be "1ms"
## Precision will NOT be used for service inputs. It is up to each individual
## service input to set the timestamp at the appropriate precision.
## Valid time units are "ns", "us" (or "µs"), "ms", "s".
precision = "ns" //tried ms too
My SNMP input plugin looks like this:
[[inputs.snmp]]
# List of hosts to poll
agents = [
"udp://east-ece1:161"
]
interval = "5s" //tried setting this to 5000ms as well
## Timeout for each request.
timeout = "1000s"
## SNMP version; can be 1, 2, or 3.
version = 2
## SNMP community string.
community = "public"
## Number of retries to attempt.
retries = 5
[inputs.snmp.tags]
type="snmp"
projectId="1"
collectionId="1"
[[inputs.snmp.table]]
name = "interface"
index_as_tag = true
[[inputs.snmp.table.field]]
oid = "1.3.6.1.2.1.31.1.1.1.6"
name = "SNMP_IF-MIB::ifHCInOctets"
[[inputs.snmp.table.field]]
oid = "1.3.6.1.2.1.31.1.1.1.10"
name = "SNMP_IF-MIB::ifHCOutOctets"
No matter what I do i can’t seem to get any precision that’s higher than second. How can I get a ms or ns precision on the timestamps?
Sample output:
{
"fields": {
"SNMP_IF-MIB::ifHCInOctets": 1058824135606,
"SNMP_IF-MIB::ifHCOutOctets": 225501345550
},
"name": "interface",
"tags": {
"collectionId": "1",
"device": "east-ece1",
"oidIndex": "2001",
"projectId": "1",
"sourceId": "10",
"type": "snmp"
},
"timestamp": 1603386273
}
Any help would be appreciated.
NOTE: there are a few more transformations, but nothing to do with date. For reference adding the config here as well:
[[processors.rename]]
[[processors.rename.replace]]
tag = "agent_host"
dest = "device"
[[processors.rename.replace]]
tag = "host"
dest = "collector"
[[processors.rename.replace]]
tag = "index"
dest = "oidIndex"