Nagios is an open source monitoring system for computer systems. It was designed to run on the Linux operating system and can monitor devices running Linux, Windows and Unix operating systems (OSes).
Nagios software runs periodic checks on critical parameters of application, network and server resources.
Nagios migration to a new Linux server involves transferring all the existing data, defined hosts, services, email alert scripts, and Pnp4nagios data.
After the migration, we need to update/add the clients with the IP of the new server, so that both Nagios get alerts.
Finally, once we are comfortable with a new migration, we can decommission the old one.
In this context, we shall look into steps to migrate the Nagios tool to another server.
Nagios migration to new Linux server
Usually, many customers approach us to migrate the Nagios from one Linux server to another Linux server.
Now let's see how our Support Experts help the customers to migrate Nagios to a new Linux server.
1. First, we install fresh CentOS Linux on a new server and configure the required services.
2. After that, we proceed with the installation of Nagios Core and its dependencies.
We also ensure that Nagios Core is running.
3. Thereafter, we proceed with transferring configuration files of Nagios. It mainly includes Nagios configuration files and Nagios Apache configuration files.
Nagios configuration files in Linux server
Main configuration files: $NAGIOS_HOME/etc/*.cfg
Host and services configuration files: $NAGIOS_HOME/etc/objects/*.cfg
Alert scripts: (if any customized email alerts b – for alert scripts used check-in commands.cfg and search for notification commands)
Here is the command that we run to transfer Nagios configuration files to the new server.
[email@example.com ~]# scp /usr/local/nagios/etc/*.cfg testserver:/usr/local/nagios/etc/
[firstname.lastname@example.org ~]# scp /usr/local/nagios/etc/objects/*.cfg testserver:/usr/local/nagios/etc/objects/
Nagios Apache configuration in Linux server
HTTP configuration file: /etc/httpd/conf.d/nagios.conf .
Here is the command that we run to transfer Nagios Apache configuration files to the new server.
[email@example.com ~]# scp /etc/httpd/conf.d/nagios.conf testserver:/etc/httpd/conf.d/
4. Then we check whether the Nagios configuration is proper or not, by running the below command.
[root@testserver ~]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
If the prompt then ends with the following, then it indicates that the migration is proper.
Total Warnings: 0
Total Errors: 0
5. If there is any Pnp4nagios data migration, we will assist you. PNP4Nagios is one such external program in which Nagios pass the performance data to an external program that can store that data for later analysis as Nagios Core does not have its own performance data engine built in to process this performance data.
6. Then we change the IP address configuration of both servers.
For the newly installed and configured Nagios Linux server, we give the address of the old Nagios server and vice versa!
7. Finally, we reboot both machines and ensure the new Nagios server is working well.