hostgroups.cfg

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
smcracraft
Posts: 35
Joined: Sat Sep 25, 2010 12:53 pm

hostgroups.cfg

Post by smcracraft »

Hi,

I want to create a hostgroup which has all my db servers (assume "database" is in the hostname)
and another hostgroup which has all my non-db servers (the ones that don't have "database" in the hostname.)

Assume all that there is presently is one hostgroup "all" which has everything.

A question about one solution:

step 1) modify hostgroups.cfg.erb

add:
define hostgroup {
hostgroup_name database_servers
alias All database servers
members ^.*database.*$
}
define hostgroup {
hostgroup_name non-database_servers
alias Not database servers
members !database_servers
}

step 2) modify /etc/nagios/nagios.cfg
use_regexp_matching=1
use_true_regexp_matching=0

step3) reload nagios
service nagios reload

Any problems with the above?

Is there a way to do it without regexp without explicit listing of the hostgroup?

Conversely, in services.cfg, is there a way for a defined service
to omit a certain class of hosts within the define service {}?

Thanks.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: hostgroups.cfg

Post by Box293 »

I've played with this before and you cannot perform exclusions in servicegroups or hostgroups.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
smcracraft
Posts: 35
Joined: Sat Sep 25, 2010 12:53 pm

Re: hostgroups.cfg

Post by smcracraft »

Box, this appears to back you up completely:

http://support.nagios.com/forum/viewtop ... =7&t=21500
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: hostgroups.cfg

Post by lmiltchev »

You are correct - you cannot exclude hostgroups from hostgroup definitions.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked