Re: [Nagios-devel] 2 calls to unlink in checkresults

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

Re: [Nagios-devel] 2 calls to unlink in checkresults

Post by Guest »

Hi,

Jon Angliss wrote:
> On Wed, 13 May 2009 17:47:06 -0400, Mathieu Gagn=E9
> wrote:
>=20
>> Hi,
>>
>> I did a strace on the Nagios daemon and found out there's 2 calls =
to=20
>> unlink for each check result file in checkresults.
>=20
> I believe they're only temporary files to contact results from a
> specific check.

Yes they are temporary files.

>> For example:
>>
>> stat64("/usr/local/nagios/var/spool/checkresults/cXKYnMY",=20
>> {st_mode=3DS_IFREG|0600, st_size=3D475, ...}) =3D 0
>> stat64("/usr/local/nagios/var/spool/checkresults/cXKYnMY.ok",=20
>> {st_mode=3DS_IFREG|0600, st_size=3D0, ...}) =3D 0
>> time(NULL) =3D 1242249182
>> open("/usr/local/nagios/var/spool/checkresults/cXKYnMY", O_RDONLY)=
=3D 7
>> fstat64(7, {st_mode=3DS_IFREG|0600, st_size=3D475, ...}) =3D 0
>> mmap2(NULL, 475, PROT_READ, MAP_PRIVATE, 7, 0) =3D 0xb7ee8000
>> munmap(0xb7ee8000, 475) =3D 0
>> close(7) =3D 0
>> unlink("/usr/local/nagios/var/spool/checkresults/cXKYnMY") =3D 0
>> unlink("/usr/local/nagios/var/spool/checkresults/cXKYnMY.ok") =
=3D 0
>>
>> [......]
>>
>> unlink("/usr/local/nagios/var/spool/checkresults/cXKYnMY") =3D -1 =
ENOENT=20
>> (No such file or directory)
>> unlink("/usr/local/nagios/var/spool/checkresults/cXKYnMY.ok") =
=3D -1=20
>> ENOENT (No such file or directory)
>>
>>
>> Any idea about the source of this problem? (if it's one)
>=20
> Are you seeing a problem? It's supposed to unlink them I believe. =
See
> base/utils.c delete_check_result_file, I believe that's probably wh=
ere
> you're seeing the two unlink calls come from.
>=20

Nagios tries to delete both files 2 times. For one file:
unlink("/usr/local/nagios/var/spool/checkresults/cXKYnMY") =3D 0
unlink("/usr/local/nagios/var/spool/checkresults/cXKYnMY") =3D -1 ENO=
ENT=20
(No such file or directory)

My opinion is that Nagios shouldn't try to delete it a second time. O=
ne=20
time is enough. :)

I'll try to investigate it further on next week if nobody finds...

--
Mathieu






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