Page 1 of 2
ClusterGroup Confusion
Posted: Wed Jul 17, 2019 11:34 am
by nickanderson1982
I have two servers that have the same services running. But the service only runs on one server at a time. I was trying to use cluster services but I am not sure how to apply it.
https://assets.nagios.com/downloads/nag ... sters.html
I can't figure out how to apply this. Can you give me a write up that explain how to poll for 1 service on 2 servers. I need it to detect if it is active on one server or the other.
I can give you all my information through private message if need be.
Re: ClusterGroup Confusion
Posted: Wed Jul 17, 2019 3:48 pm
by nickanderson1982
Monitor
Host1 Host2
- -
Service A running Service A manual
I need the check to monitor the service on both servers. So when we fail the service over it wouldn't flag due to it constantly running on either server. But it would flag if it failed on both servers.
I can't come up with the configuration based off that website link supplied
Re: ClusterGroup Confusion
Posted: Thu Jul 18, 2019 2:26 pm
by scottwilkerson
Per the doc, you need to already be monitoring the services (you may choose to not alert on them), then you would setup a new service with the following
Code: Select all
define service {
...
check_command check_service_cluster!"DNS Cluster"!1!1!$SERVICESTATEID:host1:DNS Service$,$SERVICESTATEID:host2:DNS Service$,$SERVICESTATEID:host2:DNS Service$
}
You would replace the following with your host:service
Code: Select all
host1:DNS Service
host2:DNS Service
I set the warning and critical levels both to 1 as you need to surpass 1 to trigger a warning or critical
The command would translate to the following if both were in a warning state
Code: Select all
[root@localhost ~]#/usr/local/nagios/libexec/check_cluster -l "DNS Cluster" -w 1 -c 1 -d 1,1
CLUSTER CRITICAL: DNS Cluster: 0 ok, 2 warning, 0 unknown, 0 critical
[root@localhost ~]# echo $?
2
Re: ClusterGroup Confusion
Posted: Thu Jul 18, 2019 3:08 pm
by nickanderson1982
Before I do that don't I need to create a new cfg file?
API_Servers.cfg
But then for define host do I add two servers? How would I do that in the cfg?
Example:
define host {
host_name 990-APIA-1, 991-APIA-1
address 172.24.32.98, 172.24.32.99
I'm confused on this.
Re: ClusterGroup Confusion
Posted: Thu Jul 18, 2019 3:35 pm
by scottwilkerson
Lets step back, are you currently monitoring these services individually?
Re: ClusterGroup Confusion
Posted: Thu Jul 18, 2019 3:38 pm
by nickanderson1982
Yes.
APIA-A
Services are running and being monitored
APIA-B
Services set to manual and being monitored
Alarms are flagging on APIA-B, Notifications set to off.
(If I move services to the other server then you would flip flop the setup)
Re: ClusterGroup Confusion
Posted: Thu Jul 18, 2019 3:54 pm
by scottwilkerson
You would have to have a host configured that you would store the newly created cluster services.
We will call this clusterhost
then you would create a service configuration for each of the cluster services, and in that the check_command would look like the following if the services were called "DNS Service"
Code: Select all
check_command check_service_cluster!"DNS Cluster"!1!1!$SERVICESTATEID:APIA-A:DNS Service$,$SERVICESTATEID:APIA-B:DNS Service$,$SERVICESTATEID:host2:DNS Service$
Re: ClusterGroup Confusion
Posted: Thu Jul 18, 2019 4:13 pm
by nickanderson1982
So I can just name it anything right? Then what would I put for the addresses?
Re: ClusterGroup Confusion
Posted: Thu Jul 18, 2019 4:15 pm
by nickanderson1982
Basically, how would I set it up to include two or more hosts?
define host {
host_name APIA-1
address 172.24.32.98
check_command check_ncpa!-t xxxxxx -P 5693 -M system/agent_version
max_check_attempts 5
check_interval 5
retry_interval 1
check_period 24x7
contact_groups admins
notification_interval 60
notification_period 24x7
notifications_enabled 1
icon_image ncpa.png
statusmap_image ncpa.png
register 1
Re: ClusterGroup Confusion
Posted: Thu Jul 18, 2019 4:56 pm
by scottwilkerson
nickanderson1982 wrote:So I can just name it anything right? Then what would I put for the addresses?
anything
nickanderson1982 wrote:Basically, how would I set it up to include two or more hosts?
define host {
host_name APIA-1
address 172.24.32.98
check_command check_ncpa!-t xxxxxx -P 5693 -M system/agent_version
max_check_attempts 5
check_interval 5
retry_interval 1
check_period 24x7
contact_groups admins
notification_interval 60
notification_period 24x7
notifications_enabled 1
icon_image ncpa.png
statusmap_image ncpa.png
register 1
I thought you wanted to check services?
See the Monitoring Service Clusters section in
https://assets.nagios.com/downloads/nag ... sters.html