How to define a host group on Nagios 4

I would like to define a host group on Nagios 4. In recon it should be defined somewhere in /usr/local/nagios/etc. I tried creating a file hostgroups.cfg that with contents:

define hostgroup{
   hostgroup_name   webservers
   members          *
}

Is this the right place to add that configuration? (I'm a Nagios-newbie)


Solution 1:

In your nagios.cfg file, you can add a line pointing to the hostgroups.cfg file you created, thus telling nagios to include that file.

cfg_file=/usr/local/nagios/etc/hostgroups.cfg

You can also specify a directory, and nagios will process any of the files found within:

cfg_dir=/usr/local/nagios/etc/directory_containing_cfg_files