using check_snmp with oid that has multi-line output

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
ajwilliamson
Posts: 14
Joined: Mon Sep 17, 2018 10:38 am

using check_snmp with oid that has multi-line output

Post by ajwilliamson »

Hi,

I'm trying to use check_snmp to monitor a Dell switch.

The oid in particular that i'm trying to read returns output across multiple lines.

Code: Select all

/usr/local/nagios/libexec/check_snmp -H 10.32.1.122  -p 161 -o '.1.3.6.1.2.1.1.1.0' -P 3 --seclevel=authPriv --secname='SOMEUSER' --authproto=SHA --authpasswd='somepassword' --privpasswd='someotherpassword' -x aes
 | P OK - Dell EMC Networking OS10 Enterprise.
.1.3.6.1.2.1.1.1.0:
"Dell EMC Networking OS10 Enterprise.
Copyright (c) 1999-2021 by Dell Inc. All Rights Reserved.
System Description: OS10 Enterprise.
OS Version: 10.5.2.7.
System Type: S3048-ON"
My goal here is to look for the string "10.5.2.7"...so I tried using the -r parameter to do a regex against the output ( -r '10.5.2.7' ), but it fails and my fear is that it is only searching the first line of output.

I tried using more specific and complex regular expressions to no avail (eg '/10\.5\.2\.7/gms' ).

Code: Select all

/usr/local/nagios/libexec/check_snmp -H 10.32.1.122  -p 161 -o '.1.3.6.1.2.1.1.1.0' -P 3 --seclevel=authPriv --secname='SOMEUSER' --authproto=SHA --authpasswd='somepassword' --privpasswd='someotherpassword' -x aes -r '10.5.2.7'
* |  CRITICAL - *Dell EMC Networking OS10 Enterprise.
.1.3.6.1.2.1.1.1.0:
"Dell EMC Networking OS10 Enterprise.
Copyright (c) 1999-2021 by Dell Inc. All Rights Reserved.
System Description: OS10 Enterprise.
OS Version: 10.5.2.7.
System Type: S3048-ON"
Am I missing something?

Any help would be appreciated. Thanks.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: using check_snmp with oid that has multi-line output

Post by ssax »

It doesn't look like check_snmp supports multi-line output, I am able to replicate the issue.

What is the output of this command?

Code: Select all

snmpbulkget -v3 -u yoursnmpv3user -A 'authPass' -a SHA -X 'privPass' -x AES -l authPriv X.X.X.X:161 .1.3.6.1.2.1.1.1.0
ajwilliamson
Posts: 14
Joined: Mon Sep 17, 2018 10:38 am

Re: using check_snmp with oid that has multi-line output

Post by ajwilliamson »

Here is the output of that command:

Code: Select all

 snmpbulkget -v 3 -l AuthPriv -u SOMEUSER -a SHA -A somepassword -x AES -X someotherpassword 10.32.1.112 .1.3.6.1.2.1.1.1.0
SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.674.11000.5000.100.2.1.4
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (23442779) 2 days, 17:07:07.79
SNMPv2-MIB::sysContact.0 = STRING: itsupport@somedomain.com
SNMPv2-MIB::sysName.0 = STRING: USEDC-SWA112
SNMPv2-MIB::sysLocation.0 = STRING: USEDC
SNMPv2-MIB::sysServices.0 = INTEGER: 72
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (26) 0:00:00.26
SNMPv2-MIB::sysORID.1 = OID: SNMPv2-MIB::snmpMIB
SNMPv2-MIB::sysORID.2 = OID: SNMP-VIEW-BASED-ACM-MIB::vacmBasicGroup
SNMPv2-MIB::sysORID.3 = OID: TCP-MIB::tcpMIB
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: using check_snmp with oid that has multi-line output

Post by benjaminsmith »

Hi,

Since this plugin is open-source, would you be able to directly open an issue for regex support for multiline output on the GitHub page?

https://github.com/nagios-plugins/nagios-plugins

Let us know.

Thanks,
Benjamin
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
ajwilliamson
Posts: 14
Joined: Mon Sep 17, 2018 10:38 am

Re: using check_snmp with oid that has multi-line output

Post by ajwilliamson »

I have posted the above on GitHub: https://github.com/nagios-plugins/nagio ... issues/629

Thanks
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: using check_snmp with oid that has multi-line output

Post by benjaminsmith »

Hi,

Appreciate it. I will follow up on this with the team here as well.

Have a great weekend!
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked