4.10. Using samhain with nagios

After running ./configure, you will find the script check_samhain.pl in the subdirectory scripts/ of the samhain distribution. The following recipe to use this script has been kindly provided by kiarna:

Nagios runs as user 'nagios'. However, in order to check the filesystem, you typically want to run samhain as 'root'. You can use sudo to fix this problem. In your /etc/sudoers file, add the line:

 
nagios ALL = NOPASSWD:/path/to/check_samhain

Next, add the service to the nagios file checkcommands.cfg:

 
# 'check_samhain' command definition
define command{
command_name check_samhain
command_line /usr/bin/sudo -u root $USER1$/check_samhain -t 100
}

Checking the filesystem may take some time, so you may want to increase the nagios plugin timeout by changing the following line in nagios.cfg from 60 to 100:

 
service_check_timeout=100

Then add the service to the appropriate section in the nagios service.cfg file.