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 »

XI R2.7 running on CentOS 6.5
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 »

If you edit your /usr/local/nagios/var/status.dat file and find the service in there, which portion is the Cert_02.crt showing up in, plugin_output or long_plugin_output?

Can you post a sanitized screenshot?
mlbsysops
Posts: 26
Joined: Wed Jan 14, 2015 3:20 pm

Re: Alert info being truncated by Hipchat notfications.

Post by mlbsysops »

It's using long_plugin_output in the /usr/local/nagios/var/status.dat and here you go:
You do not have the required permissions to view the files attached to this post.
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 »

Please attach the latest notification template you are using.
mlbsysops
Posts: 26
Joined: Wed Jan 14, 2015 3:20 pm

Re: Alert info being truncated by Hipchat notfications.

Post by mlbsysops »

Here is the hipsaint template for hipchat intergration:

Code: Select all

"""
Templates used to build hipchat api payloads
"""

host_template = """
<strong>{timestamp} - {hostname}  (nagios@{nagios_host})</strong><br/>
<strong>Type:</strong> {ntype}<br/>
<strong>Host:</strong> {hostname} (<a href="{hostaddress}">{hostaddress}</a>)<br/>
<strong>State:</strong> {state}<br>
<strong>Info:</strong>
<pre>{hostoutput}</pre>
"""

host_medium_template = "<strong>{timestamp} - {hostname} ({hostaddress}) - {ntype}/{state}</strong><br/><pre>{hostoutput}</pre>"
host_short_template = """[{ntype}] {hostname}: {hostoutput}"""

service_template = """
<strong>{timestamp} - {servicedesc} on {hostalias} (nagios@{nagios_host})</strong><br/>
<strong>Type:</strong> {ntype}<br/>
<strong>Host:</strong> {hostalias} (<a href="{hostaddress}">{hostaddress}</a>)<br/>
<strong>State:</strong> {state}<br/>
<strong>Info:</strong>
<pre>{serviceoutput}</pre>
"""

service_medium_template = "<strong>{timestamp} - {servicedesc} on {hostalias} ({hostaddress}) - {ntype}/{state}</strong><br/><pre>{serviceoutput}</pre>"
service_short_template = "[{ntype}] {hostalias} {servicedesc}: {serviceoutput}"


templates = {'host': host_template, 'medium-host': host_medium_template, 'short-host': host_short_template,
             'service': service_template, 'medium-service': service_medium_template, 'short-service': service_short_template}
Here is the email template.

Code: Select all

***** Nagios XI Alert *****

%alertsummary%

Notification Type: %type%

Service: %service%
Host: %host%
Address: %hostaddress%
State: %servicestate%
Info:
%serviceoutput%
Date/Time: %datetime%

Respond: %responseurl%
Nagios URL: %xiserverurl%
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 »

Is the "Allow HTML Tags in Host/service Status" check-box selected under the "System Settings" (Admin->Manage System Config)?
Be sure to check out our Knowledgebase for helpful articles and solutions!
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 »

I've never used hipsaint but my assumption is that something like this would work:

*** Notice the {longserviceoutput} I've added under the service_template, you can add it anywhere you want, I'm just showing you an example.

Code: Select all

"""
Templates used to build hipchat api payloads
"""

host_template = """
<strong>{timestamp} - {hostname}  (nagios@{nagios_host})</strong><br/>
<strong>Type:</strong> {ntype}<br/>
<strong>Host:</strong> {hostname} (<a href="{hostaddress}">{hostaddress}</a>)<br/>
<strong>State:</strong> {state}<br>
<strong>Info:</strong>
<pre>{hostoutput}</pre>
"""

host_medium_template = "<strong>{timestamp} - {hostname} ({hostaddress}) - {ntype}/{state}</strong><br/><pre>{hostoutput}</pre>"
host_short_template = """[{ntype}] {hostname}: {hostoutput}"""

service_template = """
<strong>{timestamp} - {servicedesc} on {hostalias} (nagios@{nagios_host})</strong><br/>
<strong>Type:</strong> {ntype}<br/>
<strong>Host:</strong> {hostalias} (<a href="{hostaddress}">{hostaddress}</a>)<br/>
<strong>State:</strong> {state}<br/>
<strong>Info:</strong>
<pre>{serviceoutput} {longserviceoutput}</pre>
"""

service_medium_template = "<strong>{timestamp} - {servicedesc} on {hostalias} ({hostaddress}) - {ntype}/{state}</strong><br/><pre>{serviceoutput}</pre>"
service_short_template = "[{ntype}] {hostalias} {servicedesc}: {serviceoutput}"


templates = {'host': host_template, 'medium-host': host_medium_template, 'short-host': host_short_template,
             'service': service_template, 'medium-service': service_medium_template, 'short-service': service_short_template}

If you want the long_output in the email, this is how your template would look:

*** Notice the %longserviceoutput% I've added, you can add it anywhere you want, I'm just showing you an example.

Code: Select all

***** Nagios XI Alert *****

%alertsummary%

Notification Type: %type%

Service: %service%
Host: %host%
Address: %hostaddress%
State: %servicestate%
Info:
%serviceoutput%
%longserviceoutput%
Date/Time: %datetime%

Respond: %responseurl%
Nagios URL: %xiserverurl%
Edit: Here is the list of standard macros that you can use - https://assets.nagios.com/downloads/nag ... olist.html
mlbsysops
Posts: 26
Joined: Wed Jan 14, 2015 3:20 pm

Re: Alert info being truncated by Hipchat notfications.

Post by mlbsysops »

Using %longserviceoutput% doesn't help:

***** Nagios Monitor XI Alert *****

Notification Type: PROBLEM

Service: check_certs_ns_PROD
Host: <HOST>
Address: <IP_ADDRESS>
State: CRITICAL

Date/Time: Tue Aug 25 13:37:48 GMT 2015

Additional Info:

Critical Cert_01.crt will expire in 0 days

Here is the Template I'm using for email (Hipsaint template requires some coding on the back end to update so we'll just focus on email as it's a built in function)

Code: Select all

***** Nagios XI Alert *****

%alertsummary%

Notification Type: %type%

Service: %service%
Host: %host%
Address: %hostaddress%
State: %servicestate%
Info:
%longserviceoutput%
Date/Time: %datetime%

Respond: %responseurl%
Nagios URL: %xiserverurl%
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 »

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

Re: Alert info being truncated by Hipchat notfications.

Post by tmcdonald »

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