SNMP Plugin Output Not Written in InfluxDB When Output is Double Quoted

Hello Team,

I need a bit of help here, I am almost positive this issue has come up already, but I cannot find any information about it.

Basically, I have two checks. One comes back with an output like this:
SNMP OK - 2

The second output comes back like this:
SNMP OK - “747564”

The second is a string and it needs to be stored in influxdb as numeral, i checked the documentation, but I am almost clueless here. Could anybody please help me.

Regards,

Hi Team,

I was able to do a wrapper script to remove the quotes and get only the numerical values, but whats left is still not being written to influxdb. Any further help will be appreciated.

Regards,

Hi,

how does the plugin output look like when you execute it over the command line?

Greetz

Performance data needs to be in format as described here.

Hi,

This is what comes back:

/usr/lib/nagios/plugins/./check_snmp -L authPriv -U pdSNMP -a SHA -A “1234” -x AES -X “1234” -P 3 -H 10.100.145.7 -o 1.3.6.1.4.1.1916.1.32.2.2.1.3.1

SNMP OK - “746488” |

This second output has the wrapper, basically it does what is after the “|”, in the original cli command, it executes the wrapper then calls check_snmp, something like this:

/usr/lib/nagios/plugins/./check_snmp -L authPriv -U pdSNMP -a SHA -A “xa4vah4eij2Aikaey0ai” -x AES -X “chai9aesheiPeipago0e” -P 3 -H 10.100.145.7 -o 1.3.6.1.4.1.1916.1.32.2.2.1.3.1 | sed ‘s/"//g’

SNMP OK - 746488 |

the script looks like this:

#!/bin/bash

address="$1"
oid="$2"
seclevel="$3"
user="$4"
authproto="$5"
authpasswd="$6"
privproto="$7"
privpasswd="$8"
snmpversion="$9"
eval "/usr/lib/nagios/plugins/check_snmp  -H '$address' -o '$oid' -L '$seclevel' -U '$user' -a '$authproto' -A '$authpasswd' -x '$privproto' -X '$privpasswd' -P '$snmpversion' | sed 's/\"//g'"

I hope this makes sense.

Gruss,

Please run an snmpget for these two OIDs and show the results. Please note that there is no performance data for type “STRING” so you might have to “create” your own.

Hi,

here is the output:

snmpget -v 2c -c 1234 10.100.145.7 1.3.6.1.4.1.1916.1.32.2.2.1.3.1

iso.3.6.1.4.1.1916.1.32.2.2.1.3.1 = STRING: “744940”

PS1: snmpv3 comes back with the same result.
PS2: I have another icinga2 in other location and the data is being stored even without the wrapper.

Regards,

Please take a look at the performance data of the other check and show the snmpget result of the other location.

Hi,

I dont really know about the performance data, but both Icinga2s are configured the same way, even che checks are the same; I also checked the snmpget and I got the following results:

snmpget -v 2c -c 1234 172.23.1.70 1.3.6.1.4.1.1916.1.32.2.2.1.3.1

iso.3.6.1.4.1.1916.1.32.2.2.1.3.1 = STRING: “715616”

Influx is a separate component. It relies on the data delivered by the monitoring process. Please check your Influx configuration which information is used to populate the Influx-DB.

In the config file, influxdb.conf everything is commented out (#) that means i should be using the default config [InfluxDB shell version: 1.7.8]. I still think the issue is not influx, the other icinga2 generates the data properly, if I see the plugin output in the webclient, i see that everything is being written without the quote marks. The snmpget/walk returns with and without quotes, depending on the OID, but I see it in the webclient without quotes.

I still think that the data is sent to the database improperly, but i have no way to proof this, because I am using the exact same configuration in all VMs.

This is what I mean, first screenshot has what i need:

123

The second one, has the exact same config, but it is displayed/written differently:

456

In the second screenshot you can see the quotes " "

Having different output on different machines it hard to believe that the VM image is identical. It seems that at least the version of the plugins is different.

i thought about that, I copied the whole plugin folder, I even downgraded the net-snmp version to match the one working. By identical, I mean that after a clean installation I use the same conf.d/ configuration. I also downgraded the influxdb version. I have tried installing other debian versions, I have also downgraded the grafana version, but of course that is not the problem, I just wanted to rule out those components. I have not been able to install other icinga2 or icinga2web versions. I always go to the current.

./check_snmp -V shows the version of the plugin. If the VM architecture is similar you should be able to copy the plugin from one machine to another.

Since I copied the same plugin, I have the same version:

Good working Icinga2

root@s-pd-monitoring:/usr/lib/nagios/plugins# ./check_snmp -V
check_snmp v2.1.1 (monitoring-plugins 2.1.1)

Clean installed Icinga2, not working as desired:

root@s-pd-Icinga2-test-mas:/usr/lib/nagios/plugins# ./check_snmp -V
check_snmp v2.1.1 (monitoring-plugins 2.1.1)

root@s-pd-Icinga2-test-mas:/usr/lib/nagios/plugins# ./check_ping -V
check_ping v2.2 (monitoring-plugins 2.2)

As you can see the other plugins have an older version

Please execute “/usr/lib/nagios/plugins/check_snmp -L authPriv -U pdSNMP -a SHA -A “...” -x AES -X “...” -P 3 -H 10.100.145.7 -o 1.3.6.1.4.1.1916.1.32.2.2.1.3.1” like shown in your first posting on both machines and show the complete output.

This is what I get back:

Good Icinga2:

root@s-pd-monitoring:/# snmpget -v3 -l authPriv -u pdSNMP -a sha -A “1234” -x aes -X “1234” 10.100.145.7 1.3.6.1.4.1.1916.1.32.2.2.1.3.1
SNMPv2-SMI::enterprises.1916.1.32.2.2.1.3.1 = STRING: "746636"

Not Good Icinga2:

root@s-pd-Icinga2-test-mas:/# snmpwalk -v3 -l authPriv -u pdSNMP -a sha -A “1234” -x aes -X “1234” 10.100.145.7 1.3.6.1.4.1.1916.1.32.2.2.1.3.1
SNMPv2-SMI::enterprises.1916.1.32.2.2.1.3.1 = STRING: "746388"

The output is obviously the same. As no performance data is present Influx parses the output instead. You mentioned that the Icinga config files were copied so that leaves the Influx configuration as being different.
As I don’t use Influx I have no clue what to check in that direction.

Hi,

I understand this is a very tricky issue, but could i please get some further help.