Exclude service check from one host in hostgroup

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Exclude service check from one host in hostgroup

Post by eloyd »

Is it possible to put a host into a host group, assign a service to the hostgroup, but then not have that service run on specific hosts? For instance:
  • Make a hostgroup called CARS
  • Put the hosts Chevy, Toyota, Volkswagen, and Ford into CARS
  • Run a service check called DO_WE_HAVE_GAS on hostgroup CARS
  • Run a service check called EMISSIONS on hostgroup CARS
  • Whoops!! Don't want to run EMISSIONS on Volkswagen!
So how can I leave everything as it is, but exclude the EMISSIONS service check from running on VOLKSWAGEN?
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
User avatar
BanditBBS
Posts: 2474
Joined: Tue May 31, 2011 12:57 pm
Location: Scio, OH
Contact:

Re: Exclude service check from one host in hostgroup

Post by BanditBBS »

Using custom variables.....let me look for the thread...

EDIT: can't find thread, but...
Add a free variable

Variable Name = host_name
Variable value = !YOUR-HOST.COM,!YOUR-OTHER-HOST.COM

Now for the caveat....
This works perfectly fine if you have a service definition where you are adding hostgroups and want to just exclude a couple hosts. This will fail miserably if you also are adding individual hosts (in addition to hostgroups) because the free variable you set will in fact overwrite the individual hosts you have.
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Exclude service check from one host in hostgroup

Post by eloyd »

So, if I get you right, you're saying add a free variable called "host_name" with a value called "!Volkswagen" to my EMISSIONS service check? My understanding is if I do that, then I get a variable called $_SERVICEhost_name$, unless I misunderstand.

And is this the thread you're referring to: https://support.nagios.com/forum/viewto ... 16&t=24170
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
User avatar
BanditBBS
Posts: 2474
Joined: Tue May 31, 2011 12:57 pm
Location: Scio, OH
Contact:

Re: Exclude service check from one host in hostgroup

Post by BanditBBS »

Yeah, that's it! Also, the OP in that thread said it works, so no idea in regards to your question.
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Exclude service check from one host in hostgroup

Post by eloyd »

Yah, I read through it. I'll see if it works for this customer.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Exclude service check from one host in hostgroup

Post by eloyd »

Suh-weet. Works. Thanks, Bandit for pointing me at Scott's kludge.

Image
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
bwallace
Posts: 1145
Joined: Tue Nov 17, 2015 1:57 pm

Re: Exclude service check from one host in hostgroup

Post by bwallace »

Thanks Guys! Locking this thread now...
Be sure to check out the Knowledgebase for helpful articles and solutions!
Locked