Filter Service notifications

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
goldmund84
Posts: 42
Joined: Mon Jan 06, 2014 6:48 am

Filter Service notifications

Post by goldmund84 »

Hello,
I would like to do some limitations on contact notification.
For example, I have Service "CPU Load" and 20 Hosts added to this Service. I've added Contact, say Admin-1, to this Service, but I want to send a notification to the Contact Admin-1 only if the alert is on the Host-1 and Host-2 (but not Host-3, etc). At the moment, Admin-1 will receive notification from each of 20 Hosts.
So is it possible, to limit notifications to certain Hosts?
I know that I can do separate Service check "CPU Load" and add to it only hosts I want, but that is not convenient.

Thanks.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Filter Service notifications

Post by rkennedy »

Just to clarify - are you looking to make it send a notification if the CPU Usage is critical on both host 1 & host 2 at the same time?

Yes, this is possible if so. It's called BPI, which allows grouping of services. Check out this document - https://assets.nagios.com/downloads/nag ... _Addon.pdf
Former Nagios Employee
goldmund84
Posts: 42
Joined: Mon Jan 06, 2014 6:48 am

Re: Filter Service notifications

Post by goldmund84 »

>>Just to clarify - are you looking to make it send a notification if the CPU Usage is critical on both host 1 & host 2 at the same time?
No, just if one of the hosts has an issue.

Thanks, I'll try the BPI solution.
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Filter Service notifications

Post by hsmith »

Let us know how BPI works out for you.
Former Nagios Employee.
me.
goldmund84
Posts: 42
Joined: Mon Jan 06, 2014 6:48 am

Re: Filter Service notifications

Post by goldmund84 »

It seems that BPI is something used for other purposes.

My situation is as following. We have a certain number of servers in our Nagios XI, they have similar Services (such as CPU Load, Memory Usage, etc).
We have one Service and several hosts added to it (with the button "Manage Hosts").

Now I'm adding a host that will be monitored by other guys (not from our company, with their own Contact e-mails). These guys will not have access to Nagios web-interface, but will just receive e-mail alerts.
The new Linux host is much similar to our existing hosts. I don't want to create new Services and tried to add this host to our existing services (with the button "Manage Hosts"). But if I add Contact e-mail of new guys to the Service (in Alert Settings -> Manage Contacts), they will receive alerts not only from the new host, but from my old hosts, and that is a problem. I have to limit in some way that they will receive only alerts for their hosts, but not ours.

Is it possible? Or it's better just to create separate Services?
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Filter Service notifications

Post by rkennedy »

Ah - I was a bit confused in your first post.

Are you using service groups to inherit who is notified? You should be able to just remove who is notified on a per service basis. Can you post one of your service definitions as an example?
Former Nagios Employee
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Filter Service notifications

Post by lmiltchev »

You could use something like this:

Code: Select all

define host {
	host_name			HostA
	contact_groups		admins
	...		
	}
	
define host {
	host_name			HostB	
	contact_groups		users	
	...
	}
	
define service {
	host_name			HostA,HostB
	service_description		myservice
	...
	}
Contacts, members of the "admins" contact group will receive notifications about "myservice" on HostA, and "users" will receive notifications about "myservice" on HostB, provided you didn't specify any contacts explicitly on a service level.

Please, review our documentation on object inheritance (implied inheritance section):

https://assets.nagios.com/downloads/nag ... tance.html
Be sure to check out our Knowledgebase for helpful articles and solutions!
goldmund84
Posts: 42
Joined: Mon Jan 06, 2014 6:48 am

Re: Filter Service notifications

Post by goldmund84 »

You could use something like this:
While using your example, I receive the following behavior: If something happens with Host, the appropriate contact receives a notification. But if Service changes its state from OK to any other, nobody receives any notification, until the contact or contact group is added to service definition or template. I should add 'contact_groups' inside service definition in order to receive notification.

The example of my service:

Code: Select all

define service {
        host_name                       colada,cortana,europe1,europe2,helpdesk,mail.com,mars.com,Mercury1,Mercury2,ns.com,pluto
        service_description             CPU Load
        use                            example-support-service
        check_command                   check_snmp_linux_load!-f -w 70 -c 80!!!!!!!
        register                        1
        }

define service {
       name                                     example-support-service
       is_volatile                              0
       max_check_attempts                       3
       check_interval                           10
       retry_interval                           2
       active_checks_enabled                    1
       passive_checks_enabled                   1
       check_period                             24x7
       parallelize_check                        1
       obsess_over_service                      1
       check_freshness                          0
       event_handler_enabled                    1
       flap_detection_enabled                   1
       process_perf_data                        1
       retain_status_information                1
       retain_nonstatus_information             1
       notification_interval                    20
       notification_period                      24x7
       notification_options                     w,c,u,r,
       notifications_enabled                    1
       contact_groups                           admins
       register                                 0

}
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Filter Service notifications

Post by rkennedy »

Yes, that will add notifications for the services.
Former Nagios Employee
Locked