command pipe concatenated messages
Jim Mozley
jim.mozley at exponential-e.com
Mon Jan 26 12:13:57 CET 2004
Jim Mozley wrote:
> Hi All,
>
> I have been seeing a problem with submitting passive checks using
> version 1.0 on Solaris 8. I had some discusions on this originally on
> the nagios-users list, asked some questions on comp.lang.misc.perl and
> finally ended up discussing this with Al Tobey as he I had some
> questions on how he implemented command submission via in his perl module.
>
> The issue I see is with multiple passive checks becoming concatenated,
> so I end up with events like this:
>
> My service is Up Some description[1065056739]
> PROCESS_SERVICE_CHECK_RESULT:my-host:my-service:0:Some description.
>
> Where another passive check becomes part of the description field of the
> previous check.
>
> I am using some perl code to submit commands containing:
>
>
> open(PIPE, "> $pipe") or croak "Cannot open pipe $!";
> flock(PIPE, LOCK_EX);
> print PIPE "$cmd";
> # wait before releasing lock so we don't overlap cmds to Nagios
> sleep 2;
> close PIPE or croak "Cannot close pipe $!"; # also releases lock
(Enough of the recap.)
If I use the following:
system "$echo \"$cmd\" >> $pipe";
In place of the open, print, close (or any of the variations such as
syswrite) I don't see the concatenation problem that I see using the
perl approach.
I don't know why this is the case, but will post if I find an answer.
As soon as I can test I will check if Nagios::Cmd solves the issue
instead or if it has the same problem on Solaris 8 with Nagios 1.0.
Jim
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
More information about the Developers
mailing list