Macro values don't seem to be consistent

Jim McNamara jim at packetalk.net
Wed Jun 8 20:16:18 CEST 2011


Hello all. I'm seeing an unexpected behavior in my nagios installs, and
I'd appreciate some insight as to what I did incorrectly. 

This is nagios version 3.2.3 compiled from source.

I added the $HOSTALIAS$ macro to the emails nagios generates, as often
information in the alias makes it clearer which device has the problem.
The host email looks like this:

# 'notify-host-by-email' command definition
define command{
        command_name    notify-host-by-email
        command_line    /usr/bin/printf "%b" "***** Nagios *****\n
\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nAbout:
$HOSTALIAS$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo:
$HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s "**
$NOTIFICATIONTYPE$ $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
        }

The same modifications were made to the notify-service-by-email as well.

This works somewhat as intended, it does add an "About:" line, but the
value for $HOSTALIAS$ is not consistent.

In the /usr/local/nagios/etc/objects/localhost.cfg file the host is
defined as:

define host{
        use                                linux-server 
        host_name               localhost
        alias                             old gray box on the metal
stand
        address                      127.0.0.1
	hostgroups		linux-servers
        }

When I click on Host followed by localhost in the web interface for
nagios, I get a page with this data at the top:

Host
old gray box on the metal stand
(localhost)

In addition, the line "old gray box on the metal stand" is listed as the
alias for localhost in /usr/local/nagios/var/objects.cache:

define host {
	host_name	localhost
	alias	old gray box on the metal stand
	address	127.0.0.1
	check_period	24x7
	check_command	check-host-alive

When I receive a host email about localhost, the About: line in the
email which should to my understanding contain the value of $HOSTALIAS$,
instead has "localhost" listed where the $HOSTALIAS$ (old grey box on
the metal stand) is expected.   
 
Here is the text of a recent email:

***** Nagios *****

Notification Type: RECOVERY

Service: current load
Host: localhost
About: localhost
Address: 127.0.0.1
State: OK

Date/Time: Wed Jun 8 13:41:01 EDT 2011

Additional Info:

OK - load average: 1.18, 2.55, 2.34



I checked and multiple copies of nagios aren't running, so I'm guessing
I did something incorrect with the macro?

Interestingly, this is happening to about half of the hosts I'm
receiving emails for. Sometimes the $HOSTALIAS$ is correct, and other
times it seems $HOSTALIAS$ is incorrect.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20110608/3a742c69/attachment.html>
-------------- next part --------------
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
-------------- next part --------------
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null


More information about the Users mailing list