Others

Unix Status Code Customizer (negate.sh)

Description:

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).

Current Version

Last Release Date

2014-02-17

Compatible With

  • Nagios 3.x
  • Nagios 4.x
  • Nagios XI

Owner


Project Notes
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
Reviews (0) Add a Review
Add a Review

You must be logged in to submit a review.

Thank you for your review!

Your review has been submitted and is pending approval.

Recommend

To:


From:


Thank you for your recommendation!

Your recommendation has been sent.

Project Stats
Rating
0 (0)
Favorites
0
Views
23,207