Page 1 of 1

Nagios, nginx and external commands

Posted: Tue Dec 08, 2015 2:52 am
by rlaugen
Hello,

We recently decided to start fresh with our monitoring, going from Nagios 3 to Nagios 4, and using Nginx to serve the site.

Now, everything has been going smooth, except executing external commands. For some reason or another, I'm unable to execute external commands. I can restart / shut down the process, and perform commands relating to the actual Nagios process. However, when I try running e.g a "Reschedule the next check for this host", I get "Sorry, but you are not authorized to commit the specified command.".

I was wondering if anyone is able to point me in the right direction.

My cgi.cfg:
physical_html_path=/usr/local/nagios/share
url_html_path=/nagios
use_authentication=1
default_user_name=nagiosadmin
authorized_for_system_information=nagiosadmin
authorized_for_system_commands=nagiosadmin
authorized_for_configuration_information=nagiosadmin
authorized_for_all_hosts=nagiosadmin
authorized_for_all_host_commands=nagiosadmin
authorized_for_all_services=nagiosadmin
authorized_for_all_service_commands=nagiosadmin
default_statusmap_layout=5
default_statuswrl_layout=4
refresh_rate=90
ping_syntax=/bin/ping -n -U -c 5 $HOSTADDRESS$
main_config_file=/usr/local/nagios/etc/nagios.cfg
relevant permissions:
root@newnag:/usr/local/nagios/var/rw# ls -l
total 0
prw-rw---- 1 nagios nagcmd 0 Dec 7 18:41 nagios.cmd
root@newnag:/usr/local/nagios/sbin# ls -l
total 5096
-rwxrwxr-x 1 nagios nagcmd 318712 Dec 2 06:51 archivejson.cgi
-rwxrwxr-x 1 nagios nagcmd 302368 Dec 2 06:51 avail.cgi
-rwxrwxr-x 1 nagios nagcmd 295008 Dec 2 06:51 cmd.cgi
-rwxrwxr-x 1 nagios nagcmd 265688 Dec 2 06:51 config.cgi
-rwxrwxr-x 1 nagios nagcmd 310528 Dec 2 06:51 extinfo.cgi
Thanks in advance!

Re: Nagios, nginx and external commands

Posted: Tue Dec 08, 2015 10:31 am
by hsmith
What method did you use to install Core 4? Where did you get it from?

Re: Nagios, nginx and external commands

Posted: Tue Dec 08, 2015 11:18 am
by rlaugen
hsmith wrote:What method did you use to install Core 4? Where did you get it from?
I got the source from nagios.com, and followed the guide @ http://www.tokiwinter.com/installing-na ... 14-04-lts/

Re: Nagios, nginx and external commands

Posted: Tue Dec 08, 2015 11:40 am
by rkennedy
What user are you logged in as when you receive that error?

Re: Nagios, nginx and external commands

Posted: Wed Dec 09, 2015 3:43 am
by rlaugen
rkennedy wrote:What user are you logged in as when you receive that error?
nagiosadmin

Re: Nagios, nginx and external commands

Posted: Wed Dec 09, 2015 1:44 pm
by tmcdonald
What exact version of Core are you running? Is it 4.0.7 as indicated in the article or did you grab a different/newer version?

Re: Nagios, nginx and external commands

Posted: Thu Dec 10, 2015 12:01 am
by rlaugen
tmcdonald wrote:What exact version of Core are you running? Is it 4.0.7 as indicated in the article or did you grab a different/newer version?
Sorry, I forgot to mention that - I got the newest version (4.1.1).

Re: Nagios, nginx and external commands

Posted: Thu Dec 10, 2015 12:22 am
by Box293
Here's a guide I did a while back:

http://sites.box293.com/nagios/guides/i ... untu-14-04

I suspect you need to run these commands:

Code: Select all

a2enmod rewrite
a2enmod cgi
service apache2 restart

Re: Nagios, nginx and external commands

Posted: Thu Dec 10, 2015 12:45 am
by rlaugen
Box293 wrote:Here's a guide I did a while back:

http://sites.box293.com/nagios/guides/i ... untu-14-04

I suspect you need to run these commands:

Code: Select all

a2enmod rewrite
a2enmod cgi
service apache2 restart
As mentioned in my subject field, I'm using Nginx, and not apache :)

Re: Nagios, nginx and external commands

Posted: Thu Dec 10, 2015 11:31 am
by rkennedy

Code: Select all

Create a configuration file for your Nagios installation as follows:
# vi /etc/nginx/sites-available/nagios.example.com.conf
Can you paste your nagios.conf that you configured for nginx?