Page 1 of 1

Define service for all hosts that belong to all the given ho

Posted: Fri Jul 03, 2015 4:20 am
by sib
I can not figure out how to create a service for all hosts that are in 2 given hostgroups.

Example hostgroups:

Code: Select all

oracle: hostA, hostB
prod: hostB, hostC
Now I need a service for all hosts that are in both groups. In that case only for hostB

I tried to create a service like that. But this will include all prod servers

Code: Select all

define service {
        service_description             Oracle Filesystems
        use                             Oracle_PROD_Service
        hostgroup_name                  oracle,prod
        check_interval                  3
        check_command                   check_nrpe!check_fs!pkgname:oracle:95:99!!!!!!!
        register                        1
}

Re: Define service for all hosts that belong to all the give

Posted: Mon Jul 06, 2015 8:12 am
by lmiltchev
The easiest way to achieve this is to add this service to all desired hosts under the CCM.

CCM->Services-><your service>->Edit->Manage Hosts->...->Add Selected->Close->Save->Apply Configuration

In Nagios Core, you can use exclusions to exclude hosts or hostgroups by preceding the host/hostgroup by a "!" symbol. See our documentation on the topic here:
http://nagios.sourceforge.net/docs/nagi ... ricks.html

You cannot use exclusions in Nagios XI if you want to manage your objects under the CCM. You can however maintain your objects manually if you placed them in the "static" directory.
The document below explains how to do this:
https://assets.nagios.com/downloads/nag ... ios-XI.pdf

Hope this helps.

Re: Define service for all hosts that belong to all the give

Posted: Tue Jul 07, 2015 8:26 am
by sib
Thanks. This config has worked for me

Code: Select all

define service {
        service_description             Oracle Filesystems
        use                             Oracle_PROD_Service
        hostgroup_name                  oracle,!devua
        check_interval                  3
        check_command                   check_nrpe!check_fs!pkgname:oracle:95:99!!!!!!!
        register                        1
}

define service {
        service_description             Oracle Filesystems
        use                             Oracle_DEV_Service
        hostgroup_name                  oracle,!prod
        check_interval                  3
        check_command                   check_nrpe!check_fs!pkgname:oracle:95:101!!!!!!!
        register                        1
}

Re: Define service for all hosts that belong to all the give

Posted: Tue Jul 07, 2015 9:09 am
by tmcdonald
I'll be closing this thread now, but feel free to open another if you need anything in the future!