Page 1 of 1

Cannot create directory: /var/550

Posted: Wed Oct 05, 2016 4:00 am
by mksmr
Nagios Core 4.0.8
OpenBSD 6.0
amd64 (VM)

Good morning @all,

i am running checks like this one

Code: Select all

define service{
       use                   generic-service
       host_name             draytek
       service_description   if err/min
       check_command         check_snmp! -o ipInHdrErrors.0 --rate --rate-multiplier=60
       }
which result in this error:

Code: Select all

[1475652832] SERVICE NOTIFICATION: nagiosadmin;draytek;if err/min;UNKNOWN;notify-service-by-email;Cannot create directory: /var/550
This only occurs with checks that contain a --rate/--rate-multiplier directive. I find this one

Code: Select all

Cannot create directory: /var/550
particularly confusing. I wondered if anybody here could clarify what's happening - or what's supposed to happen, rather?

TIA
Matthias

EDIT:
I've created the said directory manually now. Nagios places a directory "check_snmp" there, containing statefiles related to rate calculation. Consequently, the checks are working now. I assume Nagios is supposed to use /var/www/var for that, rather than /var.

Re: Cannot create directory: /var/550

Posted: Wed Oct 05, 2016 9:43 am
by avandemore
I believe your issue eg /var/550 is due to an HTTP 550 response which the check_snmp plugin eval's a the subdirectory to create it's transitional state in. Can you try to run the command from the CLI with increased verbosity as whatever user you were doing the previous command with?

Please list the output of the result.

You may also consult the apache and nagios log's for more information.

Re: Cannot create directory: /var/550

Posted: Mon Oct 10, 2016 3:05 am
by mksmr
Here we go:

Code: Select all

# doas -u _nagios ./check_snmp -H 192.168.1.1 -v -o ipInHdrErrors.0 --rate --rate-multiplier=60
/usr/local/bin/snmpget -Le -t 10 -r 5 -m ALL -v 1 [authpriv] 192.168.1.1:161 ipInHdrErrors.0
RFC1213-MIB::ipInHdrErrors.0 = Counter32: 15
Cannot create directory: /var/550
#
Nagios is trying to set up temporary directories in /var, but fails because the user _nagios has no right to crate directories in /var. I think it's supposed to be somehwere in /var/www (this is where OpenBSD's jail for apache is located). What I am probably looking for is the place where I can change the target path for those temporary files and directories.

Re: Cannot create directory: /var/550

Posted: Mon Oct 10, 2016 9:28 am
by avandemore
Are you installing from a port or package? I assume so since the version is older.

The information that this is running in a jail is quite critical. Are you using FreeBSD w/ jails or is this an OpenBSD chroot AFAIK OpenBSD doesn't support jails.

What is the output of mount?

Re: Cannot create directory: /var/550

Posted: Tue Oct 11, 2016 2:13 am
by mksmr
avandemore wrote:Are you installing from a port or package? I assume so since the version is older.
That's correct, it's an installation from the 4.0.8 package provided by OpenBSD 6.0. This is another issue, because 4.0.8 apparently contains bugs that have been fixed in 4.1.x.
avandemore wrote:The information that this is running in a jail is quite critical.
Jail was the wrong word - it's an OpenBSD -chroot installation that places the whole thing into (IMO) rather bizarre paths. Everything resides in /var/www.
avandemore wrote:What is the output of mount?

Code: Select all

#  mount
/dev/sd0a on / type ffs (local)
/dev/sd0k on /home type ffs (local, nodev, nosuid)
/dev/sd0d on /tmp type ffs (local, nodev, nosuid)
/dev/sd0f on /usr type ffs (local, nodev)
/dev/sd0g on /usr/X11R6 type ffs (local, nodev)
/dev/sd0h on /usr/local type ffs (local, nodev, wxallowed)
/dev/sd0j on /usr/obj type ffs (local, nodev, nosuid)
/dev/sd0i on /usr/src type ffs (local, nodev, nosuid)
/dev/sd0e on /var type ffs (local, nodev, nosuid)

Re: Cannot create directory: /var/550

Posted: Tue Oct 11, 2016 9:56 am
by avandemore
This is another issue, because 4.0.8 apparently contains bugs that have been fixed in 4.1.x.
True but you'll never get away from that tail chasing exercise. Also keeping on OS packages makes it easier to know when real critical errors show, and to address them.
Everything resides in /var/www
According to OpenBSD's hier(7), it's not totally out of bounds but something /usr/local/www/nagios would make more sense for non-config files.

In general, the permissions for Nagios directories and files should be <nagios user>:<web server group> 775 for cgi stuff, 775 for script/html dirs, and 664 for html script files.

Do these line up?

Re: Cannot create directory: /var/550

Posted: Mon Oct 24, 2016 7:46 am
by mksmr
The OpenBSD way makes sense when you look at it - and as long as you stick with it. I'd rather not go down the rabbit hole to change things here. The rights/missing directory issue was an easy thing to fix. But apparently, standard paths are not laid out somewhere in the config files, which makes Nagios write temporary files to bizarre locations. I wonder if this is a mistake somewhere in the config (which must have been modified by OpenBSD to point to their preferred hierarchy) which could easily be rectified.

Re: Cannot create directory: /var/550

Posted: Mon Oct 24, 2016 9:39 am
by dwhitfield
If you come up with a detailed way for us to steer OpenBSD in the right direction as far as paths, I suggest you file a bug report at https://github.com/NagiosEnterprises/na ... issues/new

We obviously can't make OSes follow our rules, but we might be able to make decisions they think are sane.

We generally suggest people compile from source if they are starting out. However, we don't have a migration process, so since you've started with OpenBSD packages, I would suggest you stay with that, unless you can find a very compelling reason to upgrade.

Re: Cannot create directory: /var/550

Posted: Mon Nov 21, 2016 4:58 am
by mksmr
I'm trying to contact the OpenBSD maintainer on this.

Re: Cannot create directory: /var/550

Posted: Mon Nov 21, 2016 10:29 am
by dwhitfield
Fantastic! If you need any help from us on that, please let us know. I can't promise we can do much, but I can try to grease the wheels a bit.