ERROR: CHECK_SVN - Error Connecting

Summary

The "check_svn" plugin worked from the command line.  However when I attempted to configure the Nagios check, an error occurred.

Ref: http://www.nagiosexchange.org/cgi-bin/page.cgi?g=Detailed%2F1554.html;d=1

SVN CRITICAL: Error connecting to svn server - Can't open file '/root/.subversion/servers': Permission denied .

Solutions

Apparently this is caused by nagios environment issue.  The nagiosexchange page recommends one solution.  Alternatively you can modify the check_svn script.

  1. Edit the command line in the nagios commands.cfg file to export the HOME variable:
    command_line export HOME=/home/nagios && $USER1$/check_svn
  2. Edit the "check_svn" check script to pass a command line variable
    Add a variable like:  self.confdir    = "/home/nagios"
    and edit "cmd" line the script builds after the if statements for username/password:
            if self.confdir:
                cmd += " --config-dir=%s" % self.confdir

All should work well now.  I also make sure to use the "-T" option to output the test execution time which I can now graph with nagiosgraph.