How to configure "Monitor Description" and "Suggested Action

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
rez1sog
Posts: 38
Joined: Fri Mar 16, 2012 6:02 am

How to configure "Monitor Description" and "Suggested Action

Post by rez1sog »

I have inherited a Nagios XI install and I have a few question how to complete some of the configuration items. When we get alerts, a lot of them look like this:


Notification Type: PROBLEM

Service: Drive C: Disk Usage
Host: YOGI
Address: 10.20.20.21
State: WARNING
Info: C:\ - total: 136.11 Gb - used: 108.91 Gb (80%) - free 27.20 Gb (20%)
Date/Time: 2012-08-07 08:15:59

Nagios URL: http://nagiosxi/nagiosxi/

Monitor Description:
%alertDesc%

Suggested Action:
%alertAction%


I am trying to figure out how to fix the part that says %alertDesc% and %alertAction% so that I can get them to generate a meaningful message that will help the reciever of the alert. Where is that item sent and can I set it to redirect to a URL or some content info?

Here is a copy of my settings....

Nagios XI Installation Profile
Download Profile
System:
nagiosxi 2.6.18-308.4.1.el5 x86_64
CentOS release 5.6 (Final)
Gnome is not installed
Apache Information
PHP Version: 5.1.6
Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20100101 Firefox/14.0.1
Server Name: nagiosxi
Server Address: 10.20.20.74
Server Port: 80
Date/Time
PHP Timezone: America/New_York
PHP Time: Tue, 07 Aug 2012 08:53:25 -0400
System Time: Tue, 07 Aug 2012 08:53:25 -0400
Nagios XI Data
nagios (pid 3806) is running...
NPCD running (pid 4046).
ndo2db (pid 4181) is running...
CPU Load 15: 10.50
Total Hosts: 237
Total Services: 2019
Function 'get_base_uri' returns: http://nagiosxi/nagiosxi/
Function 'get_base_url' returns: http://nagiosxi/nagiosxi/
Function 'get_backend_url(internal_call=false)' returns: http://nagiosxi/nagiosxi/includes/compo ... rofile.php
Function 'get_backend_url(internal_call=true)' returns: http://localhost/nagiosxi/backend/
Ping Test localhost
Running:
User avatar
nscott
Posts: 1040
Joined: Wed May 11, 2011 8:54 am

Re: How to configure "Monitor Description" and "Suggested Ac

Post by nscott »

How to define Nagios XI notifcations variables/macros is defined at the bottom of this document:

http://assets.nagios.com/downloads/nagi ... iables.pdf

Please note there is a list of predefined macros that you could look through that may possibly fill your needs.
Nicholas Scott
Former Nagios employee
rez1sog
Posts: 38
Joined: Fri Mar 16, 2012 6:02 am

Re: How to configure "Monitor Description" and "Suggested Ac

Post by rez1sog »

Thanks, but I have read that doc already, it does not really seem to help me with my problem. How do configure things so that the %alertDesc% gets populated with something? The same for the %alertAction% Where is that configured? The doc does not seem to say.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: How to configure "Monitor Description" and "Suggested Ac

Post by slansing »

rez1sog,

Can you post your xi_host_notification_handler, and xi_service_notification_handler?

They are both located under the Commands side menu selection in the Nagios Core Config Manager.
rez1sog
Posts: 38
Joined: Fri Mar 16, 2012 6:02 am

Re: How to configure "Monitor Description" and "Suggested Ac

Post by rez1sog »

I am trying, but I can not seem to do get any real info. I see:


/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$"

for the command line for xi_service_notification_handler

and

/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$"

for notifications.

I also see this:

Entry cannot be activated because it is used by another configuration:
Relational information for xi_host_notification_handler of table tbl_command:
Relation to tbl_contacttemplate, entry xi_contact_generic - deletion possible
Relation to tbl_contact, entry nagiosadmin - deletion not possible

Last database update: 2012-07-25 14:26:11
Last change of the configuration file: 2012-08-06 10:06:37
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: How to configure "Monitor Description" and "Suggested Ac

Post by mguthrie »

You might be better of using the %alertsummary% macro, which is already built in. Otherwise, you'll need to follow the instructions at the bottom of the documentation posted above for adding a custom macro.

Quoted from XI_Notification_variables doc.
For example, you defined a custom variable with a
variable name = _TEST and value = testMacroValue.

Next, you should go to Configure → Commands in
the Nagios Core Manager, and append the
xi_host_notification_handler command with:
--test=”$_HOSTTEST$”.

(Alternatively, If you had a variable _MAC, you would
append xi_host_notification_handler command with:
--test=”$_HOSTMAC$”.

Last step is to log in as the contact you are setting this
for, go to Configure → My Account Settings →
Notification Messages, and add TEST: %test% to your
“Host Alert Message” section.
rez1sog
Posts: 38
Joined: Fri Mar 16, 2012 6:02 am

Re: How to configure "Monitor Description" and "Suggested Ac

Post by rez1sog »

Ok. I am not 100% sure of what you are saying, but I am willing to try and change things. For some reason when I go to "My account settings" and try to edit the alert message I notice that it is different then the one that is being sent in email. Is there another place where this is configured in a global/default way?
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: How to configure "Monitor Description" and "Suggested Ac

Post by mguthrie »

The notification messages are actually configured per-user, so you might have to access the Admin->Manage Users page and "masquerade" as the other users to find out who has the empty macros.
rez1sog
Posts: 38
Joined: Fri Mar 16, 2012 6:02 am

Re: How to configure "Monitor Description" and "Suggested Ac

Post by rez1sog »

I got that working. You were very helpful there. Did some more digging and it looks as if the previous person was trying to configure it so that you could click somewhere in the email and get info on what the alert meant and what action to take. I think he was trying to get the stuff described in:

http://support.nagios.com/forum/viewtop ... 7&start=10

to work. This is the stuff in the action.zip file. I did not really find anywhere documentation on how to get that working.

Is there away to have an email alert have a URL in it that would send you to a webpage detailing how to resolve the issue? If so, how would you do it?
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: How to configure "Monitor Description" and "Suggested Ac

Post by mguthrie »

I would use this built-in macro, it should get you what you need.
%responseurl% A rapid response URL that can be used to quickly handle problems through acknowledgments, etc.
Locked