Page 1 of 1

snmp check tests fine but fails during normal processing

Posted: Fri Nov 09, 2012 1:06 pm
by cdavis
Hello,

I am testing NagiosXI for a possible deployment and am having problems with an snmp check of a windows service.

I have configured a service check with the command check_xi_service_snmp_win_service with $ARG1$ of " -C mystring --v2c -n 'RedPrairie (HHWMS2)'" If I push the "Test Check Command" button and type in the same host that I have the service defined under it shows:

COMMAND: /usr/local/nagios/libexec/check_snmp_win.pl -H wms-prod2 -C mystring --v2c -n 'RedPrairie \(HHWMS2\)'
OUTPUT: 1 services active (matching "RedPrairie \(HHWMS2\)") : OK

I have also typed that command via cli and it works fine. The problem is the actual service under Service Details shows "No services matching "RedPrairie (HHWMS2)" found : CRITICAL"

I suspect that the parenthesis have something to do with this because if I escape the parenthesis it works on the cli, if I do not escape them it fails.

Code: Select all

[root@localhost var]# /usr/local/nagios/libexec/check_snmp_win.pl -H wms-prod2  -C mystring --v2c -n "RedPrairie \(HHWMS2\)"
1 services active (matching "RedPrairie \(HHWMS2\)") : OK
[root@localhost var]# /usr/local/nagios/libexec/check_snmp_win.pl -H wms-prod2  -C mystring --v2c -n "RedPrairie (HHWMS2)"                                                                                                         
No services matching "RedPrairie (HHWMS2)" found : CRITICAL
Thanks for any suggestions,
Carl

Re: snmp check tests fine but fails during normal processing

Posted: Fri Nov 09, 2012 3:41 pm
by scottwilkerson
In some cases the "Test command" feature will not work properly from the web interface because of having to escape items (like parentheses) but will work just fine once the item is actually added.

Re: snmp check tests fine but fails during normal processing

Posted: Mon Nov 12, 2012 7:48 am
by cdavis
Actually it is working just the opposite. The Test feature is escaping the parenthesis just fine and therefore the test shows service is OK. But the normal process of checking results in the belief that the service is down and a alert being sent.

Re: snmp check tests fine but fails during normal processing

Posted: Mon Nov 12, 2012 11:55 am
by scottwilkerson
The () may need to be escaped either way (you may have to add that in) as when executing from the shell, if not escaped it will try to open a subshell