Subversion

Configurations are saved to a subversion repository when a configuration is successfully applied, so the repository only contains valid configurations.

Reverting to a previous configuration is not possible using the REST interface or the Web interface, although this feature is planned for inclusion, but it is possible using the command line.

Overview

The following are steps required to revert to a previous configuration:

  1. Check out the repository.
  2. Locate the revision to revert to.
  3. Check out that revision.
  4. Lock REST access.
  5. Copy the reverted configuration.
  6. Unlock REST access.
  7. Verify the new configuration in the Nagrestconf Web interface.
  8. Apply the configuration.

Example

This example assumes that the environment is named 'local' and the nagios configuration directory is in /etc/nagios.

NOTE that the repository should only be changed on the slave node for distributed environments.

Log into the nagios server then,

Check out the repository.

cd
svn co file:///etc/nagios/repos/local

Locate the revision to revert to.

cd local/
svn log | less

Only choose revisions with the comment, 'Changes saved'.

View the differences with svn diff -r REVISION.

Check out that revision.

svn up -r REVISION

Lock REST access.

lockfile -! -1 -r 120 /etc/nagios/objects/local/setup/directory.lock

The Web interface should now be completely unresposive when the page is refreshed. If the Web interface still works then check the path in the previous command.

Copy the reverted configuration.

List the directory contents before copying and ensure the permissions remain the same.

ls -l /etc/nagios/objects/local/setup/
cp *.setup /etc/nagios/objects/local/setup/
ls -l /etc/nagios/objects/local/setup/

Unlock REST access.

rm /etc/nagios/objects/local/setup/directory.lock

Verify the new configuration in the Nagrestconf Web interface.

The Nagrestconf Web interface will be responsive again. Visually check the configuration.

Apply the configuration.

Either 'Revert Changes', to back out, or 'Apply Changes' to accept the new configuration