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

kate kate at cht.com.tw
Thu Oct 14 08:58:07 CEST 2004


How can I modify my scripts?
>Output is truncated to one line, so if there are any empty lines before
> the output you want, Nagios won"t see it.
 
 Hsiu-Fen Hung wrote:
 > 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
 > 
 
 -- 
 Andreas Ericsson                   andreas.ericsson at op...
 OP5 AB                             http://www.op5.se
 Lead Developer
 




More information about the Devel mailing list