--- opt/victorops/nagios_plugin/bin/send_email_alert.orig 2016-01-16 21:20:46 UTC +++ opt/victorops/nagios_plugin/bin/send_email_alert @@ -34,6 +34,7 @@ fi # Build the contact email list ORG_SLUG="$(getVal _CONTACTVO_ORGANIZATION_ID unkonwn_org)" CONTACTEMAIL="$(getVal _CONTACTVO_CONTACTEMAIL)" +CONTACTPAGER="$(getVal CONTACTPAGER)" VO_CONTACT="failsafe+$ORG_SLUG@victorops.net" WGET_LOG=$LOG_DIR/victorops_forward_wget.out STDERR_LOG=$LOG_DIR/victorops_forward_wget.err @@ -45,10 +46,16 @@ if (( $IS_SERVICE )); then if [ "$CONTACTEMAIL" != "" ]; then printf "%b" "***** Alert *****\n\nNotification Type: $(getVal NOTIFICATIONTYPE)\n\nService: $(getVal SERVICEDESC)\nHost: $(getVal HOSTALIAS)\nAddress: $(getVal HOSTADDRESS)\nState: $(getVal SERVICESTATE)\n\nDate/Time: $(getVal LONGDATETIME)\n\nAdditional Info:\n\n$(getVal SERVICEOUTPUT)\n\n" | mail -s "** $(getVal NOTIFICATIONTYPE) Service Alert: $(getVal HOSTALIAS)/$(getVal SERVICEDESC) is $(getVal SERVICESTATE) **" $CONTACTEMAIL fi + if [ "$CONTACTPAGER" != "" ]; then + printf "%b" "$(getVal SERVICEDESC) $(getVal NOTIFICATIONTYPE) for $(getVal HOSTNAME) is $(getVal SERVICESTATE) at $(getVal TIME) $(getVal SERVICEOUTPUT)" | qpage -f icinga $CONTACTPAGER + fi else if [ "$CONTACTEMAIL" != "" ]; then printf "%b" "***** Alert *****\n\nNotification Type: $(getVal NOTIFICATIONTYPE)\nHost: $(getVal HOSTNAME)\nState: $(getVal HOSTSTATE)\nAddress: $(getVal HOSTADDRESS)\nInfo: $(getVal HOSTOUTPUT)\n\nDate/Time: $(getVal LONGDATETIME)\n" | mail -s "** $(getVal NOTIFICATIONTYPE) Host Alert: $(getVal HOSTNAME) is $(getVal HOSTSTATE) **" $CONTACTEMAIL fi + if [ "$CONTACTPAGER" != "" ]; then + printf "%b" "$(getVal HOSTNAME) is $(getVal HOSTSTATE) at $(getVal TIME) -- $(getVal HOSTOUTPUT)" | qpage -f icinga $CONTACTPAGER + fi fi # *** # *** Make sure the mail command is the last thing in this file so the including file can check the exit code