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

Harper Mann hmann at itgroundwork.com
Wed Oct 13 09:55:08 CEST 2004

Did you run it as "nagios" on the command line?


- Harper

Harper Mann
Groundwork Open Source Solutions
510-599-2075 (cell)

-----Original Message-----
From: nagiosplug-devel-admin at lists.sourceforge.net
[mailto:nagiosplug-devel-admin at lists.sourceforge.net] On Behalf Of Andreas
Sent: Wednesday, October 13, 2004 6:48 AM
To: nagiosplug-devel at lists.sourceforge.net
Subject: Re: [Nagiosplug-devel] Anyone have experience with writing plugins
in "expect"

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

This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
Nagiosplug-devel mailing list
Nagiosplug-devel at lists.sourceforge.net
::: Please include plugins version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null

More information about the Devel mailing list