Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Unix Status Code Customizer (negate.sh)
2014-02-17
- Nagios 3.x
- Nagios 4.x
- Nagios XI
23183
Meet The New Nagios Core Services Platform
Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.
Monitoring Made Magically Better
- Nagios Core on Overdrive
- Powerful Monitoring Dashboards
- Time-Saving Configuration Wizards
- Open Source Powered Monitoring On Steroids
- And So Much More!
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
Nagios status code based on the result.
Options:
-r
-o
-w
-c
-u
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)
Be the first to review this listing!