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.
What triggers "Nagios error: unable to open include file"?
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.
How to solve "Nagios error: unable to open include file"?
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;
rm -rf nagiosxi xi*.tar.gz
tar xzf xi-latest.tar.gz
tar xzf mrtg*.tar.gz
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.