Alert info being truncated by Hipchat notfications.

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
mlbsysops
Posts: 26
Joined: Wed Jan 14, 2015 3:20 pm

Re: Alert info being truncated by Hipchat notfications.

Post 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.
mlbsysops
Posts: 26
Joined: Wed Jan 14, 2015 3:20 pm

Re: Alert info being truncated by Hipchat notfications.

Post 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.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Alert info being truncated by Hipchat notfications.

Post 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?
mlbsysops
Posts: 26
Joined: Wed Jan 14, 2015 3:20 pm

Re: Alert info being truncated by Hipchat notfications.

Post 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.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Alert info being truncated by Hipchat notfications.

Post 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?
Be sure to check out our Knowledgebase for helpful articles and solutions!
mlbsysops
Posts: 26
Joined: Wed Jan 14, 2015 3:20 pm

Re: Alert info being truncated by Hipchat notfications.

Post 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.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Alert info being truncated by Hipchat notfications.

Post 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.
Former Nagios employee
mlbsysops
Posts: 26
Joined: Wed Jan 14, 2015 3:20 pm

Re: Alert info being truncated by Hipchat notfications.

Post 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.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Alert info being truncated by Hipchat notfications.

Post 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.
Former Nagios employee
Locked