Problem with Telegraf and oid istance

telegraf
#1

Hello, sorry for the dumb question but I’m experiencing a collect problem with Telegraf.
I’m trying to collect SNMP data from a QNAP NAS, so far I’m able to collect “single” datas like RAM or CPU etc, however if I try to set an oid with an istance like disk number it doesn’t work at all.

I’ll post you a little example:

[[inputs.snmp.table.field]]
name = "HDD1_Temp"
oid = “1.3.6.1.4.1.24681.1.4.1.1.1.1.5.2.1.6.1”

[[inputs.snmp.table.field]]
name = "HDD2_Temp"
oid = “1.3.6.1.4.1.24681.1.4.1.1.1.1.5.2.1.6.2”

[[inputs.snmp.table.field]]
name = "HDD3_Temp"
oid = “1.3.6.1.4.1.24681.1.4.1.1.1.1.5.2.1.6.3”

[[inputs.snmp.table.field]]
name = "HDD4_Temp"
oid = “1.3.6.1.4.1.24681.1.4.1.1.1.1.5.2.1.6.4”

The last digit should be the istance, but is not collecting any data. If I remove the last digit I can gather the temp from the first HDD.
I’m sure I’m doing something wrong, but I couldn’t find any good explaination so I decided to post here.

Thanks in advance for your time

S.

#2

Can you share the entire snmp config, without any credentials of course. Also check what this command returns (probably need to change the connection settings:

snmptable -v2c -c public localhost:161 .1.3.6.1.4.1.24681.1.4.1.1.1.1.5.2.1.6
1 Like
#3

Thanks for helping me, here you go:

[global_tags]
[agent]
interval = "10s"
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = "0s"
flush_interval = "10s"
flush_jitter = "0s"
precision = ""
debug = false
quiet = false
logfile = ""
hostname = ""
omit_hostname = false
[[outputs.influxdb]]
urls = [“http://localhost:8086”] # required
database = “telegraf” # required
retention_policy = ""
write_consistency = "any"
timeout = “5s”
[[inputs.cpu]]
percpu = true
totalcpu = true
collect_cpu_time = false
[[inputs.disk]]
ignore_fs = [“tmpfs”, “devtmpfs”, “devfs”]
[[inputs.diskio]]
[[inputs.kernel]]
[[inputs.mem]]
[[inputs.processes]]
[[inputs.swap]]
[[inputs.system]]
[[inputs.snmp]]
agents = [ “192.168.1.10:161” ]
timeout = "5s"
retries = 3
version = 2
community = "public"
max_repetitions = 10

[[inputs.snmp.table]]
name = “remote_servers”

[[inputs.snmp.table.field]]
name = "Fan_Speed"
oid = “1.3.6.1.4.1.24681.1.3.15.1.3”

[[inputs.snmp.table.field]]
name = "CPU_Load"
oid = “1.3.6.1.4.1.24681.1.3.1”

[[inputs.snmp.table.field]]
name = "CPU_Temp"
oid = “1.3.6.1.4.1.24681.1.3.5”

[[inputs.snmp.table.field]]
name = "System_Temp"
oid = “1.3.6.1.4.1.24681.1.3.6”

[[inputs.snmp.table.field]]
name = "Total_RAM"
oid = “1.3.6.1.4.1.24681.1.3.2”

[[inputs.snmp.table.field]]
name = "Free_RAM"
oid = “1.3.6.1.4.1.24681.1.3.3”

[[inputs.snmp.table.field]]
name = "HDD1_Temp"
oid = “1.3.6.1.4.1.24681.1.4.1.1.1.1.5.2.1.6”

[[inputs.snmp.table.field]]
name = "HDD2_Temp"
oid = “1.3.6.1.4.1.24681.1.4.1.1.1.1.5.2.1.6”

[[inputs.snmp.table.field]]
name = "HDD3_Temp"
oid = “1.3.6.1.4.1.24681.1.4.1.1.1.1.5.2.1.6”

[[inputs.snmp.table.field]]
name = "HDD4_Temp"
oid = “1.3.6.1.4.1.24681.1.4.1.1.1.1.5.2.1.6”

With this configuration I’m able to see the first HDD Temp, if I add at the end of the oid the istance it no longer works…

And the command output is:
Was that a table? iso.3.6.1.4.1.24681.1.4.1.1.1.1.5.2.1.6

Thanks again

S.

#4

Try adding a field that will provide a tag, such as:

  [[inputs.snmp.field]]
    name = "hostname"
    oid = "RFC1213-MIB::sysName.0"
    is_tag = true
#5

Hello, I solved the problem, so I leave this here in case might be helpful for someone else:

[global_tags]

[agent]
interval = "10s"
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = "0s"
flush_interval = "10s"
flush_jitter = "0s"
precision = ""
debug = false
quiet = false
logfile = ""
hostname = ""
omit_hostname = false

[[outputs.influxdb]]
urls = [“http://localhost:8086”] # required
database = “telegraf” # required
retention_policy = ""
write_consistency = "any"
timeout = “5s”

#[[inputs.cpu]]

percpu = true

totalcpu = true

collect_cpu_time = false

#[[inputs.disk]]

ignore_fs = [“tmpfs”, “devtmpfs”, “devfs”]

#[[inputs.diskio]]
#[[inputs.kernel]]
#[[inputs.mem]]
#[[inputs.processes]]
#[[inputs.swap]]
#[[inputs.system]]

[[inputs.snmp]]
agents = [ “192.168.1.10:161” ]
timeout = "5s"
retries = 3
version = 2
community = "public"
max_repetitions = 10

#[[inputs.snmp.table]]
#name = “remote_servers”

[[inputs.snmp.field]]
name = "Fan_Speed"
oid = “1.3.6.1.4.1.24681.1.3.15.1.3.1”

[[inputs.snmp.field]]
name = "CPU_Load"
oid = “1.3.6.1.4.1.24681.1.3.1.0”

[[inputs.snmp.field]]
name = "CPU_Temp"
oid = “1.3.6.1.4.1.24681.1.4.1.1.1.1.4.2.0”

[[inputs.snmp.field]]
name = "System_Temp"
oid = “1.3.6.1.4.1.24681.1.3.6.0”

[[inputs.snmp.field]]
name = "Total_RAM"
oid = “1.3.6.1.4.1.24681.1.3.2.0”

[[inputs.snmp.field]]
name = "Free_RAM"
oid = “1.3.6.1.4.1.24681.1.3.3.0”

[[inputs.snmp.field]]
name = "Volume_1_Capacity"
oid = “1.3.6.1.4.1.24681.1.4.1.1.1.2.3.2.1.3.1”

[[inputs.snmp.field]]
name = "Volume_2_Capacity"
oid = “1.3.6.1.4.1.24681.1.4.1.1.1.2.3.2.1.3.2”

[[inputs.snmp.field]]

name = "Volume_1_FreeSpace"
oid = “1.3.6.1.4.1.24681.1.4.1.1.1.2.3.2.1.4.1”

[[inputs.snmp.field]]

name = "Volume_2_FreeSpace"
oid = “1.3.6.1.4.1.24681.1.4.1.1.1.2.3.2.1.4.2”

[[inputs.snmp.field]]

name = "LAN_SentPackets"
oid = “1.3.6.1.4.1.24681.1.3.9.1.4.1”

[[inputs.snmp.field]]

name = "LAN_ReceivedPackets"
oid = “1.3.6.1.4.1.24681.1.3.9.1.3.1”

[[inputs.snmp.field]]

name = "Disk1_Temp"
oid = “1.3.6.1.4.1.24681.1.4.1.1.1.1.5.2.1.6.1”

[[inputs.snmp.field]]

name = "Disk2_Temp"
oid = “1.3.6.1.4.1.24681.1.4.1.1.1.1.5.2.1.6.2”

[[inputs.snmp.field]]

name = "Disk3_Temp"
oid = “1.3.6.1.4.1.24681.1.4.1.1.1.1.5.2.1.6.3”

[[inputs.snmp.field]]

name = "Disk4_Temp"
oid = “1.3.6.1.4.1.24681.1.4.1.1.1.1.5.2.1.6.4”

With this configuration the OID istances are recognized.