Any suggestion slansing ??slansing wrote:We're looking into this and will get back to you.
Is it possible to have 2 notifications template
-
cesar.garza
- Posts: 80
- Joined: Mon Aug 19, 2013 3:14 pm
Re: Is it possible to have 2 notifications template
Re: Is it possible to have 2 notifications template
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.
Test the handler above, and then check the maillog:
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/maillogFormer Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
-
cesar.garza
- Posts: 80
- Joined: Mon Aug 19, 2013 3:14 pm
Re: Is it possible to have 2 notifications template
abrist 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
Hey abrist, i tried the above thing and it didn't work. that's what you ask me to do ??
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:~#
Re: Is it possible to have 2 notifications template
Try: (remove the <>)
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]Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
-
cesar.garza
- Posts: 80
- Joined: Mon Aug 19, 2013 3:14 pm
Re: Is it possible to have 2 notifications template
I got this ...
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:~#
Re: Is it possible to have 2 notifications template
Ok, I missed a syntax error in your script. The condition/antecedent must be on the same line as the 'if' statement:
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};
fiFormer Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
-
cesar.garza
- Posts: 80
- Joined: Mon Aug 19, 2013 3:14 pm
Re: Is it possible to have 2 notifications template
I am still getting the same error . The only thing that changed is number from (18) to (14).
Code: 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#
Re: Is it possible to have 2 notifications template
hmmm. How about:
I tested it and it works . . .
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;
fiFormer Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
-
cesar.garza
- Posts: 80
- Joined: Mon Aug 19, 2013 3:14 pm
Re: Is it possible to have 2 notifications template
Still getting error. is there any dependencies for that ? I have attached a screenshot so you can see if i am doing anything wrong.
Re: Is it possible to have 2 notifications template
What is your default shell (/bin/sh)?
Try changing the sha-bang from:
To:
Try changing the sha-bang from:
Code: Select all
#!/bin/shCode: Select all
#!/bin/bash Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.