Creating Host groups and adding Hosts to Nagios

Today we are going to discuss on Nagios Host group creation and Host addition for the Nagios platform. The host groups provide clean grouping of the hosts. 

Creating Host Groups in Nagios

  • Create a hostgroups.cfg using the below command

vi /usr/local/nagios/etc/objects/hostgroups.cfg

  • Then add the following to the hostgroups.cfg.

define hostgroup {
         hostgroup_name NAMEOFGROUP
         alias NAMEOFGROUP alias
}

  • Add the entry in the Nagios.cfg file

nano /usr/local/nagios/etc/nagios.cfg

  • Then, add the below line at the end of the file

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

  • Finally, we need to add the servers to the host group (as below)

define host {
host_name NAMEOFHOST
alias NAMEOFHOST
address xxx.xxx.xxx.xxx
hostgroups NAMEOFGROUP
}

  • Also, make sure to restart the nagios service – service nagios restart

Then, we will look at Host addition process

Continue reading “Creating Host groups and adding Hosts to Nagios”