Rename Host Group
-
asmgiadmin
- Posts: 125
- Joined: Tue Feb 12, 2013 5:00 pm
Rename Host Group
I'd like to rename hostgroups, but have hostgroup defined in host.cfg files. So when current hostgroup is renamed, configuration throws error since host.cfg is configured with old-hostgroup-name.
I can script an update to all host.cfg containing old-hostgroup-name, but how can I incorporate update to play nicely with nagios configuration?
I can script an update to all host.cfg containing old-hostgroup-name, but how can I incorporate update to play nicely with nagios configuration?
-
slansing
- Posts: 7698
- Joined: Mon Apr 23, 2012 4:28 pm
- Location: Travelling through time and space...
Re: Rename Host Group
If you did write a script to automatically update that line within the hosts.cfg file, you would need to place your configuration files in the following directory:
From there you can edit the configurations without them being overwritten by Nagios XI. They will be used by Nagios XI from that directory, but it is worth mentioning that you will need to then import those configuration files into Nagios XI if you want to access features which require them to be in the database such as managing them from the Core config manager, etc..
Additionally you could create a Host template and simply rename the Host Group listed in there when you change it's name, then all the hosts under that template will inherit that information.
Code: Select all
/usr/local/nagios/etc/staticAdditionally you could create a Host template and simply rename the Host Group listed in there when you change it's name, then all the hosts under that template will inherit that information.
-
asmgiadmin
- Posts: 125
- Joined: Tue Feb 12, 2013 5:00 pm
Re: Rename Host Group
It looks like existing hosts have picked up new hostgroup rename. Browsing to host -> host groups shows updated name.
However, searching through /usr/local/nagios/etc/hosts/hostname.cfg files still shows old name - assuming because config has not sucessfully applied.
Auto config is failing with the following:
servers-windows-all is old hostgroup name.
host-not-in-ui does not appear in UI, but has .cfg file in /usr/local/nagios/etc/hosts
Please help explain how hosts can be removed from UI but still reside in /usr/local/nagios/etc/hosts and how to best correct this issue.
However, searching through /usr/local/nagios/etc/hosts/hostname.cfg files still shows old name - assuming because config has not sucessfully applied.
Auto config is failing with the following:
Code: Select all
Error: Could not find any hostgroup matching 'servers-windows-all' (config file '/usr/local/nagios/etc/hosts/host-not-in-ui.cfg', starting on line 14)
host-not-in-ui does not appear in UI, but has .cfg file in /usr/local/nagios/etc/hosts
Please help explain how hosts can be removed from UI but still reside in /usr/local/nagios/etc/hosts and how to best correct this issue.
Re: Rename Host Group
What version of XI are you running?
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.
"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.
-
asmgiadmin
- Posts: 125
- Joined: Tue Feb 12, 2013 5:00 pm
Re: Rename Host Group
Nagios XI 2012R1.6 Copyright © 2008-2013 Nagios Enterprises, LLC.
Re: Rename Host Group
Was this an upgrade from a previous version? If so, what version did you upgrade from?
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.
"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.
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Rename Host Group
Probably the easiest way to remedy the situation would be to run the followingasmgiadmin wrote:Please help explain how hosts can be removed from UI but still reside in /usr/local/nagios/etc/hosts and how to best correct this issue.
Code: Select all
rm -rf /usr/local/nagios/etc/hosts
rm -rf /usr/local/nagios/etc/servicesWrite
Verify
If no errors
Restart
-
sreinhardt
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: Rename Host Group
You are welcome, please let us know if there are further issues with it, I will leave the topic open for a little while.
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.