We have already described Nagios installation, Client configuration in the last post, this is post to configure service group  in Nagios server.

It's very simple to configure service group of all the hosts.

Step 1: Open the localhost.cfg file and define servicegroup, 

Servicegroup_name  Users-Groups for Users 
Servicegroup_name  Disks-Groups for Disks usage


# vim /usr/loca/nagios/etc/objects/localhost.cfg
 
define servicegroup{
        servicegroup_name       Users-Groups
        alias                   Users
        }
define servicegroup{
       servicegroup_name        Disk-Groups
        alias                   Disk Usages
        }


Step 2 :

Open your server host file and device the servicegroups,


# vim /usr/local/nagios/etc/servers/

define host{
        use                     linux-server
        host_name               host.hostname.com
        alias                   hostname.com
        address                 192.168.2.0      # Client Host IP
        }

define service{
        use                             generic-service
        host_name                        host.hostname.com
        service_description             Current Users
        check_command                   check_nrpe!check_users
        servicegroups                   Users-Groups
        }
define service{
        use                             generic-service
        host_name                       host.hostname.com
        service_description             Disk Usage
        check_command                   check_nrpe!check_disk
        servicegroups                   Disks-Groups
        }


Once configured restart the Nagios service,


#  service nagios restart

Restarting nagios (via systemctl):                         [  OK  ]