need help with my custom perl plugin

August Simonelli augusts at gmail.com
Wed Sep 5 02:46:28 CEST 2007


good thought on perms - i double checked and i'm running as nagios so all
good there ...

marcel i think you are right, my match condition is just wrong for some
reason ...

when i change the while loop to:

while (<SSH>){
next if /^Trying/;
next if /^Connected/;
if ($_ =~ /Escape/) {
    print "success $_";
    exit($ERRORS{'OK'});
}
else {
    print "Connect died at: $_";
    exit($ERRORS{'CRITICAL'});
}

this works and nagios reports OK.

but if i let it get to that last line, which is the 220 line, it won't
match. i'm guessing this is something to do with how the while loop handles
the last line of input and places it into $_

but i don't get why nagios doens't see it and command line works ...

i'll keep trying and if anyone spots it please let me know!

august



On 9/5/07, Marcel Mitsuto Fucatu Sugano <msugano at uolinc.com> wrote:
>
> Comments inline:
>
> On Wed, 2007-09-05 at 08:48 +1000, August Simonelli wrote:
> >
> >
> > but when all those conditions ARE met nagios always makes it right
> > past
> >
> >         if ($_ =~ /^220/) {
> >             print "$_ this works";
> >             exit($ERRORS{'OK'});
> >
> > and gives me
> >
> > print "fell thru";
> > exit($ERRORS{'WARNING'});
> >
> > printing out $_ in the while loop has the expected 220 line ...
> >
>
> Probably, telnet responds something different that the regexp match
> expects, like "\r220: (...)", so if 220 is the OK condition, try
> removing the leading "^", and you're done.
>
> HTH
>
>
> AVISO: A informação contida neste e-mail, bem como em qualquer de seus
> anexos, é CONFIDENCIAL e destinada ao uso exclusivo do(s) destinatário(s)
> acima referido(s), podendo conter informações sigilosas e/ou legalmente
> protegidas. Caso você não seja o destinatário desta mensagem, informamos que
> qualquer divulgação, distribuição ou cópia deste e-mail e/ou de qualquer de
> seus anexos é absolutamente proibida. Solicitamos que o remetente seja
> comunicado imediatamente, respondendo esta mensagem, e que o original desta
> mensagem e de seus anexos, bem como toda e qualquer cópia e/ou impressão
> realizada a partir destes, sejam permanentemente apagados e/ou destruídos.
> Informações adicionais sobre nossa empresa podem ser obtidas no site
> http://sobre.uol.com.br/.
>
> NOTICE: The information contained in this e-mail and any attachments
> thereto is CONFIDENTIAL and is intended only for use by the recipient named
> herein and may contain legally privileged and/or secret information. If you
> are not the e-mail´s intended recipient, you are hereby notified that any
> dissemination, distribution or copy of this e-mail, and/or any attachments
> thereto, is strictly prohibited. Please immediately notify the sender
> replying to the above mentioned e-mail address, and permanently delete
> and/or destroy the original and any copy of this e-mail and/or its
> attachments, as well as any printout thereof. Additional information about
> our company may be obtained through the site http://www.uol.com.br/ir/.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20070905/2ae504ba/attachment.html>
-------------- next part --------------
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
-------------- next part --------------
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null


More information about the Users mailing list