Page 1 of 1

1 Service check to monitor in 2 hosts

Posted: Tue Oct 11, 2016 12:38 am
by gsl_ops_practice
Hi, we need to monitor a particular service in 2 hosts.
If the service ( process check or other checks) is running in either host1 or host2 , then nagios service check should return OK status.
If the service ( process check or other checks) is NOT running on both the hosts, then the service should through a CRITICAL alert.

Is there any way to configure above requirement ?
Do we need to use clustering of service, if yes, can you please share the docs ?

I tried to create a host with common name and added 2 hosts in address field , but it throwed an Invalid hostname/address error.

hosts/ XXXX_YYY_host_check.cfg file :

define host {
host_name XXXX_YYY_host_check
use xiwizard_linuxserver_host
address host1 / host2
max_check_attempts 5
check_interval 5
retry_interval 1
check_period xi_timeperiod_24x7
contact_groups xi_contactgroup_all
notification_interval 60
notification_period xi_timeperiod_24x7
notifications_enabled 1
icon_image redhat.png
statusmap_image redhat.png
_xiwizard sshproxy
register 1
}


Service.cfg file

define service {
host_name XXXX_YYY_host_check
service_description Process - XXX_YYY
use generic-service
check_command check_xi_by_ssh! -C "/usr/local/nagios/libexec/check_services -p abc" -l test -q!!!!!!!
max_check_attempts 5
check_interval 5
retry_interval 1
check_period xi_timeperiod_24x7
notification_interval 10
notification_period xi_timeperiod_24x7
notifications_enabled 1
contact_groups xi_contactgroup_all
_xiwizard sshproxy
register 1
}

Re: 1 Service check to monitor in 2 hosts

Posted: Tue Oct 11, 2016 9:31 am
by bwallace
There is a built in tool in XI called 'BPI" - using this, you can group together as many hosts / services as you like and configure a threshold for the group. Refer to this doc:
https://assets.nagios.com/downloads/nag ... BPI_v2.pdf

Re: 1 Service check to monitor in 2 hosts

Posted: Mon Oct 17, 2016 3:42 pm
by gsl_ops_practice
Thank you, we are looking into the BPI tool now to see how get it to do what we need.

One issue we ran into - the SNMP Trap sender. Even if the notifications for a service are disabled, an SNMP trap still gets sent out into the global monitoring view tool. The only way to prevent this from happening is to have the original service in Scheduled Downtime mode, which is not really a viable long-term solution.

With BPI, we will see the correct status in NagiosXI, but how would we go about not sending SNMP traps for all the events that make up the final BPI group status?

Thanks.

Re: 1 Service check to monitor in 2 hosts

Posted: Mon Oct 17, 2016 4:59 pm
by ssax
You may be able to do it by passing in if the host/service has notifications disabled, would that work for you? It would require a little modification to the snmptrapsender component and the command but should be doable.

Re: 1 Service check to monitor in 2 hosts

Posted: Tue Oct 18, 2016 10:17 am
by gsl_ops_practice
Thanks for that.

Can you please advise how we may be able to modify the snmp trap sender component? In the Admin page there are no configurable options except sending events during downtime.

Re: 1 Service check to monitor in 2 hosts

Posted: Tue Oct 18, 2016 2:25 pm
by gsl_ops_practice
I have now successfully set up the BPI to show green if one of the two hosts has the correct processes running. Your help in disabling notifications in the SNMP Trap sender for the components of the BPI checks will be very much appreciated.

Re: 1 Service check to monitor in 2 hosts

Posted: Tue Oct 18, 2016 3:29 pm
by avandemore
Does this document answer your questions? Using Nagios BPI

Re: 1 Service check to monitor in 2 hosts

Posted: Tue Oct 18, 2016 3:59 pm
by gsl_ops_practice
This document does not address my issue at all; however, I tested and came up with a working solution - set all service checks that make up the BPI group to 10 years of scheduled maintenance.

BPI doesn't seem to care if a check in scheduled maintenance or not, so I was able to get the behavior I need (not sending SNMP traps for every status change of individual checks that make up the BPI groups).

Kindly consider this issue resolved.

Re: 1 Service check to monitor in 2 hosts

Posted: Tue Oct 18, 2016 4:03 pm
by dwhitfield
Glad to hear it is resolved. I am going to lock the thread. Please feel free to post again if you have you another issue. Thank you for using the Nagios forums!