Home Directory Plugins Others Unix Status Code Customizer (negate.sh)

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Unix Status Code Customizer (negate.sh)

Rating
0 votes
Favoured:
0
Last Release Date
2014-02-17
Compatible With
  • Nagios 3.x
  • Nagios 4.x
  • Nagios XI
Hits
19205
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
Checks the status, or exit, code of another program and returns a
Nagios status code based on the result. This is basically the official negate
plug-in but rewritten in bash so it will run in heterogenous unix environments.

Useful in cases where a program returns an odd status code such as > 3.
If say, your program returns 127 and that means OK, we tell that to check_status_code.sh which will then return the proper Nagios exit code e.g. 1 (OK).
Checks the status, or exit, code of another program and returns a
Nagios status code based on the result.

Options:
-r Absolute path of program to run, use quotes for options
-o Status to expect for OK state (def: 0)
-w Status to expect for WARNING state (def: 1)
-c Status to expect for CRITICAL state (def: 2)
-u Status to expect for UNKNOWN state (def: 3)

Usage: $0 -r "/usr/sbin/service sshd status"


# Author: Jon Schipp

########
# Examples:

# 1.) Check status code for uptime using the defaults
# $ ./negate.sh -r /usr/bin/uptime
#
# 2.) Custom service does it backwards and exits 1 when running and 0 when stopped. The proper status code gets returned to Nagios.
# $ ./negate.sh -r "/usr/sbin/service custom-server status" -o 1 -c 0