nsclient changing service down state

Thomas Guyot-Sionnest dermoth at aei.ca
Wed Nov 11 11:58:54 CET 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10/11/09 05:53 PM, Terry wrote:
> On Tue, Nov 10, 2009 at 4:04 PM, Marc Powell <marc at ena.com> wrote:
>> On Nov 10, 2009, at 3:44 PM, Terry wrote:
>>
>>> Hello,
>>>
>>> I have a simple check set up to check a windows service using
>>> nsclient++.  It works great.  However, I want it to go to a warning
>>> state when a service is stopped, not critical:
>>> -sh-3.2$ /usr/lib64/nagios/plugins/check_nrpe -H host -t 50 -c
>>> checkServiceState -a ShowAll MSSQLSERVER=started
>>> CRITICAL: MSSQLSERVER: stopped (critical)
>>> -sh-3.2$ echo $?
>>> 2
>>>
>>> Again, I don't want it to ALWAYS be warning, just not be critical.
>> If you always want CRITICAL to be changed to WARNING for this test,
>> you could use the negate plugin.
>>
>>  ./negate --help
>> negate v1859 (nagios-plugins 1.4.11)
>> Copyright (c) 2002-2007 Nagios Plugin Development Team
>>        <nagiosplug-devel at lists.sourceforge.net>
>>
>> Negates the status of a plugin (returns OK for CRITICAL and vice-versa).
>> Additional switches can be used to control which state becomes what.
>>
>>
>> Usage:negate [-t timeout] [-owcu STATE] <definition of wrapped plugin>
>>         [snippage]
>>  -c,--critical=STATUS
>>
>>     STATUS can be 'OK', 'WARNING', 'CRITICAL' or 'UNKNOWN' without
>> single
>>     quotes. Numeric values are accepted. If nothing is specified,
>> permutes
>>     OK and CRITICAL.
>>
>> --
>> Marc
> 
> 
> [root at omajelut01 plugins]# /usr/lib64/nagios/plugins/negate -c WARNING
> /usr/lib64//nagios/plugins/check_nrpe -H host -t 50 -c
> checkServiceState -a ShowAll MSSQLSERVER=started
> CRITICAL: MSSQLSERVER: stopped (critical)
> [root at omajelut01 plugins]# echo $?
> 1
> 
> The plugin still says CRITICAL but as you can see will actually
> register as a warning.  Perfect.  Thanks!

Since 1.4.12 you can use -s (--substitute) to change the status text as
well.

- --
Thomas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFK+pjt6dZ+Kt5BchYRAnedAJ0ZD4CEGW8XEFZyOTbBWGOSo+t2FQCgtikk
N1lQ+idzhEA1ebCUAlnICuk=
=Q9t1
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list