Wondering how to fix the ‘Nagios error: unable to open include file’? We can help you with 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 the causes for this error and see the fix.
What causes ‘Nagios error: unable to open include file’ to occur
Before we get into the solution part, let’s see the causes of this error.
1. The main cause is that the MRTG version is too old and needs to be updated.
2. Having 1000+ cfg files in the /etc/mrtg/conf.d/ directory. Because when MRTG runs it has to open all the files and it hits the open file limits in Linux.
How we fix ‘Nagios error: unable to open include file’
Now let us take a look at how our Support Engineers resolve this error message.
1. Since the main reason for this error is the outdated MRTG version. So here are the steps to update it.
First, establish an SSH session to your Nagios XI server and run the below commands.
cd /tmp
rm -rf nagiosxi xi*.tar.gz
wget http://assets.nagios.com/downloads/nagiosxi/xi-latest.tar.gz
tar xzf xi-latest.tar.gz
cd /tmp/nagiosxi/subcomponents/mrtg/
tar xzf mrtg*.tar.gz
cd mrtg*
./configure –prefix=’/usr’
make all
make install
Now, the correct version of MRTG must be installed. You can check the version by running the below command
LANG=C LC_ALL=C /usr/bin/mrtg
Ensure that the version in the output must be 2.17.4 or greater.
Moreover, running MRTG manually must fix the “ERROR: unable to open include file: conf.d/*.cfg” message:
LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg
After running the above command, it will at least take 15 minutes for the bandwidth graphs to start showing data.
2. Here are the steps to increase the open file limits for the default value of 1024 to 4096.
First, establish an SSH session to your Nagios XI server. Then edit the configuration file /etc/security/limits.conf
Now add the below lines to the end of the file.
* soft nofile 10000 * hard nofile 10000
After adding the contents, save the file.
Now running MRTG manually should no longer throw the “ERROR: unable to open include file: /etc/mrtg/conf.d/xxxxxxx.cfg” message.
LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg
In case, if the error persists then you can try rebooting the server and try running MRTG again. It will take up to 15 minutes for the bandwidth graphs to start showing data.
[Need any further assistance in fixing Nagios errors? – We are here to help you]
Conclusion
In short, this error occurs if the MRTG version is too old or having 1000+ cfg files in the /etc/mrtg/conf.d/ directory. Today, we saw the solution provided by our Support Engineers.
0 Comments