Patch for handling pipes nicely + fix bug in config parsing
Thomas Guyot-Sionnest
Thomas at zango.com
Mon Mar 12 17:59:02 CET 2007
> -----Original Message-----
> From: nagios-devel-bounces at lists.sourceforge.net
> [mailto:nagios-devel-bounces at lists.sourceforge.net] On Behalf
> Of Ethan Galstad
> Sent: March 12, 2007 11:56
> To: Nagios Developers List
> Subject: Re: [Nagios-devel] Patch for handling pipes nicely +
> fix bug in config parsing
>
> 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. :-)
Thanks! I'll work on the doc and config patch during the week. I guess
you'll patch the 2-x branch with at least the strstr fix. Would you like a
"piped perfdata" patch for the 2-x branch as well?
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3076 bytes
Desc: not available
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20070312/ac369066/attachment.bin>
-------------- next part --------------
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
-------------- next part --------------
_______________________________________________
Nagios-devel mailing list
Nagios-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-devel
More information about the Developers
mailing list