A Nagios configuration trick
Nov. 9th, 2012 03:40 pmVia RW, a neat method of using the Nagios configuration files to quickly switch large numbers of systems from one hostgroup to another, e.g. to allow machines to be moved from test to production status.
- define a host template that conatains a
hostgroupdirective that puts the host in a primary group, e.g.testorproduction - define a host using the template
- add any additional groups to the host using
hostgroup +<secondary-group> - finally, toggle the value of the template as necessary
Although this trick doesn't really apply to the way we do things, moving the assignment of hostgroup memberships from the group definitions to the host definitions greatly simplifies the configuration files and makes it much easier to add and remove systems.