Cannot create directory: /usr/var/0

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
mksmr
Posts: 55
Joined: Thu Sep 22, 2016 7:17 am

Cannot create directory: /usr/var/0

Post 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

Hulluna humpasta taas
Minä olen hulluna humpasta taas
Minen toivu koskaan, luotan voimaan votkan
Hulluna humpasta taas
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

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

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
mksmr
Posts: 55
Joined: Thu Sep 22, 2016 7:17 am

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

Post 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
Hulluna humpasta taas
Minä olen hulluna humpasta taas
Minen toivu koskaan, luotan voimaan votkan
Hulluna humpasta taas
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

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

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked