bug in TOTALHOSTSERVICES* macros

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
mendor
Posts: 3
Joined: Tue Dec 10, 2013 9:18 pm

bug in TOTALHOSTSERVICES* macros

Post by mendor »

I'm trying to use TOTALHOSTSERVICES* macros. If I'm using one per command like ...!$TOTALHOSTSERVICESWARNING:host5$ everything works fine and I'm getting correct result, but if I'm using several per command like ...!$TOTALHOSTSERVICESWARNING:host6$,$TOTALHOSTSERVICES:host8$,$TOTALHOSTSERVICESUNKNOWN:host4$ or in host group form ...!$TOTALHOSTSERVICESCRITICAL:host_group:+$ results become incorrect (seems like in this case I'm getting all the info for the first mentioned host - host6 in my example).
Is it known issue? Is there any way to fix it?
version I'm using - 3.5.1
Thank you.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: bug in TOTALHOSTSERVICES* macros

Post by slansing »

Can you show us an example of how you are implementing these macro's in your configurations? And what the output looks like? Thanks a ton!
mendor
Posts: 3
Joined: Tue Dec 10, 2013 9:18 pm

Re: bug in TOTALHOSTSERVICES* macros

Post by mendor »

Of course:

This one works for example:

define service{
use generic-service
host_name host2
service_description Test
check_command check_nrpe!check_test!$HOSTLATENCY:host_group:,$
max_check_attempts 3
servicegroups SG
}

output: 0.015,0.012,0.012,0.007,0.008,0.011,0.007,0.005,0.009

This one doesn't work:

define service{
use generic-service
host_name host2
service_description Test
check_command check_nrpe!check_test!$TOTALHOSTSERVICESCRITICAL:host_group:,$
max_check_attempts 3
servicegroups SG
}

output: 0,0,0,0,0,0,0,0,0 - wrong output, I have some critical services on some of the hosts

This one works:

define service{
use generic-service
host_name host2
service_description Test
check_command check_nrpe!check_test!$TOTALHOSTSERVICESCRITICAL:host4$
max_check_attempts 3
servicegroups SG
}

output: 1 - correct output

This one doesn't work again:

define service{
use generic-service
host_name host2
service_description Test
check_command check_nrpe!check_test!$TOTALHOSTSERVICESCRITICAL:host4$,$TOTALHOSTSERVICESCRITICAL:host6$
max_check_attempts 3
servicegroups SG
}

output: 1,1 - wrong output, should be 1,0
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: bug in TOTALHOSTSERVICES* macros

Post by slansing »

Can you attach a copy of check_test? What information about these hosts are you trying to aggregate, we've rarely seen these macros used. :)
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: bug in TOTALHOSTSERVICES* macros

Post by abrist »

This definitely looks like a bug. I am unsure if it was fixed in core 4. I will have to test tomorrow on a core 4 box. Either way, open up a bug report at http://tracker.nagios.org to get it on the core devs radar.
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.
mendor
Posts: 3
Joined: Tue Dec 10, 2013 9:18 pm

Re: bug in TOTALHOSTSERVICES* macros

Post by mendor »

check_test right now just prints its arguments, nothing more.
The problem I'm solving is this: I have list of hosts, some of them are in load balancer, others - aren't. I'd like to issue CRITICAL alert if there is any host in load balancer(this part check_test will be testing) with 1 or more services in CRITICAL state(for this part I was going to use $TOTALHOSTSERVICESCRITICAL$ macro).

p.s. I've created bug report - http://tracker.nagios.org/view.php?id=549
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: bug in TOTALHOSTSERVICES* macros

Post by tmcdonald »

Let's see where the bug report leads and pick up from there. I will talk to abrist and see what he comes up with. He tested a few macros and they seem consistent with what you're saying.
Former Nagios employee
Locked