Page 1 of 1

How to show HOSTNAME in service notifications?

Posted: Tue Jun 30, 2015 2:29 pm
by bostonangus
I have Nagios setup and e-mail notifications are being sent successfully, however, currently notifications don't tell me which host is having problems.

I have multiple servers running, and would like to have notifications tell me specifically which server is down/having trouble.

So basically, how do I add the HOSTNAME to notification content?

Any advice would be greatly appreciated, thanks!

Re: How to show HOSTNAME in service notifications?

Posted: Tue Jun 30, 2015 2:35 pm
by tmcdonald
You will need to modify your notify-service-by-email command (or whichever command you have set) to include the $HOSTADDRESS$ macro.

Re: How to show HOSTNAME in service notifications?

Posted: Tue Jun 30, 2015 2:40 pm
by bostonangus
Thanks so much for the quick reply.

Could you confirm where I set the variables, such as: $HOSTADDRESS$. Or are they globally set by nagios and stay the same for everyone?

Re: How to show HOSTNAME in service notifications?

Posted: Tue Jun 30, 2015 2:45 pm
by tmcdonald
That is a macro, and is set by Nagios on a per-object basis. So if you have a host with the address of 192.168.1.100 and a service is attached to it, both the host and the service will have access to that value in the macro. This can be used in notification commands, event handlers, etc.

Re: How to show HOSTNAME in service notifications?

Posted: Tue Jun 30, 2015 3:17 pm
by bostonangus
Thanks!

Re: How to show HOSTNAME in service notifications?

Posted: Tue Jun 30, 2015 3:22 pm
by tmcdonald
You are quite welcome.

I'll be closing this thread now, but feel free to open another if you need anything in the future!