How to change the Host diplay name

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
Sreejith_007
Posts: 5
Joined: Wed Jun 26, 2013 1:33 pm

How to change the Host diplay name

Post 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
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: How to change the Host diplay name

Post 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
Sreejith_007
Posts: 5
Joined: Wed Jun 26, 2013 1:33 pm

Re: How to change the Host diplay name

Post 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
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: How to change the Host diplay name

Post by sreinhardt »

Have you altered the alias to be what you want?
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Sreejith_007
Posts: 5
Joined: Wed Jun 26, 2013 1:33 pm

Re: How to change the Host diplay name

Post 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
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: How to change the Host diplay name

Post by slansing »

Are the changes still made to the host's configuration file? Or is it not keeping after a verification and restart?
Sreejith_007
Posts: 5
Joined: Wed Jun 26, 2013 1:33 pm

Re: How to change the Host diplay name

Post 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.:(
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: How to change the Host diplay name

Post 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.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
mohmf2
Posts: 1
Joined: Tue Sep 10, 2013 4:19 am

Re: How to change the Host diplay name

Post 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 .
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: How to change the Host diplay name

Post by sreinhardt »

Thanks mohmf2, hopefully this works for him! If not let us know and we can look to other areas.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Locked