[Nagiosplug-devel] Anyone have experience with writing plugins in "expect"

Hsiu-Fen Hung kate at cht.com.tw
Wed Oct 13 06:09:36 CEST 2004


I write the following plugin in "expect".  It runs sucessfully in shell, but it shows "No output" when I integrated it with nagios.
Can I write the nagios plugins in "expect" ?  If Yes, how to change it. Thanks !

#!/usr/bin/expect
spawn ssh -l xxxx xx.xx.xx.xx "/opt/ecs/bin/almsummary"
expect -re "Password: "
send "xxxxxxxx\rr"
expect eof
set output $expect_out(buffer)
#puts $output
if [ string match "*Yes*" $output ] {
   puts "ACD:CRITICAL\n";
   set exitstatus 1
} else {
   puts "ACD:OK\n";
   set exitstatus 0
}
exit $exitstatus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-plugins.org/archive/devel/attachments/20041013/6e39d12e/attachment.html>


More information about the Devel mailing list