Are you running out of disk space on the Nagios? Take a peek at this blog to tackle it.
Here at Bobcares, we have seen several such Nagios-related errors as part of our Server Management Services for web hosts and online service providers.
Today we’ll take a look at how to fix this Nagios disk space problem.
What causes running out of disk space on the Nagios problem to arise
Before we get into the solution part of this problem, let’s first see the different causes.
Here are the reasons for this error to occur.
- Increasing the number of hosts/services has consumed more disk space
- Large number of backups
- Large log files
Moreover, running out of HDD space on the Nagios XI server can create a large number of problems. The problems include disrupted monitoring, data loss, database corruption, inability to log in to the web interface, and so on.
How we resolve ‘running out of disk space on the Nagios’ problem
Now let’s take a look at how our Support Engineers resolve this error.
We always suggest planning ahead and set up the environment in a way that allows for some growth.
Also, it is better to backup the Nagios XI instance. But if we are saving them locally and do not have a large enough hard drive, we can run out of space very fast.
By default, the backups are stored in /store/backups/nagiosxi/ directory. It is a good practice to keep an eye on this folder and remove the old backups that we do not need.
Also, there are some MySQL and postgres backups in /store/backups/mysql/ and /store/backups/postgresql/ directories. Generally, these are created on daily, monthly, and weekly basis by the /root/scripts/automysqlbackup and /root/scripts/autopostgresqlbackup script.
Both these scripts are run on a cron job. Here is the command we run to view the crontab:
The /store/backups/mysql/ and /store/backups/postgresql/ directories can also grow quite large. If we need to clear some HHD space we could delete some of the old backups that are no longer needed.
We can disable these two cron jobs if we wish. For that, we just comment them out as below.
# 0 7 * * * root /root/scripts/automysqlbackup # 0 8 * * * root /root/scripts/autopostgresqlbackup
In case, if we’ve poorly configured the checks, system issues, debugging enabled, etc then the log files can grow out of control. So, we temporarily clear some space by deleting old logs that we might not need.
We run the below command to view the 10 largest files under /var/log/ directory.
du -a /var/log | sort -n -r | head -n 10
Another option is to add another disk and move the existing data to that location.
Additionally, we can delete some old nagios log files from the /usr/local/nagios/var/archives/ directory, if we don’t need the historical data.
After clearing some space, we will need to resize the virtual machine.
[Need any further assistance in fixing Nagios disk problems? – We are here to help you]
Today, we saw how our Support Engineers resolve this Nagios error and provide a solution to our customers.