service grouping

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
masi
Posts: 3
Joined: Mon Mar 10, 2014 5:15 am

service grouping

Post by masi »

Hi,

I have lot of services and its quite boring to write in all host configuration tens of services. Are there any nagios object, which can cover services under one variable/service/alias?

For example:
I have 2 geo locations DC1, DC2 in both I have lot of servers (web, mail, dns, dhcp, samba, cups,...).

My idea is to create "cover services" mail, web, base-dc1, based-dc2, etc.
Than use this "cover services" in Hosts.

In code it should look like this:

define coverservice {
service_name BASE-DC1
alias Core services on servers in Datacenter 1
services nrpe-load, nrpe-hd-root, nrpe-hd-data, nrpe-swap, nrpe-etc-git, nrpe-puppet, nrpe-apt, nrpe-md5-check, nrpe-iscsi, nrpe-smart, ping, ssh, snmp
}

define coverservice {
service_name APP-SERVER
alias Aplication server monitoring
services nrpe-supervisord, nrpe-tomcat, nrpe-ror, nrpe-nodejs, nrpe-appbank
}


define host {
host_name node-a12e3
alias App server 14
address 172.17.22.35
parents sw-12p6
contact_groups app-admins, monitor
check_command BASE-DC1, APP-SERVER
}


Thanks for help
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: service grouping

Post by slansing »

masi
Posts: 3
Joined: Mon Mar 10, 2014 5:15 am

Re: service grouping

Post by masi »

I thought so before I read more about it. The servicegroup need to define pair host,service in directive members, which is not what I need.

I have huge configuration yet. The idea of servicegroup is conficts to our idea. We have host oriented view, so we define monitored services at host definitions.

Thanks for tip...
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: service grouping

Post by abrist »

If most of your checks are identical other than hostname, you should be able to add your generic checks to hostgroups and then hosts in those hostgroups would inherit those checks.

Code: Select all

define service {
	service_description		super sweet ping
	use				          generic-service
	check_command		      check_ping
   hostgroup_name           thepinggroup
}

Now Put a host in "thepinggroup" and it should inherit the check. The above is a scratch, but you should be able to see where I was going with it . . .
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
masi
Posts: 3
Joined: Mon Mar 10, 2014 5:15 am

Re: service grouping

Post by masi »

Thanks abrist, this solution I have tried but it's not what i want. I want define checks only at one place (in host's config file).I fear so this topic doesn't have solution in our company scheme. We know servicegroups which recomended slansing and your solution we know too, but we strictly prefer to define services only in host's config file. Solutions where we must edit more than one file for add new host is unusable for us.

Thanks for your help
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: service grouping

Post by slansing »

Well, I believe you could do this, have you tried adding multiple hosts, services, etc, into a single configuration file? As far as I know, nagios simply reads the configuration files in, it does not know which is which, and separates them by what type of configuration they are, their names, and contents.
Locked