[Nagiosplug-devel] Anyone have experience with writing plugins in "expect"
Andreas Ericsson
ae at op5.se
Wed Oct 13 06:52:50 CEST 2004
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 op5.se
OP5 AB www.op5.se
Lead Developer
More information about the Devel
mailing list