Refactoring: Moved check parameters from unsorted.py to dedicated modules (CMK-1393)
[check_mk.git] / notifications / mkeventd
bloba28a0b9bf5d45484b3f2030f15dc2b83abaa3aec
1 #!/bin/bash
2 # Forward Notification to Event Console
3 # This notification plugin sends a notification to the
4 # Check_MK Event Console. It takes two parameters:
5 # 1. Syslog facility to use. This must be a number
6 # from 0 to 23. 16 means 'local0', 17 means 'local1',
7 # ... and 23 means 'local7'. If you leave this empty
8 # the local0 is being used.
9 # 2. IP-Address of the remote Event Console. If you
10 # do not leave this empty then the notifications are
11 # being sent via syslog/UDP (port 514) to that address.
13 # Default values
14 FACILITY=16
15 REMOTE=""
17 # Old-style parameters
18 if [ "$NOTIFY_PARAMETER_1" ] ; then FACILITY="${NOTIFY_PARAMETER_1}" ; fi
19 if [ "$NOTIFY_PARAMETER_2" ] ; then REMOTE="${NOTIFY_PARAMETER_2}" ; fi
21 # New-style parameters
22 if [ -n "$NOTIFY_PARAMETER_FACILITY" ] ; then FACILITY="${NOTIFY_PARAMETER_FACILITY}" ; fi
23 if [ -n "$NOTIFY_PARAMETER_REMOTE" ] ; then REMOTE="${NOTIFY_PARAMETER_REMOTE}" ; fi
26 if [ "$NOTIFY_WHAT" = HOST ]
27 then
28 mkevent -n "$FACILITY" "$REMOTE" $NOTIFY_HOSTSTATEID "$NOTIFY_HOSTNAME" "" "$NOTIFY_HOSTOUTPUT" "$NOTIFY_HOST_SL" "$NOTIFY_HOST_EC_CONTACT"
29 else
30 mkevent -n "$FACILITY" "$REMOTE" $NOTIFY_SERVICESTATEID "$NOTIFY_HOSTNAME" "$NOTIFY_SERVICEDESC" "$NOTIFY_SERVICEOUTPUT" "$NOTIFY_SERVICE_SL" "$NOTIFY_SERVICE_EC_CONTACT" "$NOTIFY_HOST_SL" "$NOTIFY_HOST_EC_CONTACT"