Debian Codegraph @

contrib/eventhandlers/distributed-monitoring/obsessive_svc_handler

raw
1 #!/bin/sh
2
3 # OBSESSIVE_SVC_HANDLER
4 # Written by Ethan Galstad ([email protected])
5 # Last Modified: 07-19-2001
6 #
7 # This script is intended to run as the OCSP command
8 # on a distributed monitoring server. The script calls
9 # submit_check_result_via_nsca to send the service check
10 # results to the central monitoring server.
11 #
12 # Arguments:
13 # $1 = host_name (Short name of host that the service is
14 # associated with)
15 # $2 = svc_description (Description of the service)
16 # $3 = state_string (A string representing the status of
17 # the given service - "OK", "WARNING", "CRITICAL"
18 # or "UNKNOWN")
19 # $4 = plugin_output (A text string that should be used
20 # as the plugin output for the service checks)
21 #
22
23 # Location of the submit_check_result_via_nsca script
24 SubmitCmd="/usr/local/nagios/libexec/eventhandlers/submit_check_result_via_nsca"
25
26 # Convert the state string to the corresponding return code
27 return_code=-1
28
29 case "$3" in
30 OK)
31 return_code=0
32 ;;
33 WARNING)
34 return_code=1
35 ;;
36 CRITICAL)
37 return_code=2
38 ;;
39 UNKNOWN)
40 return_code=3
41 ;;
42 esac
43
44 # Send the service check results to the central monitoring server
45 $SubmitCmd "$1" "$2" $return_code "$4"
46