Update error codes and delete source file if its successfuly restored
parent
dd93f9740d
commit
c5d35bacde
@ -1,2 +1,10 @@
|
|||||||
# Princeton
|
# Princeton
|
||||||
|
|
||||||
|
## Files that need to be copied to /usr/local/nagios/libexec:
|
||||||
|
* pu-notify-all-emails
|
||||||
|
|
||||||
|
## Files that need contents imported into XI:
|
||||||
|
* new_commands.cfg
|
||||||
|
|
||||||
|
|
||||||
|
## Also See failover/README.md
|
||||||
|
|||||||
@ -0,0 +1,19 @@
|
|||||||
|
define command {
|
||||||
|
command_name notify-host-by-email-address-1
|
||||||
|
command_line /usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTADDRESS1$
|
||||||
|
}
|
||||||
|
|
||||||
|
define command {
|
||||||
|
command_name notify-service-by-email-address-1
|
||||||
|
command_line /usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTADDRESS1$
|
||||||
|
}
|
||||||
|
|
||||||
|
define command {
|
||||||
|
command_name pu-notify-service-by-email-all
|
||||||
|
command_line /usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | $USER1$/pu-notify-all-emails -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" -t $CONTACTEMAIL$:$_HOSTALT_CONTACT$,$CONTACTADDRESS1$
|
||||||
|
}
|
||||||
|
|
||||||
|
define command {
|
||||||
|
command_name pu-notify-host-by-email-all
|
||||||
|
command_line /usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$:$_HOSTALT_CONTACT$,$CONTACTADDRESS1$
|
||||||
|
}
|
||||||
@ -0,0 +1,44 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# Command to send to multiple email addreses simultaneously, separated by commas.
|
||||||
|
# However, if any email address has a colon in it, then the second email address overrides the first
|
||||||
|
#
|
||||||
|
# Ex:
|
||||||
|
# user1@example.com,user2@example.com:user3@example.com,user4@example.com
|
||||||
|
#
|
||||||
|
# This will send to user1, user3 (overriding user2), and user4.
|
||||||
|
#
|
||||||
|
# Command line definition from Nagios:
|
||||||
|
# /usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | \
|
||||||
|
# $USER1$/pu-notify-all-emails -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" \
|
||||||
|
# -t $CONTACTEMAIL$:$_HOSTALT_CONTACT$,$CONTACTADDRESS1$
|
||||||
|
|
||||||
|
PATH=/usr/bin:/bin
|
||||||
|
|
||||||
|
subject=""
|
||||||
|
sendto=""
|
||||||
|
|
||||||
|
# Get params for subject and receiver
|
||||||
|
while [ -n "$1" ]; do
|
||||||
|
case "$1" in
|
||||||
|
-s) subject="$2"; shift 2;;
|
||||||
|
-t) sendto="$2"; shift 2;;
|
||||||
|
*) shift 1;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# If we have a blank subject or a blank receiver, then exit
|
||||||
|
[ -z "$subject" -o -z "$sendto" ] && exit
|
||||||
|
|
||||||
|
output=""
|
||||||
|
output=`cat`
|
||||||
|
|
||||||
|
OLD_FS=$IFS
|
||||||
|
IFS=,
|
||||||
|
for receiver in $sendto; do
|
||||||
|
[ -z "$receiver" ] && continue
|
||||||
|
override=`echo $receiver | cut -d ":" -f 2`
|
||||||
|
[ -n "$override" ] && receiver=$override
|
||||||
|
echo "$output" | /bin/mail -s "$subject" $receiver
|
||||||
|
done
|
||||||
|
IFS=$OLD_FS
|
||||||
Loading…
Reference in New Issue