ClusterGroup Confusion

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.
nickanderson1982
Posts: 72
Joined: Wed Feb 06, 2019 3:22 pm

ClusterGroup Confusion

Post 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.
nickanderson1982
Posts: 72
Joined: Wed Feb 06, 2019 3:22 pm

Re: ClusterGroup Confusion

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: ClusterGroup Confusion

Post 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
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
nickanderson1982
Posts: 72
Joined: Wed Feb 06, 2019 3:22 pm

Re: ClusterGroup Confusion

Post 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.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: ClusterGroup Confusion

Post by scottwilkerson »

Lets step back, are you currently monitoring these services individually?
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
nickanderson1982
Posts: 72
Joined: Wed Feb 06, 2019 3:22 pm

Re: ClusterGroup Confusion

Post 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)
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: ClusterGroup Confusion

Post 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$
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
nickanderson1982
Posts: 72
Joined: Wed Feb 06, 2019 3:22 pm

Re: ClusterGroup Confusion

Post by nickanderson1982 »

So I can just name it anything right? Then what would I put for the addresses?
nickanderson1982
Posts: 72
Joined: Wed Feb 06, 2019 3:22 pm

Re: ClusterGroup Confusion

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: ClusterGroup Confusion

Post 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
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked