Since the upgrade to version 3.2.2 Nagios does not update the host alias macro when the configuration is reloaded. Macros are the variables used in commands, such as notification commands, i.e. the information you receive via E-mail when there is a problem with your hosts or services.

As long as you don’t change your host alias information you will never notice. I did change it and I found myself scratching my head for some time, especially since the same information does get updated in the web interface.

I found a greater number of forum discussions relating to this, but none seemed to offer a practical solution for larger scale environments.

Update: Here’s a brief summary of the error and what the script does to work around it.

When Nagios parses the configuration and finds a new host it loads the alias field into memory. When Nagios reloads the configuration, the alias information that is already in memory does not get updated. When Nagios stops (or before reloading the configuration) the alias information in memory is dumped to the retention.dat file. When Nagios isn’t running and you start the service, it doesn’t load the alias information from the configuration files but from retention.dat, unless that information is not present in the file. So my solution does the following:

Stop Nagios

Make a backup copy of the retention.dat file (Note: I’m copying the file instead of renaming it to make sure that it will still have the same owner/group and permissions when I write to the original file in the next step)

Strip all lines starting with “alias” from the backup file and overwrite the original retention.dat file with this data

Start Nagios

You may have to tweak the file location for the retention.dat and backup files. You may also need to change the commands that stop and start the Nagios deamon.

Links

This blog is about Information Technology (technical) issues, tips and tricks I find worth sharing with the world. It’s also the home base for all of my open source projects. If you want to support me financially, please go to the Donations page. For moral support please leave a comment, or follow me on Twitter or Facebook: