[PATCH] NDO - Check for configuration file availability

Michael Friedrich michael.friedrich at univie.ac.at
Thu Jan 6 12:47:37 CET 2011


On 05.01.2011 18:45, 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.

Thanks, very useful. I'll apply slightly modified against IDOUtils - 
ido2db will need that too (https://dev.icinga.org/issues/1087). ndo2db 
lacks of syslog output either way, so your patch against NDOUtils is 
correct :)

Kind regards,
Michael

>
>
> --- 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");
> +		temp_buffer[sizeof(temp_buffer)-1]='\x0';
> +		ndomod_write_to_logs(temp_buffer,NSLOG_INFO_MESSAGE);
>   		return NDO_ERROR;
> +	        }
>
>   	/* process each line of the file */
>   	while((buf=ndo_mmap_fgets(thefile))){
>
>
> ------------------------------------------------------------------------------
> Learn how Oracle Real Application Clusters (RAC) One Node allows customers
> to consolidate database storage, standardize their database environment, and,
> should the need arise, upgrade to a full multi-node Oracle RAC database
> without downtime or disruption
> http://p.sf.net/sfu/oracle-sfdevnl
> _______________________________________________
> Nagios-devel mailing list
> Nagios-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-devel
>


------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl




More information about the Developers mailing list