check_snmp not passing community to snmpget

Anthony Wood anthony.wood at sol1.com.au
Mon Sep 13 09:23:59 CEST 2021


Ignore me from last week.

snmpget modifies it's commandline in proc to replace the community string with spaces...

The real problem was that snmpget was verbosely whinging about crappy MIBs that it filled up the stderr buffer.
Meanwhile check_snmp is waiting to read from snmpget's stdout before it reads from stderr.

https://github.com/monitoring-plugins/monitoring-plugins/issues/1706 reported with quick fix of reading stderr before stdin 
  
cheers, 
Woody 
    

-----Original Message-----

From: Anthony <anthony.wood at sol1.com.au>
To: help <help at monitoring-plugins.org>
Date: Monday, 13 September 2021 5:13 PM AEST
Subject: check_snmp not passing community to snmpget

   
Affected Versions monitoring-plugins 2.1.2,2.2,2.3
Affected OSes: Ubuntu 18.04.5 LTS, Debian 10 

Basically the check_snmp plugin is losing the community string on the way through and replacing it with the same number of spaces. 
  
 
root at subview:/etc/icinga2# /usr/bin/snmpget -Le -t 10 -r 5 -m '' -v 1 [context] [authpriv] 10.23.132.51:161 .1.3.6.1.4.1.4515.1.3.1.7.0 
pstree -paul 5552 
check_snmp,5552 -H 10.23.132.51 -C admin -o .1.3.6.1.4.1.4515.1.3.1.7.0 -v 
  └─snmpget,5553 -Le -t 10 -r 5 -m  -v 1 -c       10.23.132.51:161 .1.3.6.1.4.1.4515.1.3.1.7.0 

This is obvious when you use a long community string.

 
root at prod-icinga:~# /usr/lib/nagios/plugins/check_snmp  -H 10.23.132.51 -C obviously_long_community_string -o .1.3.6.1.4.1.4515.1.3.1.7.0 -v & 
[1] 432 
root at prod-icinga:~# /usr/bin/snmpget -Le -t 10 -r 5 -m '' -v 1 [context] [authpriv] 10.23.132.51:161 .1.3.6.1.4.1.4515.1.3.1.7.0 
pstree -paul 432 
check_snmp,432 -H 10.23.132.51 -C obviously_long_community_string -o .1.3.6.1.4.1.4515.1.3.1.7.0 -v 
  └─snmpget,433 -Le -t 10 -r 5 -m  -v 1 -c                                 10.23.132.51:161 .1.3.6.1.4.1.4515.1.3.1.7.0 
root at prod-icinga:~#  
  Expected behaviour would be an snmpget command line including the community string, which would return the expected result. 
  
Current behaviour is that: 
- snmpget outputs the help message on stderr (after complaining about MIBs)
- check_snmp times out after about a minute

Is anyone using check_snmp successfully ? which versions?

cheers, 
Woody    

  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-plugins.org/archive/help/attachments/20210913/58c7d860/attachment.html>


More information about the Help mailing list