How to show HOSTNAME in service notifications?

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
bostonangus
Posts: 10
Joined: Tue Jun 30, 2015 2:17 pm

How to show HOSTNAME in service notifications?

Post 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!
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: How to show HOSTNAME in service notifications?

Post by tmcdonald »

You will need to modify your notify-service-by-email command (or whichever command you have set) to include the $HOSTADDRESS$ macro.
Former Nagios employee
bostonangus
Posts: 10
Joined: Tue Jun 30, 2015 2:17 pm

Re: How to show HOSTNAME in service notifications?

Post 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?
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: How to show HOSTNAME in service notifications?

Post 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.
Former Nagios employee
bostonangus
Posts: 10
Joined: Tue Jun 30, 2015 2:17 pm

Re: How to show HOSTNAME in service notifications?

Post by bostonangus »

Thanks!
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: How to show HOSTNAME in service notifications?

Post 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!
Former Nagios employee
Locked