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

Directory Tree

NSCA Wrapper

Rating
4 votes
Favoured:
1
Hits
105600
Files:
FileDescription
nsca_wrapperversion 0.6
Nagios CSP

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!
Submits any check as a passive check result. Allows you to create passive checks by just running normal plugins with this script in front of them
This is a unix shell script to allow you to run any check on a unix based system and submit it as a passive check. It is generic enough that you should never need to write a wrapper to create a passive check again. Just take a plugin, and run it through this script. If you have NSCA working, then that should be all that is required.

It is run using /bin/sh. This currently supports bourne shell, Bash, and ksh. Csh/Tcsh are not supported. Support for more shells may be added if there is demand.
Basic Usage:

./nsca_wrapper -H "Host" -S "Service" -C "./check_whatever -arg1 -arg2 -argN"

Host - the Host name of the Server as it appears in Nagios config
Service - the Service name as it appears in Nagios config
"./check_whatever -arg1 -arg" - the plugin to run with all of it's arguments, all of which must be enclosed in quotes.
Optional Switches

-N NSCA_SERVER_IP -c /path/to/send_nsca.cfg -b /path/to/send_nsca -e -q

-N is necessary to point it to your NSCA/Nagios server
-c is necessary to point it to your send_nsca.cfg.
-b is optional to specify the full path to the send_nsca binary if it is not in the PATH of the user running nsca_wrapper.
-e is optional to return with the exit code of the check_plugin result rather than the result of the sending operation to NSCA.
-q is optional - quiet mode. No plugin or nsca sending output

You can forgo using the optional parameters if you simply edit the 3 variables at the top of the script, seeing as in nearly all cases the Nagios server will remain the same, the path to the send_nsca binary and the send_nsca.cfg will also not usually change. If the optional command line parameters are used then they will take precedence.

NOTE: The "./check_whatever -arg1 -arg2 -argN" is run using the shell which means that you must make sure you don't do anything stupid like putting dangerous shell commands there. This really applies to everything in Nagios but I thought it was worth a mention anyway.

Last and not least: Of course you need a working NSCA Server in the first place which is easy to set up, as well as a send_nsca.cfg to use to connect to the NSCA Server to submit the check result.
Support

For bugs, feature requests or suggestions (including how I can make this documentation more clear) you can contact me at hpsekhon (AT) googlemail.com.
Reviews (1)
This wrapper script is useful if you want to run plugins on remote Unix servers from cron and return the results to Nagios using nsca.

Note that on some Unix/Linux operating-systems, the format of the test (or [ ]) command differs, so you may need to replace "==" with "=" to get this script working on your chosen OS.