To remove an instance from a Nagios Log Server cluster is as simple as updating the cluster_hosts configuration file and restarting the Elasticsearch database service on each node.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform related Nagios queries.
In this context, we shall look into how to remove an instance from a Nagios Log Server cluster.
In order to remove an instance from a cluster, We suggest the following steps:
1. Stop Elasticsearch On All Instances
Initially, we establish terminal sessions to every instance in the cluster and execute:
On RHEL 7+|CentOS 7+|CentOS Stream|Debian|Ubuntu 16/18/20
# systemctl stop elasticsearch.service
2. Update Configuration File
On all instances, we will update the /usr/local/nagioslogserver/var/cluster_hosts configuration file.
To do so, we open the file cluster_hosts in any text editor:
# vi /usr/local/nagioslogserver/var/cluster_hosts
Then we delete the line that has the address of the instance we remove. If we isolate an instance, then on that server we delete all the addresses of the other instances.
Once done, we save and close the file.
3. Start Elasticsearch On All Instances
Eventually, on every instance in the cluster, we execute:
On RHEL 7+|CentOS 7+|CentOS Stream|Debian|Ubuntu 16/18/20
# systemctl start elasticsearch.service
If we isolate an instance, then we make sure to start the service on that server.
4. Verify Instances In Cluster
Once we make the changes and restart the service, we verify that everything is OK.
For that we execute the following commands on one of the instances:
# curl -XGET ‘http://localhost:9200/_cat/nodes?v’
# curl -XGET ‘http://localhost:9200/_cat/health?v’
To check the cluster status, open the Nagios Log Server web interface and navigate to Admin > System > Cluster Status.
If the instance is not able to have a copy of all the required shards, then it will be in the red state.
5. Delete Removed Instance
Finally, we delete the removed instance from the production cluster.
6. Disable Snapshots & Maintenance
In addition, we need to disable snapshots & maintenance on the isolated instance.
This article covers method to remove an instance from a Nagios Log Server cluster. Removing an instance from a Nagios Log Server cluster is as simple as updating the cluster_hosts configuration file and restarting the Elasticsearch database service on each node.
You can easily isolate an instance from the cluster for testing purposes. The instance that you want to isolate simply has it's own IP address in the cluster_hosts configuration file and none of the other instances. This means you will have two clusters that exist with the same cluster ID but they do not talk to each other. You
don't need to physically isolate this instance from the other instances on your network, the configuration file dictates who participates in the cluster.
To An Instance From A Nagios Log Server Cluster: