[Nagios-devel] check_procs wrapper to invert logic of checks

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

[Nagios-devel] check_procs wrapper to invert logic of checks

Post by Guest »

This is a multi-part message in MIME format.

------_=_NextPart_001_01C26897.C1C72C22
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Greetings to all,

I've written this simple bash script for the check_procs plug-in to
invert the logic of the result.

This is an excerpt from the script source...

# Why I need this wrapper?
# ------------------------
#
# This wrapper is useful to check for a missing process (like a Java
application or anything else)
# that must be running all the time. In this case you have to get a
CRITICAL status from the plug-in when the application
# is not running. This is the typical scenario.

# I preferred to make a wrapper to add the 'NOT' functionality to the
check_procs plug-in instead of modifying the source code.
# I've plenty of installations of plug-ins and I'm too lazy to recompile
them all. If the 'NOT' feature will be included in a
# future release of check_procs plug-in, this wrapper will be useless.=20
# ... but for now... enjoy it!

# To use this script you need the check_procs plug-in that is part of
nagios/netsaint plug-ins
# available from http://www.nagios.org/download/#plugins

# example 1 (with original check_procs plug-in):
# ----------------------------------------------
#
# $ check_procs -c 0-0 -u root -a "someargument"=20
#=20
# This example gives a CRITICAL status when you have one or more
processes with "someargument" and OK
# status when there are no processes with "someargument"


# example 2 (with the plug-in wrapper):
# ----------------------------------------------
#
# $ check_procs_not "-c 0-0 -u root -a "someargument""
#
# gives an OK status when you have one or more processes with
"someargument" and CRITICAL status when
# there are no processes with "someargument"=20

Hope to be of help...=20

------------------------------------------------
xmedia
New Media Agency
------------------------------------------------
Stefano Coletta mailto:coletta@xmedia.net
Network Admin www.xmedia.net
Personal Site www.mindcreations.com
via Francesco Benaglia, 13 - Tel. +39 06 588851
00153 Rome Italy fax +39 06 58885016
------------------------------------------------

------_=_NextPart_001_01C26897.C1C72C22
Content-Type: application/octet-stream;
name="check_procs_not"
Content-Transfer-Encoding: base64
Content-Description: check_procs_not
Content-Disposition: attachment;
filename="check_procs_not"

IyEvY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AkIGNoZWNrX3Byb2NzX25v
dCAiLWMgMC0wIC11IHJvb3QgLWEgInNvbWVhcmd1bWVudCIiCiMKIyBnaXZlcyBhbiBPSyBzdGF0
dXMgd2hlbiB5b3UgaGF2ZSBvbmUgb3IgbW9yZSBwcm9jZXNzZXMgd2l0aCAic29tZWFyZ3VtZW50
IiBhbmQgQ1JJVElDQUwgc3RhdHVzIHdoZW4KIyB0aGVyZSBhcmUgbm8gcHJvY2Vzc2VzIHdpdGgg
InNvbWVhcmd1bWVudCIgCgojIFdoeSBJIG5lZWQgdGhpcyB3cmFwcGVyPwojIC0tLS0tLS0tLS0t
LS0tLS0tLS0tLS0tLQojCiMgVGhpcyB3cmFwcGVyIGlzIHVzZWZ1bCB0byBjaGVjayBmb3IgYSBt
aXNzaW5nIHByb2Nlc3MgKGxpa2UgYSBKYXZhIGFwcGxpY2F0aW9uIG9yIGFueXRoaW5nIGVsc2Up
CiMgdGhhdCBtdXN0IGJlIHJ1bm5pbmcgYWxsIHRoZSB0aW1lLiBJbiB0aGlzIGNhc2UgeW91IGhh
dmUgdG8gZ2V0IGEgQ1JJVElDQUwgc3RhdHVzIGZyb20gdGhlIHBsdWct

...[email truncated]...


This post was automatically imported from historical nagios-devel mailing list archives
Original poster: coletta@xmedia.net
Locked