Bobcares

Nagios Failover

by | Nov 17, 2022

Let us take a closer look at the Nagios failover. With the support of our Server management support services, we can give you a detailed overview of the setup process.

 

Nagios failover

nagios failover

Nagios servers will automatically failover if and when they go down due to a bash script. But getting there will need some planning. Here the goal is to have each Nagios server watch out for the others.

 

We can also do the following:

nagios failover

 

Requirements

Actual nagios cfg files –

 

CMS: Configuration Management System – puppet,chef or cfengine

 

Here, we can send all of the real cfg files to the Nagios nodes using puppet and the recursive folder plugin:   

nagios failover

We could set up this script to leverage existing Unison to synchronize settings across the nodes if we don’t already have a CMS in place. simply by adding the business folder to the sync folder variable as a space-separated list.            

 

Unison configuration for Nagios failover

Bypassing all of the CMS restrictions, we could use the unison protocol and add /usr/local/nagios/etc/objects/$company as a folder to synchronize it. We would have to relocate: 

nagios failover

to

 

Additionally, alter the reference in nagios.cfg as appropriate. Update the script and place the $company variable below the sync path variable:

 

SYNC_PATH="/opt/nagios-sync /usr/local/nagios/etc/objects/$company"

 

We presently have two data centers: inside: files/company and outside:

 

And this will continue. The following path is set up on the Nagios 3.5 servers:

 

Nagios server 1

Then, each Nagios server will do a recursive read of all the files present in each data center’s subfolders. Following this process will simplify the scripting of this solution and the definition of each configuration file, among other things.

In other words, all Nagios hosts have all the configurations, so once we have the puppet pushing them out, we only need to load the correct data center folder for the things we want it to monitor:

Unison protocol to synchronize amongst Nagios hosts 

This is the next step in Nagios failover setup:

 

yum install unison or apt-get install unison

A shared folder amongst all Nagios servers. In the script we can define the /opt/Nagios-sync:
 
 

 

ssh-keygen and ssh-copy-id across all Nagios hosts so that the Nagios user may ssh from any Nagios host to any other without a password.

On all hosts, we will need to add: under the primary configuration loading up current data centres to /etc/nagios/nagios.cfg. This is enough for the initial setup.

Now refer to the script. In summary, there are a lot of things to set up to get this all working. Once the step in complete, it will operate flawlessly. It will work regardless of how many the monitoring size of the  Nagios servers.

Requirements:

The following are the requirements for Nagios failover:

  1. SSH passwordless login using Nagios account across Nagios servers.
     
  2. The unison protocol can synchronize within the script.
     
  3. Modify Nagios configuration setup by CMS and that there is preferably only one line in nagios.cfg. This file contains the datacenter name and loads up all essential configurations for that site.
     
  4. # AUTOMATION ADD HERE should be added to nagios.cfg behind the main configuration line mentioned in point 3.
     
  5. /opt/nagios-sync as a folder that uses unison to synchronize all Nagios server nodes (all done within script).
[Need assistance with similar queries? We are here to help]

 

Conclusion

To sum up, we have now completed the Nagios Failover. We completed all of the setup stages with the assistance of our Server management support services.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

     

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.