[TriLUG] nagios plugins
Clay Stuckey
claystuckey at gmail.com
Wed May 19 14:37:28 EDT 2010
I have been a longtime Big Brother user. I recently decided to convert over
to Nagios. I have a question. I developed a simple nagios plugin. I am
wanting to use it to perform a test on a remote server. When the check runs,
the test is performed locally on my nagios server. how do I make it run
remotely. Here are the cfg snippets:
PLUGIN:
#!/bin/bash
# Clay Stuckey 5/18/2010
# test plugin for Nagios
# 0=OK, 1=Warning, 2=Critical, 3=Unknown
result=""
# test for nfs mount
mt=`mount |grep /sharedvolume` # is /sharedvolume mounted?
if [ -z "$mt" ];then
sudo mount /sharedvolume 2>> /tmp/naglog #
mt=`mount |grep /sharedvolume` # is /sharedvolume mounted?
if [ -z "$mt" ];then
echo "/sharedvolume is unmountable - $mt"
exit 2
else
echo "/sharedvolume mounted"
exit 1
fi
else
echo $mt
exit 0
fi
from commands.cfg:
define command{
command_name check_sharedvolume
command_line $USER1$/check_sharedvolume
}
from servers.cfg:
define host{
use linux-server
host_name server1
alias server1
address 192.168.1.4
}
define service{
use test-service
host_name server1 # I though this was the part that says run on server1
vs. localhost
service_description Sharedvolume
check_command check_sharedvolume
}
More information about the TriLUG
mailing list