[Nagiosplug-devel] Re: Perl subroutine
Subhendu Ghosh
sghosh at sghosh.org
Fri May 30 11:47:11 CEST 2003
Please post to the regular list, not admin.
-sg
On Fri, 30 May 2003, Jan van den Berg wrote:
> Hi there,
>
>
>
> I don't if this is the right place here, but I have a question about a
> plug-in I'm developing.
>
>
>
> See the following Perl sub-routine
>
>
>
> sub get_alert
>
> {
>
> local @ARGV = '/var/log/alert';
>
> my @last8;
>
>
>
> while (<>) {
>
> push @last8, $_;
>
> shift @last8 while @last8 > 8;
>
> }
>
> my $line = $last8[-6];
>
> my $line =~ y/[,'"()<>]:;0123456789*//d;
>
>
> print $line;
>
> #print "test";
>
> }
>
>
>
> So what this does is, get the 8 before last line from a log file, strips
> this line from meta-characters and print out a clean line of text. When
> I run this command-line: no problem. However Nagios says there is no
> output! But when I uncomment the print "test"; it prints this out nicely
> in Nagios... so the subroutine is okay, and the print statement is okay.
>
> (I also tried using quotes around "$line" but that didn't work).
>
>
>
> So what am I doing wrong here?
>
>
>
> Please help.
>
>
>
> Jan van den Berg
>
>
--
More information about the Devel
mailing list