Patch for handling pipes nicely + fix bug in config parsing

Ethan Galstad nagios at nagios.org
Mon Mar 12 16:55:41 CET 2007


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: nagios at nagios.org
Website: http://www.nagios.org

-------------------------------------------------------------------------
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




More information about the Developers mailing list