nrdp is filling up /tmp

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
User avatar
jssingh
Posts: 110
Joined: Mon Apr 29, 2013 4:55 pm

nrdp is filling up /tmp

Post by jssingh »

I have nrdp running and it is working fine. However, it seems to be ignoring this setting in the config file:

Code: Select all

// full path to directory where temp scratch files can be written
// NOTE: the Apache user need to be able create files here, and the Nagios user needs to read/delete those same files, so the /tmp system directory won't work (it has a sticky bit on it)
$cfg["tmp_dir"]="/usr/local/nagios4/var/tmp";
and writing to /tmp. And since it can't delete from /tmp, /tmp is filling up.

I've checked the permissions on /usr/local/nagios4/var/tmp and it is writable by the nrdp user. Is there some other setting I need to be checking for?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: nrdp is filling up /tmp

Post by lmiltchev »

// NOTE: the Apache user need to be able create files here, and the Nagios user needs to read/delete those same files
Can you show us the permissions of the tmp directory?

Code: Select all

ls -la /usr/local/nagios4/var/tmp
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
jssingh
Posts: 110
Joined: Mon Apr 29, 2013 4:55 pm

Re: nrdp is filling up /tmp

Post by jssingh »

With the usual modifications for user/group:

Code: Select all

$ ls -lad /usr/local/nagios4/var/tmp
drwxrwxr-x 2 <nagios_user> <nrdp_group> 4096 Feb  5  2014 /usr/local/nagios4/var/tmp
$
and I double checked, the Apache user is part of the nrdp group.
User avatar
jssingh
Posts: 110
Joined: Mon Apr 29, 2013 4:55 pm

Re: nrdp is filling up /tmp

Post by jssingh »

I cleaned out all Apache files in /tmp that are over a day old and now I don't see any of the nrdp files. NRDP seems to be working fine (everything is updating).

Do the files get read and deleted by NRDP so fast that I would never see them in an ls? I keep doing an ls on /usr/local/nagios4/var/tmp and I don't see any files ever, so I'm not 100% sure what's going on ... but it looks like the problem went away some time this weekend.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: nrdp is filling up /tmp

Post by scottwilkerson »

NRDP uses the tempnam function when trying to write to the value set for

Code: Select all

$cfg["check_results_dir"]
, in the config.inc.php.

From the Manual
Creates a file with a unique filename, with access permission set to 0600, in the specified directory. If the directory does not exist, tempnam() may generate a file in the system's temporary directory, and return the full path to that file, including its name.
So it is possible that the files were created before this directory existed or the permissions were fixed.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
User avatar
jssingh
Posts: 110
Joined: Mon Apr 29, 2013 4:55 pm

Re: nrdp is filling up /tmp

Post by jssingh »

oddly, the only change I made to the permissions on /usr/local/nagios4/var/tmp was to remove the write permission from other. So it went from 777 to 775. But whatever fixed it, I'm fine with that. ;)
Locked