
Monitoring a cluster from Centreon
Surely more than one of us has some service in clustering, but, How do we monitor this with Centreon?? That is, Know that the cluster offers its service because its members offer it.
What I said, It may be common, depending on our infrastructure, to have highly available or balanced services, we are talking about Active/Active or Active/Passive clusters. In the case of Active/Active, As we know, all the members of the cluster offer their service, and in the case of Assets/Liabilities, All member nodes are usually stopped except for one. Asset/Asset are preferable as it balances and leverages resources versus Asset/Passive, which in addition, sometimes the latter give surprises, because until their services are lifted you don't know if they are going to work.
Total, In this document we are going to see how to monitor that the health of the cluster is good or bad depending on its members and the status of their services. Thanks to the 'check_cluster script’ we will be able to check the status of Member Hosts or Services.
To nougat! How to monitor this with Centreon… Let's take a simple example, a WEB1 server, a WEB2, WEB3… they are all machines that offer the same website, by HTTPS. Well, Well, first it will be to have them monitored as usual: Individual Each Host, with your Services… and then we can start with this 🙂
Before anything, We install the script we are going to need:
yum install nagios-plugins-cluster.x86_64 -y
And we're going straight to create the Command. We're not going to go down to shell yet, today it is not necessary. “Configuration” > “Commands” > “Check” > “Create” And we'll create two. One to check member services (of the cluster), and the other for member hosts (of the cluster):
- Name: check_cluster_servicios
- Command: /usr/lib64/nagios/plugins/check_cluster –Service -L $ARG 1$ -W $ARG 2$ -C $ARG 3$ -D $ARG 4$
- check_cluster_hosts
- Command: /usr/lib64/nagios/plugins/check_cluster –host -l $ARG 1$ -w $ARG 2$ -c $ARG 3$ -d $ARG 4$
The arguments will be:
- ARG1 : It will be the description of the service that we will see later in GUI.
- ARG2 : The number of downed member services that will alert us as Warning.
- ARG3 : The number of downed member services that will alert us as Critical.
- ARG4 : Here comes the sauce of this command! We discuss it below.
The next thing will be to create a Service to monitor the cluster, for example, if the certificate is well installed by all its members. We create the service, We associate it as always with a template, and the newly created command.
The arguments of Warning and Critical will depend on how many down services/hosts we want to allow to alert us.
The last argument, It's the interesting one, It will be a list of services or equipment to be controlled. We have to link the Member Services to be checked in the following format: $SERVICESTATEID:WEB1:HTTPS$.$SERVICESTATEID certified:WEB2:HTTPS$.$SERVICESTATEID certified:WEB3:HTTPS$ Certificate. As you can see it uses Centreon variables, So from the shell (still) There is little we can do (and it is not necessary). In the case of wanting to monitor the member Hosts, The argument will then be filled in with this format: $HOSTSTATEID:WEB1$,$HOSTSTATEID:WEB2$.$HOSTSTATEID:WEB3$
Note: At the end with the variables of $SERVICESTATEID: or $HOSTSTATEID what we will get will be the current state of that Service or Host, that is, one 0 Yes, it's OK, 1 If it's WARNING, 2 If it's CRITICAL…
And after creating the services offered by the cluster, we would be left with something like this. In the example we see, it would be an Active/Passive cluster, where despite the fact that one of the member nodes has fallen services, The cluster is not affected, therefore your health and that of your services is OK.
Well, that it had been a long time since I put something by Centreon, I hope you found it interesting and it is a way to control clusters or other types of combinations that we need, Dependencies between machines for a service to be active…
Have a fat hug and may the week go very very well, Care!