Re: Is it possible to have 2 notifications template
Posted: Fri Nov 29, 2013 3:54 pm
Any suggestion slansing ??slansing wrote:We're looking into this and will get back to you.
Support for Nagios products and services
https://support.nagios.com/forum/
Any suggestion slansing ??slansing wrote:We're looking into this and will get back to you.
Code: Select all
/usr/local/nagios/libexec/messageone_recovery RECOVERY Test_Service Host_Alias Host_Address HARD Current_Time Service_Is_OK "http://response.url" <email>Code: Select all
tail -25 /var/log/maillogabrist wrote:Can you run the notification handler script from the cli? Replace the macros with the proper data, for example:Make sure to replace <email> with your email.Code: Select all
/usr/local/nagios/libexec/messageone_recovery RECOVERY Test_Service Host_Alias Host_Address HARD Current_Time Service_Is_OK "http://response.url" <email>
Test the handler above, and then check the maillog:Code: Select all
tail -25 /var/log/maillog
Code: Select all
root@stg-nagios01:~#
root@stg-nagios01:~# /usr/local/nagios/libexec/messageone_recovery RECOVERY Test_Service Host_Alias Host_Address HARD Current_Time Service_Is_OK "http://response.url" <[email protected]>
-bash: syntax error near unexpected token `newline'
root@stg-nagios01:~#
Code: Select all
/usr/local/nagios/libexec/messageone_recovery RECOVERY Test_Service Host_Alias Host_Address HARD Current_Time Service_Is_OK "http://response.url" [email protected]Code: Select all
root@stg-nagios01:~#
root@stg-nagios01:~#
root@stg-nagios01:~# /usr/local/nagios/libexec/messageone_recovery RECOVERY Test_Service Host_Alias Host_Address HARD Current_Time Service_Is_OK "http://response.url" [email protected]
/usr/local/nagios/libexec/messageone_recovery: 18: [: RECOVERY: unexpected operator
root@stg-nagios01:~#
Code: Select all
#! /bin/sh
NOTIFICATIONTYPE=$1
SERVICEDESC=$2
HOSTALIAS=$3
HOSTADDRESS=$4
SERVICESTATE=$5
LONGDATETIME=$6
SERVICEOUTPUT=$7
SERVICEACTIONURL=$8
CONTACTEMAIL=$9
if [ "${NOTIFICATIONTYPE}" == "RECOVERY" ]; then
/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: ${NOTIFICATIONTYPE}\n\nService: ${SERVICEDESC}\nHost: ${HOSTALIAS}\nAddress: ${HOSTADDRESS}\nState: ${SERVICESTATE}\n\nDate/Time: ${LONGDATETIME}\n\nAdditional Info:\n\n${SERVICEOUTPUT}\n\nURL: ${SERVICEACTIONURL}$\n" | /usr/bin/mail -s "** ${NOTIFICATIONTYPE} Service Alert: ${HOSTALIAS}/${SERVICEDESC} is ${SERVICESTATE} **" ${CONTACTEMAIL};
fiCode: Select all
root@stg-nagios01:/usr/local/nagios/libexec#
root@stg-nagios01:/usr/local/nagios/libexec# /usr/local/nagios/libexec/messageone_recovery RECOVERY Test_Service Host_Alias Host_Address HARD Current_Time Service_Is_OK "http://response.url" [email protected]
/usr/local/nagios/libexec/messageone_recovery: 14: [: RECOVERY: unexpected operator
root@stg-nagios01:/usr/local/nagios/libexec#
Code: Select all
#! /bin/sh
NOTIFICATIONTYPE=$1
SERVICEDESC=$2
HOSTALIAS=$3
HOSTADDRESS=$4
SERVICESTATE=$5
LONGDATETIME=$6
SERVICEOUTPUT=$7
SERVICEACTIONURL=$8
CONTACTEMAIL=$9
if [ "$NOTIFICATIONTYPE" == "RECOVERY" ]
then
/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE\n\nService: $SERVICEDESC\nHost: $HOSTALIAS\nAddress: $HOSTADDRESS\nState: $SERVICESTATE\n\nDate/Time: $LONGDATETIME\n\nAdditional Info:\n\n$SERVICEOUTPUT\n\nURL: $SERVICEACTIONURL$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE Service Alert: $HOSTALIAS/$SERVICEDESC is $SERVICESTATE **" $CONTACTEMAIL;
fiCode: Select all
#!/bin/shCode: Select all
#!/bin/bash