Re: [Nagios-devel] Patch for handling pipes nicely + fix bug in

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] Patch for handling pipes nicely + fix bug in

Post by Guest »

Thomas Guyot-Sionnest wrote:
> Hi Ethan, list,
>
> I made a patch to make Nagios handle nicely perfdata_file as pipes. What
> it does is add a new file mode; i.e.:
>
> host_perfdata_file_mode=p
> service_perfdata_file_mode=p
>
> When set to "p", it will use open with O_NONBLOCK | O_RDWR, then fdopen
> on the fd, so that the fd will be left with O_NONBLOCK. This will allow
> Nagios to open the pipe without blocking even if there's no reader. It
> will also avoid loosing data if the reader goes away for a short period
> of time (ex. performance data daemon restart)
>
> While testing it I also found out there's a bug in the argument
> processing. strstr returns the pointer to the search string. so that
> if(!strstr(...)) is like saying if(string not there). The original code
> looked like this:
>
> if(!strstr(varvalue,"w"))
> xpddefault_host_perfdata_file_append=FALSE;
>
> So I changed that to explicitly check if the value is not NULL. This
> explains why with "w" I was seeing O_APPEND from strace ;)
>
> If you accept this patch I'll submit a complete patch including doc and
> sample config modifications. I can also backport it to the 2-x branch if
> you're willing to accept it.
>
> Thanks,
>
> Thomas
>

Thanks! I'll get this applied to the Nagios 3 CVS code today. :-)


Ethan Galstad,
Nagios Developer
---
Email: [email protected]
Website: http://www.nagios.org





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