Are you trying to find solution to "Nagios error: unable to open include file"? This guide will help you out.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to solve Nagios related errors.
In this context, we shall look into what triggers this error and how to get rid of it.
Different factors generally triggers this error such as;
i. This error occurs when the you are using an older version of MRTG which needs to be updated.
ii. When you have large cfg files (1000+) in the " /etc/mrtg/conf.d/" directory. In the process of opening all the files when MRTG runs, the file limits will be exceeded.
The main reason why this error occurs is due to using an outdated MRTG version. To fix this issue, you need to update it to the newer version.
Start by establishing a connection to your Nagios XI server via an ssh tool such as putty and once logged in, run the following 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
This will install the current version of MRTG. To check the version installed, run the command below;
LANG=C LC_ALL=C /usr/bin/mrtg
Additionally, you can also run MRTG manually to fix this "ERROR: unable to open include file: conf.d/*.cfg" error message. To do this, execute the command below;
LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg
As soon as you run this command, it will take about 15 minutes for the bandwidth graphs to start showing data.
In a case where you need to increase the open file limits for the default value of 1024 to 4096, follow the steps below;
Start by establishing a connection to the Nagios XI server via an ssh tool such as putty. Once logged in, you can modify the "/etc/security/limits.conf" configuration file and add the following lines to the bottom of this file as shown below;
* soft nofile 10000
* hard nofile 10000
Then save the file.
Next time you run MRTG manually, the error "ERROR: unable to open include file: /etc/mrtg/conf.d/xxxxxxx.cfg" message will not show anymore.
Should this error persist, 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.
This guide will help to fix "Nagios error: unable to open include file: conf.d/*.cfg" which occurs when the MRTG version is too old or having 1000+ cfg files in the /etc/mrtg/conf.d/ directory.