Custom Plugin
Danny Russell
drussell at mpifix.com
Wed Jul 20 19:44:35 CEST 2005
I am trying to monitor a host that is behind a Cisco VPN Concentrator.
For simplicity right now I am just trying to use check_ping.
I have written an expect script (lhm.sh) that logs into the VPN and then
runs a check_ping command. Here is the code for lhm.sh:
1 #!/usr/bin/expect -f
2 set cmd_one [lindex $argv 0];
3 log_user 0
4 spawn vpnclient connect lhm pwd password
5 expect "(y/n): " {send "y\r"}
6 spawn ./check_ping -H $cmd_one -w 3000.0,80% -c 5000.0,100% -p
3
7 interact
8 set status [wait]
9 #puts [lindex $status 3]
10 exit [lindex $status 3]
Line #3 - disables the output to go to stdout. This hides all of the
nasty long VPN connection information.
Line #4 - connects to the VPN
Line #5 - sends a 'y' so the VPN is connected
Line #8 - gets the exit return code
Line #10 - exits with the exit return code from $status.
When I call './lhm.sh 10.30.31.51' this is the output:
[root at monitor plugins]# ./lhm.sh 10.30.31.51
PING OK - Packet loss = 0%, RTA = 60.68 ms
[root at monitor plugins]#
When I call './lhm.sh 10.30.31.51' with the puts un-commented this is
the output:
[root at monitor plugins]# ./lhm.sh 10.30.31.51
PING OK - Packet loss = 0%, RTA = 71.03 ms
0
[root at monitor plugins]#
When I call './lhm.sh 10.30.31.61' (A WRONG IP) with the puts
un-commented this is the output:
[root at monitor plugins]# ./lhm.sh 10.30.31.61
CRITICAL - Plugin timed out after 18 seconds
2
[root at monitor plugins]#
The problem is, when I create a custom check command in
/etc/Nagios/checkcommands.cfg to call /usr/lib/Nagios/plugins/lhm.sh
Nagios always reports it as up and (No output!). It even reports at UP
if I give it a wrong IP (10.30.31.61).
Host Status: UP
Status Information:(No output!)
Any ideas?
Thanks!
Danny Russell
Mobile Productivity, Inc.
drussell at mpifix.com
work-801.437.5885 mbl-801.722.5837
Enabling the World To Work
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20050720/41d7e9bf/attachment.html>
More information about the Users
mailing list