[PATCH] NDO - Check for configuration file availability

Michael Friedrich michael.friedrich at univie.ac.at
Fri Jan 7 12:49:48 CET 2011


Andreas Ericsson wrote:
> On 01/07/2011 10:08 AM, Michael Friedrich wrote:
>> Ricardo Maraschini wrote:
>>> Hello,
>>>
>>> I don't know if this is the right list for NDO, but i'll learn it on the hard way, though.
>>> I installed NDO into a CentOS, and when i started Nagios i received the following message at nagios.log:
>>>
>>> ndomod: Could not open data sink!  I'll keep trying, but some output may get lost...
>>>
>>> I figured out that nagios' user couldn't access NDO configuration file due to a permission issue. It took me some time to discover the source of the problem, so i thought that maybe an accurate error message can help on this.
>>>
>>> I've applied the patch below against ndoutils-1.4b9.
>>>
>>>
>>> --- ndomod.c	2009-10-27 01:08:29.000000000 -0700
>>> +++ ndomod.c-modified	2011-01-05 03:40:08.000000000 -0800
>>> @@ -330,10 +330,15 @@
>>>     	ndo_mmapfile *thefile=NULL;
>>>     	char *buf=NULL;
>>>     	int result=NDO_OK;
>>> +	char temp_buffer[NDOMOD_MAX_BUFLEN];
>>>
>>>     	/* open the file */
>>> -	if((thefile=ndo_mmap_fopen(filename))==NULL)
>>> +	if((thefile=ndo_mmap_fopen(filename))==NULL) {
>>> +		snprintf(temp_buffer,sizeof(temp_buffer)-1,"ndomod: Unable to open configuration file, please check permissions.\n");
>> it would make sense addig the filename over here too. just as
>>
>> snprintf(temp_buffer,sizeof(temp_buffer)-1,"idomod: Unable to open
>> configuration file, please check permissions on %s\n", filename);
>>
> It would make even more sense to use the value of errno instead of just
> randomly guessing why it failed.

true, I was just replying to Stephen's proposal. Thanks for the pointer 
though.

I remember patching such errno strings into ido2db too, so it will make 
sense to use them both at my stage then. i had that once on my list 
putting ndo2db syslog output into upstream, but since there's still 
no-one maintaining it i fear loss of patch time in this regard.

kind regards,
Michael


-- 
DI (FH) Michael Friedrich

Vienna University Computer Center
Universitaetsstrasse 7 A-1010 Vienna, Austria

email: 	michael.friedrich at univie.ac.at
phone: 	+43 1 4277 14359
fax: 	+43 1 4277 14338
web:	http://www.univie.ac.at/zid
	http://www.aco.net

Icinga Core&  IDOUtils Developer
http://www.icinga.org


------------------------------------------------------------------------------
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web.   Learn how to 
best implement a security strategy that keeps consumers' information secure 
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl 




More information about the Developers mailing list