Page 3 of 3
Re: Alert info being truncated by Hipchat notfications.
Posted: Tue Aug 25, 2015 9:37 am
by mlbsysops
It is not showing up, related; The email template is applied as default to all users and the contacts have notify-service-by-email and xi_service_notification_handle as their notification commands.
Re: Alert info being truncated by Hipchat notfications.
Posted: Tue Aug 25, 2015 9:38 am
by mlbsysops
tmcdonald wrote:Something isn't adding up. Your template shows ***** Nagios XI Alert ***** but the email you receive shows ***** Nagios Monitor XI Alert ***** which is defined by the notify-host-by-email command. You likely need to make your contact use the xi_host_notification_handler and xi_service_notification_handler commands in the CCM, and the changes will take effect.
The contacts already have this applied.
Re: Alert info being truncated by Hipchat notfications.
Posted: Tue Aug 25, 2015 12:36 pm
by ssax
ssax wrote:Let's try this to make sure that the template is actually being applied:
Try this template, have it generate an email, see if the text
Long: is even shown in the email.
Code: Select all
***** Nagios XI Alert *****
%alertsummary%
Notification Type: %type%
Service: %service%
Host: %host%
Address: %hostaddress%
State: %servicestate%
Info: %serviceoutput%
Long: %longserviceoutput%
Date/Time: %datetime%
Respond: %responseurl%
Nagios URL: %xiserverurl%
I'm not sure if you missed my message, did you try this, what were the results?
Re: Alert info being truncated by Hipchat notfications.
Posted: Tue Aug 25, 2015 1:38 pm
by mlbsysops
ssax wrote:ssax wrote:Let's try this to make sure that the template is actually being applied:
Try this template, have it generate an email, see if the text
Long: is even shown in the email.
Code: Select all
***** Nagios XI Alert *****
%alertsummary%
Notification Type: %type%
Service: %service%
Host: %host%
Address: %hostaddress%
State: %servicestate%
Info: %serviceoutput%
Long: %longserviceoutput%
Date/Time: %datetime%
Respond: %responseurl%
Nagios URL: %xiserverurl%
I'm not sure if you missed my message, did you try this, what were the results?
I replied, it's not showing up even with the template set as default for all users.
Re: Alert info being truncated by Hipchat notfications.
Posted: Tue Aug 25, 2015 4:05 pm
by lmiltchev
Can you post the "notify-host-by-email", "notify-service-by-email", "xi_host_notification_handler" and "xi_service_notification_handler" command definitions?
Re: Alert info being truncated by Hipchat notfications.
Posted: Tue Aug 25, 2015 4:26 pm
by mlbsysops
notify-host-by-email
Code: Select all
/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$
notify-service-by-email
Code: Select all
/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$ **" $CONTACTEMAIL$
xi_host_notification_handler
Code: Select all
/usr/bin/php /usr/local/nagiosxi/scripts/handle_nagioscore_notification.php --notification-type=host --contact="$CONTACTNAME$" --contactemail="$CONTACTEMAIL$" --type=$NOTIFICATIONTYPE$ --escalated="$NOTIFICATIONISESCALATED$" --author="$NOTIFICATIONAUTHOR$" --comments="$NOTIFICATIONCOMMENT$" --host="$HOSTNAME$" --hostaddress="$HOSTADDRESS$" --hostalias="$HOSTALIAS$" --hostdisplayname="$HOSTDISPLAYNAME$" --hoststate=$HOSTSTATE$ --hoststateid=$HOSTSTATEID$ --lasthoststate=$LASTHOSTSTATE$ --lasthoststateid=$LASTHOSTSTATEID$ --hoststatetype=$HOSTSTATETYPE$ --currentattempt=$HOSTATTEMPT$ --maxattempts=$MAXHOSTATTEMPTS$ --hosteventid=$HOSTEVENTID$ --hostproblemid=$HOSTPROBLEMID$ --hostoutput="$HOSTOUTPUT$" --longhostoutput="$LONGHOSTOUTPUT$" --datetime="$LONGDATETIME$"
xi_service_notification_handler
Code: Select all
/usr/bin/php /usr/local/nagiosxi/scripts/handle_nagioscore_notification.php --notification-type=service --contact="$CONTACTNAME$" --contactemail="$CONTACTEMAIL$" --type=$NOTIFICATIONTYPE$ --escalated="$NOTIFICATIONISESCALATED$" --author="$NOTIFICATIONAUTHOR$" --comments="$NOTIFICATIONCOMMENT$" --host="$HOSTNAME$" --hostaddress="$HOSTADDRESS$" --hostalias="$HOSTALIAS$" --hostdisplayname="$HOSTDISPLAYNAME$" --service="$SERVICEDESC$" --hoststate=$HOSTSTATE$ --hoststateid=$HOSTSTATEID$ --servicestate=$SERVICESTATE$ --servicestateid=$SERVICESTATEID$ --lastservicestate=$LASTSERVICESTATE$ --lastservicestateid=$LASTSERVICESTATEID$ --servicestatetype=$SERVICESTATETYPE$ --currentattempt=$SERVICEATTEMPT$ --maxattempts=$MAXSERVICEATTEMPTS$ --serviceeventid=$SERVICEEVENTID$ --serviceproblemid=$SERVICEPROBLEMID$ --serviceoutput="$SERVICEOUTPUT$" --longserviceoutput="$LONGSERVICEOUTPUT$" --datetime="$LONGDATETIME$"
Here you go.
Re: Alert info being truncated by Hipchat notfications.
Posted: Wed Aug 26, 2015 1:34 pm
by tmcdonald
In the upper-right-hand corner, click your username then go to Notification Preferences. What settings do you have for email alerts? It is possible the xi_host/service_notification_handler commands are properly running, but you don't allow any of them to continue due to these settings.
Re: Alert info being truncated by Hipchat notfications.
Posted: Thu Aug 27, 2015 12:48 pm
by mlbsysops
Thanks, that looks like it corrected the truncating issue. Couple of questions though;
If the email notifications were disabled in the Notification preferences, why was my user still receiving notifications?
Why isn't there some sort of inheritance between the Contact Management and Notification preferences?
Thanks again for the help.
Re: Alert info being truncated by Hipchat notfications.
Posted: Thu Aug 27, 2015 12:52 pm
by tmcdonald
Going into something soon so I don't have time for a long answer, but basically:
https://assets.nagios.com/downloads/nag ... ntacts.pdf
You had both User-based and contact-based commands enabled. They both ran, but the User-based got blocked by Notification Preferences so you just received the contact-based ones.
In regards to tighter integration between the two, there are cases where you may have a User with no contact, a contact with no User, or a case where you have both but you want them to have different email addresses or other settings.