Error running agent: could not initialize input inputs.snmp | Cannot find module (NAS-MIB)

Hi all,
I’m trying to configure monitoring a Qnap with Telegram (ver 1.30.3), InfluxDB (V2) and Grafana => QNAP Dashboard - Telegraf SNMP - InfluxDB | Grafana Labs
file config of Telegraf:

Configuration for telegraf agent

[agent]

Default data collection interval for all inputs

interval = “10s”

Rounds collection interval to ‘interval’

ie, if interval=“10s” then always collect on :00, :10, :20, etc.

round_interval = true

Telegraf will send metrics to outputs in batches of at most

metric_batch_size metrics.

This controls the size of writes that Telegraf sends to output plugins.

metric_batch_size = 1000

Maximum number of unwritten metrics per output. Increasing this value

allows for longer periods of output downtime without dropping metrics at the

cost of higher maximum memory usage.

metric_buffer_limit = 10000

Collection jitter is used to jitter the collection by a random amount.

Each plugin will sleep for a random time within jitter before collecting.

This can be used to avoid many plugins querying things like sysfs at the

same time, which can have a measurable effect on the system.

collection_jitter = “0s”

Default flushing interval for all outputs. Maximum flush_interval will be

flush_interval + flush_jitter

flush_interval = “10s”

Jitter the flush interval by a random amount. This is primarily to avoid

large write spikes for users running a large number of telegraf instances.

ie, a jitter of 5s and interval 10s means flushes will happen every 10-15s

flush_jitter = “0s”

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 = “”

Log at debug level.

debug = false

Log only error level messages.

quiet = false

Log target controls the destination for logs and can be one of “file”,

“stderr” or, on Windows, “eventlog”. When set to “file”, the output file

is determined by the “logfile” setting.

logtarget = “file”

Name of the file to be logged to when using the “file” logtarget. If set to

the empty string then logs are written to stderr.

logfile = “”

The logfile will be rotated after the time interval specified. When set

to 0 no time based rotation is performed. Logs are rotated only when

written to, if there is no log activity rotation may be delayed.

logfile_rotation_interval = “0d”

The logfile will be rotated when it becomes larger than the specified

size. When set to 0 no size based rotation is performed.

logfile_rotation_max_size = “0MB”

Maximum number of rotated archives to keep, any older logs are deleted.

If set to -1, no archives are removed.

logfile_rotation_max_archives = 5

Pick a timezone to use when logging or type ‘local’ for local time.

Example: America/Chicago

log_with_timezone = “”

Override default hostname, if empty use os.Hostname()

hostname = “”

If set to true, do no set the “host” tag in the telegraf agent.

omit_hostname = false
[[outputs.influxdb_v2]]

The URLs of the InfluxDB cluster nodes.

Multiple URLs can be specified for a single cluster, only ONE of the

urls will be written to each interval.

ex: urls = [“ht tps://us-west-2-1.aws.cloud2.influxdata.com”]

urls = [“ht tp://192.168.1.25:8086”]

Token for authentication.

token = “$INFLUX_TOKEN”

Organization is the name of the organization you wish to write to; must exist.

organization = “fritz_users”

Destination bucket to write into.

bucket = “telegraf”

The value of this tag will be used to determine the bucket. If this

tag is not set the ‘bucket’ option is used as the default.

bucket_tag = “”

If true, the bucket tag will not be added to the metric.

exclude_bucket_tag = false

Timeout for HTTP messages.

timeout = “5s”

Additional HTTP headers

http_headers = {“X-Special-Header” = “Special-Value”}

HTTP Proxy override, if unset values the standard proxy environment

variables are consulted to determine which proxy, if any, should be used.

http_proxy = “ht tp://corporate.proxy:3128”

HTTP User-Agent

user_agent = “telegraf”

Content-Encoding for write request body, can be set to “gzip” to

compress body or “identity” to apply no encoding.

content_encoding = “gzip”

Enable or disable uint support for writing uints influxdb 2.0.

influx_uint_support = false

Optional TLS Config for use on HTTP connections.

tls_ca = “/etc/telegraf/ca.pem”

tls_cert = “/etc/telegraf/cert.pem”

tls_key = “/etc/telegraf/key.pem”

Use TLS but skip chain & host verification

insecure_skip_verify = false

Retrieves SNMP values from remote agents

[[inputs.snmp]]

Agent addresses to retrieve values from.

format: agents = [“scheme://:”]

scheme: optional, either udp, udp4, udp6, tcp, tcp4, tcp6.

default is udp

port: optional

example: agents = [“udp://127.0.0.1:161”]

agents = [“tcp://127.0.0.1:161”]

agents = [“udp4://v4only-snmp-agent”]

agents = [“udp://192.168.1.24:161”]

Timeout for each request.

timeout = “5s”

SNMP version; can be 1, 2, or 3.

version = 2

Unconnected UDP socket

When true, SNMP reponses are accepted from any address not just

the requested address. This can be useful when gathering from

redundant/failover systems.

unconnected_udp_socket = false

Path to mib files

Used by the gosmi translator.

To add paths when translating with netsnmp, use the MIBDIRS environment variable

path = [“/usr/share/snmp/mibs”]

SNMP community string.

community = “monitoring-ro”

Agent host tag

agent_host_tag = “snmp.QNAP”

Number of retries to attempt.

retries = 3

The GETBULK max-repetitions parameter.

max_repetitions = 10

SNMPv3 authentication and encryption options.

Security Name.

sec_name = “myuser”

Authentication protocol; one of “MD5”, “SHA”, “SHA224”, “SHA256”, “SHA384”, “SHA512” or “”.

auth_protocol = “MD5”

Authentication password.

auth_password = “pass”

Security Level; one of “noAuthNoPriv”, “authNoPriv”, or “authPriv”.

sec_level = “authNoPriv”

Context Name.

context_name = “”

Privacy protocol used for encrypted messages; one of “DES”, “AES”, “AES192”, “AES192C”, “AES256”, “AES256C”, or “”.

Protocols “AES192”, “AES192”, “AES256”, and “AES256C” require the underlying net-snmp tools

to be compiled with --enable-blumenthal-aes (ht tp://www.net-snmp.org/docs/INSTALL.html)

priv_protocol = “”

Privacy password used for encrypted messages.

priv_password = “”

Add fields and tables defining the variables you wish to collect. This

example collects the system uptime and interface variables. Reference the

full plugin documentation for configuration details.

System Details & Metrics

CPU

[[inputs.snmp.field]]
name = “name”
oid = “NAS-MIB::enclosureName.1”
is_tag = true

[[inputs.snmp.table]]
name = “snmp.QNAP.cpuTable”
oid = “NAS-MIB::cpuTable”
[[inputs.snmp.table.field]]
name = “cpuIndex”
oid = “NAS-MIB::cpuIndex”
is_tag = true
[[inputs.snmp.table.field]]
name = “cpuID”
oid = “NAS-MIB::cpuID”
is_tag = true
[[inputs.snmp.table.field]]
name = “cpuUsage”
oid = “NAS-MIB::cpuUsage”

System

Enclosures

[[inputs.snmp.table]]
name = “snmp.QNAP.systemTable”

Memory

[[inputs.snmp.table.field]]
name = “systemTotalMemEX”
oid = “NAS-MIB::systemTotalMemEX”
[[inputs.snmp.table.field]]
name = “systemFreeMemEX”
oid = “NAS-MIB::systemFreeMemEX”

System temp

[[inputs.snmp.table.field]]
name = “cpu-TemperatureEX”
oid = “NAS-MIB::cpu-TemperatureEX”
[[inputs.snmp.table.field]]
name = “systemTemperatureEX”
oid = “NAS-MIB::systemTemperatureEX”

Uptime

[[inputs.snmp.table.field]]
name = “systemUptime”
oid = “NAS-MIB::systemUptimeEX”

Uptime

[[inputs.snmp.table.field]]
name = “systemCPU-UsageEX”
oid = “NAS-MIB::systemCPU-UsageEX”

Enclosures

[[inputs.snmp.table]]
name = “snmp.QNAP.enclosureTable”
oid = “NAS-MIB::enclosureTable”
# Memory
[[inputs.snmp.table.field]]
name = “enclosureID”
oid = “NAS-MIB::enclosureID”
is_tag = true
[[inputs.snmp.table.field]]
name = “enclosureModel”
oid = “NAS-MIB::enclosureModel”
is_tag = true
[[inputs.snmp.table.field]]
name = “enclosureName”
oid = “NAS-MIB::enclosureName”
is_tag = true
[[inputs.snmp.table.field]]
name = “enclosureSystemTemp”
oid = “NAS-MIB::enclosureSystemTemp”

Fan

[[inputs.snmp.table]]
name = “snmp.QNAP.systemFanTableEx”
oid = “NAS-MIB::systemFanTableEx”
[[inputs.snmp.table.field]]
name = “sysFanIndexEX”
oid = “NAS-MIB::sysFanIndexEX”
is_tag = true
[[inputs.snmp.table.field]]
name = “sysFanDescrEX”
oid = “NAS-MIB::sysFanDescrEX”
is_tag = true
[[inputs.snmp.table.field]]
name = “sysFanSpeedEX”
oid = “NAS-MIB::sysFanSpeedEX”

Power

[[inputs.snmp.table]]
name = “snmp.QNAP.systemPowerTable”
oid = “NAS-MIB::systemPowerTable”
[[inputs.snmp.table.field]]
name = “systemPowerIndex”
oid = “NAS-MIB::systemPowerIndex”
is_tag = true
[[inputs.snmp.table.field]]
name = “systemPowerID”
oid = “NAS-MIB::systemPowerID”
is_tag = true
[[inputs.snmp.table.field]]
name = “systemPowerEnclosureID”
oid = “NAS-MIB::systemPowerEnclosureID”
is_tag = true
[[inputs.snmp.table.field]]
name = “systemPowerStatus”
oid = “NAS-MIB::systemPowerStatus”
[[inputs.snmp.table.field]]
name = “systemPowerFanSpeed”
oid = “NAS-MIB::systemPowerFanSpeed”
[[inputs.snmp.table.field]]
name = “systemPowerFanSpeed”
oid = “NAS-MIB::systemPowerFanSpeed”
[[inputs.snmp.table.field]]
name = “systemPowerTemp”
oid = “NAS-MIB::systemPowerTemp”

Interfaces

[[inputs.snmp.table]]
name = “snmp.QNAP.systemIfTableEx”
oid = “NAS-MIB::systemIfTableEx”
[[inputs.snmp.table.field]]
name = “ifIndexEX”
oid = “NAS-MIB::ifIndexEX”
is_tag = true
[[inputs.snmp.table.field]]
name = “ifDescrEX”
oid = “NAS-MIB::ifDescrEX”
is_tag = true
[[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”

Interfaces

[[inputs.snmp.table]]
name = “snmp.QNAP.ifXTable”
oid = “IF-MIB::ifXTable”
[[inputs.snmp.table.field]]
name = “ifName”
oid = “IF-MIB::ifName”
is_tag = true
[[inputs.snmp.table.field]]
name = “ifHCInOctets”
oid = “IF-MIB::ifHCInOctets”
[[inputs.snmp.table.field]]
name = “ifHCOutOctets”
oid = “IF-MIB::ifHCOutOctets”

Disk Details & Metrics

Disk

[[inputs.snmp.table]]
name = “snmp.QNAP.diskTable”
oid = “NAS-MIB::diskTable”
[[inputs.snmp.table.field]]
name = “diskIndex”
oid = “NAS-MIB::diskIndex”
is_tag = true
[[inputs.snmp.table.field]]
name = “diskID”
oid = “NAS-MIB::diskID”
is_tag = true
[[inputs.snmp.table.field]]
name = “diskEnclosureID”
oid = “NAS-MIB::diskEnclosureID”
is_tag = true
[[inputs.snmp.table.field]]
name = “diskSummary”
oid = “NAS-MIB::diskSummary”
[[inputs.snmp.table.field]]
name = “diskTemperture”
oid = “NAS-MIB::diskTemperture”
[[inputs.snmp.table.field]]
name = “diskSmartInfo”
oid = “NAS-MIB::diskSmartInfo”
[[inputs.snmp.table.field]]
name = “diskGlobalSpare”
oid = “NAS-MIB::diskGlobalSpare”
[[inputs.snmp.table.field]]
name = “diskModel”
oid = “NAS-MIB::diskModel”
is_tag = true
[[inputs.snmp.table.field]]
name = “diskCapacity”
oid = “NAS-MIB::diskCapacity”
is_tag = true

Volume Details & Metrics

Volumes

[[inputs.snmp.table]]
name = “snmp.QNAP.systemVolumeTableEx”
oid = “NAS-MIB::systemVolumeTableEx”
[[inputs.snmp.table.field]]
name = “sysVolumeIndexEX”
oid = “NAS-MIB::sysVolumeIndexEX”
is_tag = true
[[inputs.snmp.table.field]]
name = “sysVolumeDescrEX”
oid = “NAS-MIB::sysVolumeDescrEX”
is_tag = true
[[inputs.snmp.table.field]]
name = “sysVolumeFSEX”
oid = “NAS-MIB::sysVolumeFSEX”
is_tag = true
[[inputs.snmp.table.field]]
name = “sysVolumeTotalSizeEX”
oid = “NAS-MIB::sysVolumeTotalSize”
[[inputs.snmp.table.field]]
name = “sysVolumeFreeSize”
oid = “NAS-MIB::sysVolumeFreeSizeEX”
[[inputs.snmp.table.field]]
name = “sysVolumeStatus”
oid = “NAS-MIB::sysVolumeStatusEX”

Disk Performance Details & Metrics

Disk Performance

[[inputs.snmp.table]]
name = “snmp.QNAP.diskPerformanceTable”
oid = “NAS-MIB::diskPerformanceTable”
[[inputs.snmp.table.field]]
name = “diskPerformanceIndex”
oid = “NAS-MIB::diskPerformanceIndex”
is_tag = true
[[inputs.snmp.table.field]]
name = “blvID”
oid = “NAS-MIB::blvID”
is_tag = true
[[inputs.snmp.table.field]]
name = “iops”
oid = “NAS-MIB::iops”
[[inputs.snmp.table.field]]
name = “latency”
oid = “NAS-MIB::latency”

JBOD

[[inputs.snmp.table]]
name = “snmp.QNAP.jBODHdTable1”
oid = “NAS-MIB::jBODHdTable1”
[[inputs.snmp.table.field]]
name = “jBODHdIndex1”
oid = “NAS-MIB::jBODHdIndex1”
is_tag = true
[[inputs.snmp.table.field]]
name = “jBODHdDescr1”
oid = “NAS-MIB::jBODHdDescr1”
is_tag = true
[[inputs.snmp.table.field]]
name = “jBODHdTemperature1”
oid = “NAS-MIB::sysVolumeFSEX”
[[inputs.snmp.table.field]]
name = “jBODHdStatus1”
oid = “NAS-MIB::jBODHdStatus1”
[[inputs.snmp.table.field]]
name = “jBODHdModel1”
oid = “NAS-MIB::jBODHdModel1”
is_tag = true
[[inputs.snmp.table.field]]
name = "jBODHdCapacity1 "
oid = “NAS-MIB::jBODHdCapacity1”
[[inputs.snmp.table.field]]
name = “jBODHdSmartInfo1”
oid = “NAS-MIB::jBODHdSmartInfo1”
but if I paste the API token and try to start telegraf:
telegraf --config ht tp://192.168.1.25:8086/api/v2/telegrafs/XXXXXXXXX
I have this result:
I! Loading config: ht tp://192.168.1.25:8086/api/v2/telegrafs/XXXXXXXX
I! Starting Telegraf 1.30.3 brought to you by InfluxData the makers of InfluxDB
I! Available plugins: 233 inputs, 9 aggregators, 31 processors, 24 parsers, 60 outputs, 6 secret-stores
I! Loaded inputs: snmp
I! Loaded aggregators:
I! Loaded processors:
I! Loaded secretstores:
I! Loaded outputs: influxdb_v2
I! Tags enabled: host=monitorr
I! [agent] Config: Interval:10s, Quiet:false, Hostname:“monitorr”, Flush Interval:10s
E! [telegraf] Error running agent: could not initialize input inputs.snmp: initializing table snmp.QNAP.cpuTable: translating: MIB search path: /home/monitor/.snmp/mibs:/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf
Cannot find module (NAS-MIB): At line 1 in (none)
NAS-MIB::cpuTable: Unknown Object Identifier: exit status 2

but in /usr/share/snmp/mibs NAS-MIB is present!

monitor@monitorr:/usr/share/snmp/mibs$ ll
total 308
drwxr-xr-x 2 root root 4096 Jun 3 16:02 ./
drwxr-xr-x 5 root root 4096 May 31 20:02 …/
-rw-r–r-- 1 root root 5931 Feb 17 2023 LM-SENSORS-MIB.txt
-rwxrwxrwx 1 root root 148598 May 31 20:31 NAS-MIB.txt*
-rw-r–r-- 1 root root 15901 Feb 17 2023 NET-SNMP-AGENT-MIB.txt
-rw-r–r-- 1 root root 9160 Feb 17 2023 NET-SNMP-EXAMPLES-MIB.txt
-rw-r–r-- 1 root root 9326 Feb 17 2023 NET-SNMP-EXTEND-MIB.txt
-rw-r–r-- 1 root root 2036 Feb 17 2023 NET-SNMP-MIB.txt
-rw-r–r-- 1 root root 3730 Feb 17 2023 NET-SNMP-PASS-MIB.txt
-rw-r–r-- 1 root root 4814 Feb 17 2023 NET-SNMP-TC.txt
-rw-r–r-- 1 root root 5039 Feb 17 2023 NET-SNMP-VACM-MIB.txt
-rw-r–r-- 1 root root 2163 Feb 17 2023 UCD-DEMO-MIB.txt
-rw-r–r-- 1 root root 4965 Feb 17 2023 UCD-DISKIO-MIB.txt
-rw-r–r-- 1 root root 3087 Feb 17 2023 UCD-DLMOD-MIB.txt
-rw-r–r-- 1 root root 8118 Feb 17 2023 UCD-IPFWACC-MIB.txt
-rw-r–r-- 1 root root 53338 Feb 17 2023 UCD-SNMP-MIB.txt

What could be the problem?

Thanks,
G.

Hey @justgigia

Please in the future use markdown syntaxes, such as ` char for code:

# Configuration for telegraf agent

[agent]

I think that’s only because of user owner…
As you can see on your ls command, root is the owner of the NAS-MIB.txt file, and I think he’s the owner of the whole /usr/share/snmp/mibs dir. The problem is, Telegraf service is using the user Telegraf.

Also I don’t really understand why you specify the path for your MIBs in the telegraf.conf: if your SNMP server is correctly configured, there’s no need to manually add the path in Telegraf.
Can you show us your SNMP conf? (hide sensitive information)

Regards

Hi @codi640, I know I made a mess without markdown syntaxes, sorry.
Even if I change owneship of the file:
-rwxrwxrwx 1 telegraf root 148598 May 31 20:31 NAS-MIB.txt*
same result.

snmp.conf =>
"
As the snmp packages come without MIB files due to license reasons, loading
of MIBs is disabled by default. If you added the MIBs you can reenable
loading them by commenting out the following line.
mibs :

If you want to globally change where snmp libraries, commands and daemons
look for MIBS, change the line below. Note you can set this for individual
tools with the -M option or MIBDIRS environment variable.

mibdirs /usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf:
"
Should I add a $DIR with owneship telegraf in snmp.conf?

Thanks,
G

You can still edit your message haha.

If you only change de owner of the file but the dir where this file is located is still owned by root it’s basically useless (unless you made specific groups etc.)…

My snmp.conf file looks like that:

# As the snmp packages come without MIB files due to license reasons, loading
# of MIBs is disabled by default. If you added the MIBs you can reenable
# loading them by commenting out the following line.
mibs :
mibdirs : $HOME/.snmp/mibs:/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf:/usr/share/mibs/site:/usr/share/snmp/mibs:/usr/share/mibs/iana:/usr/share/mibs/ietf:/usr/share/mibs/netsnmp:/usr/share/snmp/mibs/custom:$MY_ADDITIONAL_MIBDIRS

# If you want to globally change where snmp libraries, commands and daemons
# look for MIBS, change the line below. Note you can set this for individual
# tools with the -M option or MIBDIRS environment variable.
#
# mibdirs /usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf

And as you can see, there’s the dir /usr/share/mibs/netsnmp which relate to the particular MIB I need.
Don’t worry, my MY_ADDITIONAL_MIBDIRS variable is empty.

But maybe I did not download the different MIBs as the way you did. Can you explain me how you DL the MIBs?

I will try to to modify the snmp.conf like you suggest and I’ll create a dir with owneship “telegraf” and I’ll put the MIB inside.
The MIBs that (for now) don’t work have been downloaed directly from my Qnap, and then with Winscp I uploaded it in the Ubuntu VM.

I will update you :blush:

ok, so I created a path => /usr/share/snmp/mibs/telegraf
drwxrwxrwx 2 telegraf root 4096 Jun 19 23:04 telegraf/
and I inserted the MIB file:
-rwxrwxrwx 1 telegraf root 148598 May 31 23:31 NAS-MIB*

but same error:
monitor@monitorr:/home/monitor telegraf --config ht tp://192.168.1.25:8086/api/v2/telegrafs/XXXXXXXXXX
I! Loading config: ht tp://192.168.1.25:8086/api/v2/telegrafs/XXXXXXXXXX
I! Starting Telegraf 1.30.3 brought to you by InfluxData the makers of InfluxDB
I! Available plugins: 233 inputs, 9 aggregators, 31 processors, 24 parsers, 60 outputs, 6 secret-stores
I! Loaded inputs: snmp
I! Loaded aggregators:
I! Loaded processors:
I! Loaded secretstores:
I! Loaded outputs: influxdb_v2
I! Tags enabled: host=monitorr
I! [agent] Config: Interval:10s, Quiet:false, Hostname:“monitorr”, Flush Interval:10s
E! [telegraf] Error running agent: could not initialize input inputs.snmp: initializing table snmp.QNAP.cpuTable: translating: MIB search path: : /home/monitor/.snmp/mibs:/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf:/usr/share/snmp/mibs/telegraf:
Cannot find module (NAS-MIB): At line 1 in (none)
NAS-MIB::cpuTable: Unknown Object Identifier: exit status 2

Hey @justgigia

Can you confirm that you downloaded the mib via this link on a windows machine?

Well the error is quite clear haha:

E! [telegraf] Error running agent: could not initialize input inputs.snmp: initializing table snmp.QNAP.cpuTable: translating: MIB search path: : /home/monitor/.snmp/mibs:/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf:/usr/share/snmp/mibs/telegraf:
Cannot find module (NAS-MIB)

This basically means that telegraf did not load your NAS-MIB. It also provide you with the mibdirs of your snmp.conf where we can tell that there’s no MIBs related to NAS. If your NAS-MIB is in the default path (/usr/shar/snmp/mibs/YOURMIB), you should add the path to the mibdirs parameter of your snmp.conf file. It could look like:

# As the snmp packages come without MIB files due to license reasons, loading
# of MIBs is disabled by default. If you added the MIBs you can reenable
# loading them by commenting out the following line.
mibs :
mibdirs : /home/monitor/.snmp/mibs:/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf:/usr/share/snmp/mibs/telegraf:/usr/share/snmp/mibs/nmp # Not sure about the mib name

Can you tell me what’s in the /usr/shar/snmp/mibs/telegraf?

Best regards

Hi @codi640
inside /usr/share/snmp/mibs/telegraf
immagine

I downloaded the MIB file locally from my qnap to a windows machine, and then uploaded inside the VM with winscp.

Adding /usr/share/snmp/mibs/telegraf/NAS-MIB in snmp.conf like you suggested:
E! [telegraf] Error running agent: could not initialize input inputs.snmp: initializing table snmp.QNAP.cpuTable: translating: MIB search path: : /home/monitor/.snmp/mibs:/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf:/usr/share/snmp/mibs/telegraf/NAS-MIB:
Cannot find module (NAS-MIB): At line 1 in (none)
NAS-MIB::cpuTable: Unknown Object Identifier: exit status 2

Thanks,
G.

Hey @justgigia

Did you build by yourself the /usr/shar/snmp/mibs/telegraf path?

I mean, when you add a MIB, it should be added in the /usr/share/snmp/mibs path automatically, such as with my example of net-snmp:

root@TIG:~# ls -lA /usr/share/snmp/mibs
total 152
lrwxrwxrwx 1 root root    18 17 juil.  2023 iana -> /var/lib/mibs/iana
lrwxrwxrwx 1 root root    18 17 juil.  2023 ietf -> /var/lib/mibs/ietf
-rw-r--r-- 1 root root  5931  3 janv.  2023 LM-SENSORS-MIB.txt
-rw-r--r-- 1 root root 15901  3 janv.  2023 NET-SNMP-AGENT-MIB.txt
-rw-r--r-- 1 root root  9160  3 janv.  2023 NET-SNMP-EXAMPLES-MIB.txt
-rw-r--r-- 1 root root  9326  3 janv.  2023 NET-SNMP-EXTEND-MIB.txt
-rw-r--r-- 1 root root  2036  3 janv.  2023 NET-SNMP-MIB.txt
-rw-r--r-- 1 root root  3730  3 janv.  2023 NET-SNMP-PASS-MIB.txt
-rw-r--r-- 1 root root  4814  3 janv.  2023 NET-SNMP-TC.txt
-rw-r--r-- 1 root root  5039  3 janv.  2023 NET-SNMP-VACM-MIB.txt
-rw-r--r-- 1 root root  2163  3 janv.  2023 UCD-DEMO-MIB.txt
-rw-r--r-- 1 root root  4965  3 janv.  2023 UCD-DISKIO-MIB.txt
-rw-r--r-- 1 root root  3087  3 janv.  2023 UCD-DLMOD-MIB.txt
-rw-r--r-- 1 root root  8118  3 janv.  2023 UCD-IPFWACC-MIB.txt
-rw-r--r-- 1 root root 53338  3 janv.  2023 UCD-SNMP-MIB.txt

Also, I’ve never work with NAS-MIB, but mine appear as NET-SNMP but I added in the path netsnmp. Can you run an snmptranslate just to check the mib?

snmptranslate -On NAS-MIB::jBODHdTable1

I you got an error such as Unknow Object, you can try with nassnmp:

/home/monitor/.snmp/mibs:/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf:/usr/share/snmp/mibs/nassnmp:/usr/share/mibs/nassnmp:
# I put two path for nassnmp just to check something

If this still doesn’t work, you should try to install the MIB using snmp-mibs-downloader, hoping your VM have Internet access…

Let me know how it goes!


Update:
Okay I apologize I made an error, I’m not using the netsnmp mib but the RFC1213 which relate to the dir ietf (downloaded via snmp-mibs-downloader I guess).
Can you try to put every files concerning the NAS-MIB into your /usr/share/mib/?

Hi @codi640,
there’s only a file => “NAS-MIB” and is inside /usr/share/snmp/mibs

G.

can you try to run:

chown root:root /usr/share/snmp/mibs NAS-MIBS*

systemctl daemon-reload
systemctl restart telegraf

And tell me how it goes?

Same error buddy :smiling_face_with_tear:

G.

Hey @justgigia, sorry for the delay

The error shouldn’t be the same, since it is → there might be an issue with your telegraf conf file, specifically on how you call the different OID. This will be my last guess of help, since the last time I had the issue I just reinstalled the snmp server.
Can you try to use numerical OID instead of alphabetic?
I recommend you to do a backup file of your original .conf, and build a new one with less information!

I also recommend you, since it’s working like this for me, to simply at maximum your inputs.snmp. Mine looks like this:

[[inputs.snmp]]
  agents = ["udp://1.1.1.1:161", "udp://2.2.2.2:161"]
  version = 2
  community = "supervision"

Unless you are using snmpV3, it should work as well for you.

Solved bu myself with these commands:

  • MIBDIRS=/home/monitor/.snmp/mibs:/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf
  • export MIBDIRS
  • MIBS=ALL;export MIBS
    and now it works.