Nagios, nginx and external commands

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
rlaugen
Posts: 6
Joined: Tue Dec 08, 2015 2:47 am

Nagios, nginx and external commands

Post 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!
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Nagios, nginx and external commands

Post by hsmith »

What method did you use to install Core 4? Where did you get it from?
Former Nagios Employee.
me.
rlaugen
Posts: 6
Joined: Tue Dec 08, 2015 2:47 am

Re: Nagios, nginx and external commands

Post 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/
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Nagios, nginx and external commands

Post by rkennedy »

What user are you logged in as when you receive that error?
Former Nagios Employee
rlaugen
Posts: 6
Joined: Tue Dec 08, 2015 2:47 am

Re: Nagios, nginx and external commands

Post by rlaugen »

rkennedy wrote:What user are you logged in as when you receive that error?
nagiosadmin
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Nagios, nginx and external commands

Post 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?
Former Nagios employee
rlaugen
Posts: 6
Joined: Tue Dec 08, 2015 2:47 am

Re: Nagios, nginx and external commands

Post 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).
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Nagios, nginx and external commands

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
rlaugen
Posts: 6
Joined: Tue Dec 08, 2015 2:47 am

Re: Nagios, nginx and external commands

Post 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 :)
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Nagios, nginx and external commands

Post 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?
Former Nagios Employee
Locked