Using real hostname vs "on-Nagios" hostname
Posted: Wed Aug 12, 2015 4:48 pm
Sorry if this is a dumb question, but does anyone know how I can reference a server's "real" hostname rather than what is defined on the Nagios host definition?
Lets say I have multiple machines defining themselves as "localhost" in their own hosts.cfg in their own Nagios directories.
And let's say there are all notifying me by email of whatever state changes that happened. I'm going to get a lot of emails from machines calling themselves "localhost", which isn't very helpful in problem solving.
I would like to use their "real" hostnames, as they are defined by their systems, that is returned when I run echo $(hostname) on the command line. To have what is printed to the emails rely on what the system defines, not just what Nagios has defined.
I just wanted to avoid changing all their host definition hostnames because on the off chance I need to rename them on the system (say from myBox1 to myBox1A), I will have to rename them on Nagios as well to keep the notifications accurate. If there is a way to avoid this, I'd love to hear it. Thanks!
Lets say I have multiple machines defining themselves as "localhost" in their own hosts.cfg in their own Nagios directories.
And let's say there are all notifying me by email of whatever state changes that happened. I'm going to get a lot of emails from machines calling themselves "localhost", which isn't very helpful in problem solving.
I would like to use their "real" hostnames, as they are defined by their systems, that is returned when I run echo $(hostname) on the command line. To have what is printed to the emails rely on what the system defines, not just what Nagios has defined.
I just wanted to avoid changing all their host definition hostnames because on the off chance I need to rename them on the system (say from myBox1 to myBox1A), I will have to rename them on Nagios as well to keep the notifications accurate. If there is a way to avoid this, I'd love to hear it. Thanks!