How to add hostgroup to another hostgroup

188 views Asked by At
define hostgroup{
 hostgroup_name Basestations and Equipment
 alias          ACCESS NETWORK
 members       Buziga-AP1,Buziga-AP2,Buziga-AP4,Buziga-Nsambya BH,Gulu BTS-AP,Hoima-AP1,Hoima-AP2,Hoima-Switch,IPS Fiber-Switch,Jinja-AP1,Katabi Router,Katabi-AP1,Katabi-AP2,Nsambya-AP1,Nsambya-AP2,Nsambya-AP2,Nsambya-AP3,Nsambya-GoddiesAP,Nsambya-LubowaBH,Nsambya-Switch,NsambyaBuzigaBH,SegukuAP,SegukuMAFAP1,Signet-Kololo-TVs-Switch,Soroti-AP1

}


define hostgroup{
 hostgroup_name NSAMBYA
 alias          NSAMBYA
 members        Nsambya-AP1,Nsambya-AP2,Nsambya-AP3,Nsambya-GoddiesAP,Nsambya-Switch
}

I need a way to add the NSAMBYA hostgroup to the access network host group. I've tried +NSAMBYA to the memebers but gives error below.

Error: Could not find any host matching 'NSAMBYA' (config file '/usr/local/nagios/etc/objects/hostgroups.cfg', starting on line 1) Error: Could not expand members specified in hostgroup (config file '/usr/local/nagios/etc/objects/hostgroups.cfg', starting on line 1) Error processing object config files!

1

There are 1 answers

0
tbielaszewski On

To embed hostgroups in another hostgroup use hostgroup_members like:

define hostgroup{
        hostgroup_name          linux-subgroup
        alias                   some linux servers
        members                 linux-host01, linux-host02
}
define hostgroup{
        hostgroup_name          linux-servers
        alias                   all linux servers
        members                 linux-host03, linux-host04
        hostgroup_members       linux-subgroup
}