Proper way to exclude service from sending notifications.

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
tman77
Posts: 4
Joined: Wed Nov 06, 2019 5:30 pm

Proper way to exclude service from sending notifications.

Post by tman77 »

I have a service check for rabbitmq that checks the queue length.

Its currently failing on a few servers, due to the version of a python module installed on the remote host.
However, these servers are due to be upgraded in a couple of weeks, so for now I'd just like to prevent the unknown alerts for this service from being sent. Below are the service and service escalation definitions.

I tried to just exclude a couple of the affected hosts in the service definition.

However, when I do that, I get back the following error...
Error: Could not find a service matching host name 'hosta' and description 'Service: Rabbitmq Queue Count' (config file '/usr/local/nagios/etc/objects/service_escalations.cfg'

Code: Select all

define service {
        use                   generic-service
        hostgroup_name        web_servers_vpc
        host_name             !hosta, !hostb
        service_description   Service: Rabbitmq Queue Count
        check_command         check_nrpe_1arg!check_rabbitmq_queue_count
}

define serviceescalation {
        hostgroup_name         web_servers_vpc
        service_description    Service: Rabbitmq Queue Count
        contact_groups         Admins
        first_notification     1
        last_notification      0
        notification_interval  60
}
Is there a simple way to exclude a host in the config files so a particular service wont be checked?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Proper way to exclude service from sending notifications

Post by scottwilkerson »

I would return the config to how it was, then in the UI got to the service status detail page for
hosta -> Service: Rabbitmq Queue Count

Under "Service Commands" section click "Disable active checks of this service"

do the same for
hostb -> Service: Rabbitmq Queue Count

When these are resolved, go back to the same pages and click "Enable active checks of this service"
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
tman77
Posts: 4
Joined: Wed Nov 06, 2019 5:30 pm

Re: Proper way to exclude service from sending notifications

Post by tman77 »

Thanks Scott.

I thought of doing exactly that, but I wanted to understand if there was a way of being able to accomplish same/similar via adjusting the configs.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Proper way to exclude service from sending notifications

Post by scottwilkerson »

There would be if you didn't have the hostgroup assigned to the service and the same with the escalation.

When you Negated to hosts on the service config it actually removed the services completely, the problem is that you didn't negate them in the escalation ans as such the escalation is expanding the hostgroup/service combination and it included the 2 host/service combinations that no longer exist because you removed them from the service definition.
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
tman77
Posts: 4
Joined: Wed Nov 06, 2019 5:30 pm

Re: Proper way to exclude service from sending notifications

Post by tman77 »

Oh I see, so, could I either...
remove the hostgroup designation and just specify hosts, or also negate those hosts in the service escalation, and it wont exapnd them?
tman77
Posts: 4
Joined: Wed Nov 06, 2019 5:30 pm

Re: Proper way to exclude service from sending notifications

Post by tman77 »

Yep, negating specific hosts in both service definition and service_escalations definition worked. That was easy, I should have thought of that from start, thanks for pointing that out.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Proper way to exclude service from sending notifications

Post by scottwilkerson »

tman77 wrote:Yep, negating specific hosts in both service definition and service_escalations definition worked. That was easy, I should have thought of that from start, thanks for pointing that out.
Glad it is resolved!

Locking thread
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked