Page 1 of 1

Step missing from documentation

Posted: Mon Nov 13, 2017 9:23 am
by Pitone_Maledetto
Hi all,
this documentation https://support.nagios.com/kb/article.php?id=96#Debian is missing an important step.
chown -R nagios:www-data /usr/local/nagios/var/rw/

without this every time you are requesting a check via the web console (rescheduling) you get the following error:
Could not open command file ‘/usr/local/nagios/var/rw/nagios.cmd’ for update!
Not sure where else to put this post so I am posting it here.
Regards

p.s. does the group nagcmd is not needed anymore?

Re: Step missing from documentation

Posted: Tue Nov 14, 2017 12:24 pm
by npolovenko
Welcome back, @Pitone_Maledetto.
Not sure where else to put this post so I am posting it here.
Yep, that's the right place to post bug findings.

I just used this manual to do a clean install on Debian 9, but I couldn't replicate the problem.

What version of Debian do you have? Were you doing a clean install or an upgrade? What were the permissions of /usr/local/nagios/var/rw/ before you changed them?

nagcmd is still used on the older systems I believe. But on the installation that I just did the group is just nagios.

Re: Step missing from documentation

Posted: Wed Nov 15, 2017 4:05 am
by Pitone_Maledetto
Hi npolovenko,
I am on Debian 9.2, clean install serving Nagios with Nginx.
The permissions where nagios:nagios.
Thanks

Re: Step missing from documentation

Posted: Wed Nov 15, 2017 4:45 pm
by Box293
Hi Pitone_Maledetto,
I've the maintainer of that documentation and I have just double checked it on my test Debian system here and it's not an issue.

The permission change you are requesting should not be required because the www-data user is added to the nagios group with:

Code: Select all

usermod -a -G nagios www-data
You did mention that you are using Ngnix. I've not used this myself as the guide uses Apache.

Is it possible that Ngnix has a different user account that needs to be added to the nagios group?

Otherwise this sounds like an Ngnix permissions issue. The reason I say this is because of the following Apache commands in the documentation:

Code: Select all

make install-webconf
a2enmod rewrite
a2enmod cgi
I beleive it's the cgi module that needs to be enabled in Apache before the command pipe can be used. Perhaps there is something like this in Ngnix?

Re: Step missing from documentation

Posted: Thu Nov 16, 2017 4:11 am
by Pitone_Maledetto
Hi Box293,
the user is the same www-data.
No sure about the re-write.
This is my nginx configuration file for nagios.
Not sure if you are interested in testing it and have a documentation for nagios/nginx as well as the nagios/apache2 one.

Code: Select all

server {
    server_name nagios;
    access_log /var/log/nginx/nagios.access.log;
    error_log /var/log/nginx/nagios.error.log;
    auth_basic "Private";
    auth_basic_user_file /usr/local/nagios/etc/htpasswd.users;
    root /usr/local/nagios/share;
    index index.php index.html;
    location / {
        try_files $uri $uri/ index.php /nagios;
    }
    location /nagios {
        alias /usr/local/nagios/share;
    }
    location ~ ^/nagios/(.*\.php)$ {
        alias /usr/local/nagios/share/$1;
        include /etc/nginx/fastcgi_params;
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    }
    location ~ \.cgi$ {
            root /usr/local/nagios/sbin/;
            rewrite ^/nagios/cgi-bin/(.*)\.cgi /$1.cgi break;
            fastcgi_param AUTH_USER $remote_user;
            fastcgi_param REMOTE_USER $remote_user;
            include /etc/nginx/fastcgi_params;
            fastcgi_pass unix:/run/fcgiwrap.socket;
      }
    location ~ \.php$ {
            include /etc/nginx/fastcgi_params;
            fastcgi_pass unix:/run/php/php7.0-fpm.sock;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      }
}
This is what you need for the setup:

Code: Select all

apt install -y php7.0 php7.0-cgi php7.0-fpm fcgiwrap php-apcu apache2-utils nginx-full
Thank you for your time.
Regards

Re: Step missing from documentation

Posted: Thu Nov 16, 2017 5:54 pm
by Box293
Thanks for the info.

At this point I won't be including these steps in our documentation as all of our documentation focusses on Apache.

However it is recorded here and it will help others trying to use Nginx in the future.