Page 3 of 3
Re: HostGroups and Configuring Services
Posted: Wed Oct 12, 2016 2:26 pm
by rbizzell39
I shouldn't have to define a host and a host group to get it to work if the whole idea is to use hostgroups.cfg right?
Re: HostGroups and Configuring Services
Posted: Wed Oct 12, 2016 3:42 pm
by avandemore
You need both to use hostgroups, they are an abstration layer for hosts. They can be defined in the same file, but must be defined where Nagios knows where to look for them.
Re: HostGroups and Configuring Services
Posted: Wed Oct 12, 2016 10:13 pm
by rbizzell39
So if I have a 100 host I have to add each individual host.cfg or windows.cfg and then use the hostgroups.cfg
Re: HostGroups and Configuring Services
Posted: Wed Oct 12, 2016 10:32 pm
by Box293
You can put the 100 host definitions in the one host.cfg file if you like.
Nagios doesn't care about what objects the files are stored in, you could have a config like:
Code: Select all
cfg_file=/usr/local/nagios/etc/bananas.cfg
cfg_file=/usr/local/nagios/etc/apples.cfg
cfg_dir=/usr/local/nagios/etc/vegetables
It all comes down to what works for you.
Technically you can put all of your host, service, command, group definitions into one single file. It's generally broken out into different config files to make it easier for humans to administer.
When defining your hosts you can specify in the host configuration directive the name of the hostgroup(s) it should be a member of.
OR
In your hostgroup definition you can define all the hosts that are members of the hostgroup.