Page 1 of 1

Re: [Nagios-devel] [PATCH] NDO - Check for configuration file

Posted: Fri Jan 07, 2011 9:52 am
by Guest

--k1lZvvs/B4yU6o8G
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Jan 05, 2011 at 03:45:55PM -0200, Ricardo Maraschini said:
> Hello,
>=20
> 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:
>=20
> ndomod: Could not open data sink! I'll keep trying, but some output
> may get lost...
>=20
> 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.
>=20
> I've applied the patch below against ndoutils-1.4b9.
>=20
> --- 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=3DNULL;
> char *buf=3DNULL;
> int result=3DNDO_OK;
> + char temp_buffer[NDOMOD_MAX_BUFLEN];
> =20
> /* open the file */
> - if((thefile=3Dndo_mmap_fopen(filename))=3D=3DNULL)
> + if((thefile=3Dndo_mmap_fopen(filename))=3D=3DNULL) {
> + snprintf(temp_buffer,sizeof(temp_buffer)-1,"ndomod: Unable to open con=
figuration file, please check permissions.\n");
> + temp_buffer[sizeof(temp_buffer)-1]=3D'\x0';
> + ndomod_write_to_logs(temp_buffer,NSLOG_INFO_MESSAGE);
> return NDO_ERROR;
> + }
> =20
> /* process each line of the file */
> while((buf=3Dndo_mmap_fgets(thefile))){

Hi,

I'd be quite happy to see this display the actual error instead of
hardcoding a suggestion that may be inaccurate.

Something like:
snprintf(temp_buffer,sizeof(temp_buffer)-1,"ndomod: Unable to open configur=
ation file %s: %s\n", filename, strerror(errno))

Cheers,
--=20
--------------------------------------------------------------------------
| Stephen Gran | Don't vote -- it only encourages them! |
| [email protected] | |
| http://www.lobefin.net/~steve | |
--------------------------------------------------------------------------

--k1lZvvs/B4yU6o8G
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQIcBAEBCAAGBQJNJuJVAAoJELMRjO+K6o/uqgQQAN0sbmI9G+XNqXwAePYSduSC
kLq/PK1X8bdOphTBHWr/ssBxhi4cXwUzgOHHPEjaT5ldYXgIg358PIh1FyGwxusb
Ts6giIaqQ1qMVtxdgeNfNpJ/c95IA6ijiFNlQOOZ3wGoan3kWnbCSlZ7vBvXORKL
De07bXnjlKOto532nmhrEcaNq8NvsHzIWue5YgUP+TE03TWIsMWotEhUvCRBa9bt
AzIgqxjyYIEyS+03cZfV/DOLyUhg8ewQd+XnUUiZob/6J4G+toZmCdzsOvUbKNde
MmHMZ3o1RGpJTQjOff2FaA/7uAubpT2gs+H+o54r45iJBSvolhmGhjNd1S0oX6IY
Rk7KX/v92FuGjmIjEXWUd+o21NDw9wv0fV1GxK4T5yXkugYuF6NtFMb8CKVoGfpo
LJMGPgF4YFBg+rVTTTZnH7DHMqV1XvShYKs7VDkMnmDU7gy0DZelWHlHwTvkwuX0
ruwdeMcksycn06vRzkiTHZjKDEGq/rYZnmbWMtXIl4k4Sf7p98aZEKa6cVg42Fv7
ctm3N90MKVeZ4fC48yKQInr+h2DQpEQB3+8zswBHrzZ5YSIWadbJW0RrbFwfre9e
WqIjW8KPah4rsrzxAz59IeLzeGoy03Dvoq/8h1qedcBgDPiRstNtkjrpTdMuX0ui
1rghj1S3uYROGrs/uXr7
=bYax
-----END PGP SIGNATURE-----

--k1lZvvs/B4yU6o8G--





This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]