| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
# SUBMIT_CHECK_RESULT_VIA_NSCA |
| 4 |
# Written by Ethan Galstad ([email protected]) |
| 5 |
# Last Modified: 10-15-2008 |
| 6 |
# |
| 7 |
# This script will send passive check results to the |
| 8 |
# nsca daemon that runs on the central Nagios server. |
| 9 |
# If you simply want to submit passive checks from the |
| 10 |
# same machine that Nagios is running on, look at the |
| 11 |
# submit_check_result script. |
| 12 |
# |
| 13 |
# Arguments: |
| 14 |
# $1 = host_name (Short name of host that the service is |
| 15 |
# associated with) |
| 16 |
# $2 = svc_description (Description of the service) |
| 17 |
# $3 = return_code (An integer that determines the state |
| 18 |
# of the service check, 0=OK, 1=WARNING, 2=CRITICAL, |
| 19 |
# 3=UNKNOWN). |
| 20 |
# $4 = plugin_output (A text string that should be used |
| 21 |
# as the plugin output for the service check)s |
| 22 |
# |
| 23 |
# |
| 24 |
# Note: |
| 25 |
# Modify the NagiosHost parameter to match the name or |
| 26 |
# IP address of the central server that has the nsca |
| 27 |
# daemon running. |
| 28 |
|
| 29 |
printfcmd="/usr/bin/printf" |
| 30 |
|
| 31 |
NscaBin="/usr/local/nagios/libexec/send_nsca" |
| 32 |
NscaCfg="/usr/local/nagios/etc/send_nsca.cfg" |
| 33 |
NagiosHost="nagioshost" |
| 34 |
|
| 35 |
# Fire the data off to the NSCA daemon using the send_nsca script |
| 36 |
$printfcmd "%s\t%s\t%s\t%s\n" "$1" "$2" "$3" "$4" | $NscaBin -H $NagiosHost -c $NscaCfg |
| 37 |
|
| 38 |
# EOF |
| 39 |
|