Hostalias

I’m trying to change some options in the alerts configuration.

In Nagios you can enter the host Alias information such as for example:

host_name wsus01
alias Microsoft Wsus Update server
address wsus.domain.local

Now i want in my host and service alert the Alias in the alert e-mail or sms.

I tried to following macro but that didn’t work: $HOSTALIAS$

My command to send the e-mail is like this:

/usr/bin/printf "%b" "***** Nagios *****\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$

Instead of the $HOSTALIAS$ is just displays the hostname.
I’m running Nagios 3.2.3

Is it possible to display the alias in the notification ?

nagios.sourceforge.net/docs/3_0/ … #hostalias

should work… did you reload?

I found the same info on the website.

I’m doing the configuration with Nconf so after every configuration change it reloads nagios so that can’t be the issue.

Have you tried this in your configuration ?

nope and can’t test it today, i’ll see if i can make a couple of tests in the next days, and by the way i only use vi to change my conf files… :slight_smile:

One important thing to check is that your program doesn’t restart nagios instead of reloadign the configs…

Luca

[quote=“luca”]nope and can’t test it today, i’ll see if i can make a couple of tests in the next days, and by the way i only use vi to change my conf files… :slight_smile:

One important thing to check is that your program doesn’t restart nagios instead of reloadign the configs…

Luca[/quote]

Did you manage to make a test ?
I’m still searching for this problem can find it anywhere.

i just checked and i get the hostalias correctly in my emails. (same version 3.2.3)

is the command configuration showing up the same in nagios? (configuration -> commands)

I posted the same question on the offical nagios support forum and got the following reaction which worked for me:

[quote]It should work exactly this way, but imho there is currently a bug in nagios which results in old data within the hostalias field. (viewtopic.php?f=7&t=1519&p=6218&hilit=alias#p6218)

Try shut down nagios, delete retention.dat and restart nagios.[/quote]

[quote=“def103”]I posted the same question on the offical nagios support forum and got the following reaction which worked for me:

[quote]It should work exactly this way, but imho there is currently a bug in nagios which results in old data within the hostalias field. (viewtopic.php?f=7&t=1519&p=6218&hilit=alias#p6218)

Try shut down nagios, delete retention.dat and restart nagios.[/quote]

[/quote]

Same version (3.2.3) and same problem here. That solution worked for me too, thanks for posting!