Re: [Nagios-devel] command pipe concatenated messages

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

Re: [Nagios-devel] command pipe concatenated messages

Post by Guest »

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





This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked