×


Modify Data Store Path in Nagios Log Server

Need to modify the Data Store Path in Nagios Log Server?


This guide is for you.


By default, there in no database that Nagios stores it's data. it is a flat file. You could add the ndoutils plugin and configure a mysql database.

Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform Nagios related tasks.

In this context, we shall look into how to Change Data Store Path in Nagios Log Server.


How to Modify Data Store Path in Nagios Log Server?

Here, we will go through the process to change the data store path from its default location in Nagios Log Server.

Nagios Log Server allows us to set the data path in which we like to store the data.


The default location is /usr/local/nagioslogserver/elasticsearch/data/, however we can change the path as per our requirement.


Follow the steps given below to implement this;


1. Stopping Elasticsearch

First, we need to stop elasticsearch service in this instance.

Open a terminal session to Nagios Log Server instance and execute the command given below:


For RHEL 6|CentOS 6|Oracle Linux 6|Ubuntu 14, execute;

service elasticsearch stop

For RHEL 7|CentOS 7|Oracle Linux 7|Debian|Ubuntu 16/18, run the command;

systemctl stop elasticsearch.service

2. Then configure New Path Permissions

Here you have to give the accurate ownership and permissions to the path.

In this instance, we are using /new/path/data as the new location. So run the commands;

chown -R nagios:nagios /new/path/data
chmod -R 0775 /new/path/data

3. After that Change the Path

For changing the configuration to point Nagios Log Server to the new data path.

First, open the file /etc/sysconfig/elasticsearch using vi editor:


For RHEL|CentOS|Oracle Linux System, execute;

vi /etc/sysconfig/elasticsearch

For Debian|Ubuntu, run;

vi /etc/default/elasticsearch

4. Then locate the directive ‘DATA_DIR’ in the file

DATA_DIR="$ES_HOME/data"

5. After that we can modify it to the new path:

DATA_DIR="/new/path/data"

6. Then we can save the file and exit vi.


7. Now move the Existing Data.


To move the data from the old path we can use the following command:

mv /usr/local/nagioslogserver/elasticsearch/data/* /new/path/data/

8. Start Elasticsearch

We can start elasticsearch service with the following command:


RHEL 6|CentOS 6|Oracle Linux 6|Ubuntu 14

service elasticsearch start

RHEL 7|CentOS 7|Oracle Linux 7|Debian|Ubuntu 16/18

systemctl start elasticsearch.service

We can then log into Nagios Log Server to check if everything is correctly functioning.


[Need assistance with Server Monitoring tasks? We can help you!]


Conclusion

This article will guide you on the process to modify the data #storage location in a #Nagios #Log #Server.

The Nagios Core log, includes checks, notifications, external #commands, and events. This file is rotated daily into the /usr/local/nagios/var/archives folder by default setting in nagios.

Changing Data Path In Nagios Log Server involves: 

DATA_DIR="$ES_HOME/data" Modify it to the new path you would like to use: DATA_DIR="/new/path/data" Save the file and exit vi. The time it takes to move your existing data will vary depending on how much data there is and the speed of the source and destination #paths.