Page 1 of 1

Cannot create directory: /usr/var/0

Posted: Wed Oct 04, 2017 5:47 am
by mksmr
This one's reminiscent of https://support.nagios.com/forum/viewto ... =7&t=40513

My system is an up-to-date Devuan 1.0.0 LTS, with Nagios Core 4.3.4. My first unexpected issue was that check_snmp wouldn't run for the nagios user. I had to suid root check_snmp. It's running now, but giving me

Code: Select all

Cannot create directory: /usr/var/0
I wonder what that might be? Maybe a compile-time problem?

Matthias

Edit: a folder /usr/var/0 has actually been created, containing a folder check_snmp:

Code: Select all

# ls -l /usr/var/
insgesamt 4
drwx------ 3 root nagios 4096 Okt  4 12:26 0

ls -l /usr/var/0/check_snmp/
insgesamt 4
-rw-r----- 1 root nagios 61 Okt  4 12:26 ab23b47a7c41d46a360bba403f92836c4562ae8b


Re: Cannot create directory: /usr/var/0

Posted: Wed Oct 04, 2017 4:49 pm
by tgriep
Only the root user has permissions to write to that folder but not the nagios group.
Try giving the nagios group the ability to read and write to that folder and see if that fixes the issue.
Run this as root to fix it and test the plugin again.

Code: Select all

chmod -R g+rw /usr/var/0

Re: Cannot create directory: /usr/var/0

Posted: Thu Oct 05, 2017 5:29 am
by mksmr
tgriep wrote:Only the root user has permissions to write to that folder
Hey there, yes, obviously. My question is, what makes nagios want to write to /usr in the first place? AFAICR everthing used to go to /var (or /usr/local/nagios/var), which would make sense, but not /usr.

Matthias

Re: Cannot create directory: /usr/var/0

Posted: Thu Oct 05, 2017 9:18 am
by tgriep
I am guessing that you are using the Rate Calculation option for the check_snmp command and when you do that, it saves the state information in to a file and uses that for it's calculation.
I took a look at the latest check_snmp source file and found this entry that states where the state file should be stored.

Code: Select all

$ENV{'NAGIOS_PLUGIN_STATE_DIRECTORY'} ||= "/var/tmp";
It could be when the plugin was compiled, the state directory was changed and that could be the reason the plugin is trying to store the file in that other folder.