Page 1 of 1

How to change the Host diplay name

Posted: Wed Jun 26, 2013 1:40 pm
by Sreejith_007
Hello,

My nagios core version is 3.1.1, i would like to know if is there any way to change the displayed name for the host in Nagios Interface.

Thanks
Sreejith

Re: How to change the Host diplay name

Posted: Wed Jun 26, 2013 1:45 pm
by slansing
I'd take a look at this page, this shows a proper host definition, and explanations for all the fields you can change:

http://nagios.sourceforge.net/docs/3_0/ ... .html#host

Re: How to change the Host diplay name

Posted: Wed Jun 26, 2013 2:00 pm
by Sreejith_007
Hi,

I have tried using the display_name parameter and reload the nagios server, but the updated name is not showing up on the Nagios interface. Please let me know if i missed anything here ?

Thanks
Sreejith

Re: How to change the Host diplay name

Posted: Thu Jun 27, 2013 10:25 am
by sreinhardt
Have you altered the alias to be what you want?

Re: How to change the Host diplay name

Posted: Thu Jun 27, 2013 12:28 pm
by Sreejith_007
I have also tried setting the alias but it is not getting displayed in the UI, even after restarting the nagios service

Re: How to change the Host diplay name

Posted: Thu Jun 27, 2013 12:59 pm
by slansing
Are the changes still made to the host's configuration file? Or is it not keeping after a verification and restart?

Re: How to change the Host diplay name

Posted: Sat Jun 29, 2013 3:57 am
by Sreejith_007
Well my monitoring setup is like nagios fetches the Ganglia metrics and the metric is displayed in Nagios, so the metric reaches the Nagios with the hostname which is mentioned in each host, so my requirement is to change the hostname which is displayed in the UI i can do the same by cheanging the hostname of each hosts but this will break some other thing, so i have tried to add the diplay_name parameter in the host definition and restarted the nagios, but its not reflecting in the UI.:(

Re: How to change the Host diplay name

Posted: Mon Jul 01, 2013 1:36 pm
by abrist
"alias" is just a more descriptive string for the host. display_name is currently not working with core correctly for display purposes:
From: http://nagios.sourceforge.net/docs/3_0/ ... tions.html
display_name: This directive is used to define an alternate name that should be displayed in the web interface for this host. If not specified, this defaults to the value you specify for the host_name directive. Note: The current CGIs do not use this option, although future versions of the web interface will.

Re: How to change the Host diplay name

Posted: Tue Sep 10, 2013 4:29 am
by mohmf2
There is a nother way to accomplished this using host_alias directive . but in you have to edit the CGI source file .

I have success to show the alias instead of the name by the bellow steps :
1-Download the nagios source file from sourcefroge.
2-untar the nagios source .
3-edit the "status.c" file in the cgi folder by looking for "show_servicegroup_hostgroup_member_overview" function , then edit the line :

Code: Select all

printf("<td class='status%s'><a href='%s?host=%s&style=detail' title='%s'>%s</a></td>\n", status_bg_class, STATUS_CGI, url_encode(hststatus->host_name), temp_host->address, hststatus->host_name);
to

Code: Select all

printf("<td class='status%s'><a href='%s?host=%s&style=detail' title='%s'>%s</a></td>\n", status_bg_class, STATUS_CGI, url_encode(hststatus->host_name), temp_host->address, temp_host->alias);
then recompile & install nagios and reload the nagios server .

Re: How to change the Host diplay name

Posted: Tue Sep 10, 2013 10:41 am
by sreinhardt
Thanks mohmf2, hopefully this works for him! If not let us know and we can look to other areas.