Patch for handling pipes nicely + fix bug in config parsing

Thomas Guyot-Sionnest dermoth at aei.ca
Fri Mar 9 09:16:17 CET 2007


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nagios-3-HEAD.piped-perfdata.patch
Type: text/x-patch
Size: 3093 bytes
Desc: not available
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20070309/7d86589a/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