Page 2 of 3

Re: Alert info being truncated by Hipchat notfications.

Posted: Fri Aug 21, 2015 2:13 pm
by mlbsysops
XI R2.7 running on CentOS 6.5

Re: Alert info being truncated by Hipchat notfications.

Posted: Mon Aug 24, 2015 9:11 am
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?

Re: Alert info being truncated by Hipchat notfications.

Posted: Mon Aug 24, 2015 9:29 am
by mlbsysops
It's using long_plugin_output in the /usr/local/nagios/var/status.dat and here you go:

Re: Alert info being truncated by Hipchat notfications.

Posted: Mon Aug 24, 2015 9:44 am
by ssax
Please attach the latest notification template you are using.

Re: Alert info being truncated by Hipchat notfications.

Posted: Mon Aug 24, 2015 9:57 am
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%

Re: Alert info being truncated by Hipchat notfications.

Posted: Mon Aug 24, 2015 10:13 am
by lmiltchev
Is the "Allow HTML Tags in Host/service Status" check-box selected under the "System Settings" (Admin->Manage System Config)?

Re: Alert info being truncated by Hipchat notfications.

Posted: Mon Aug 24, 2015 10:26 am
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

Re: Alert info being truncated by Hipchat notfications.

Posted: Tue Aug 25, 2015 8:41 am
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%

Re: Alert info being truncated by Hipchat notfications.

Posted: Tue Aug 25, 2015 9:12 am
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%

Re: Alert info being truncated by Hipchat notfications.

Posted: Tue Aug 25, 2015 9:35 am
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.