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.
landacorp
Posts: 8 Joined: Wed Oct 09, 2013 4:27 am
Post
by landacorp » Wed Oct 09, 2013 4:34 am
Centos 6.4 64bit
SElinux disabled
Running Nginx with following rules:
Code: Select all
location /nagios {
alias /usr/share/nagios/html;
index index.php;
auth_basic "Nagios";
auth_basic_user_file /etc/nagios/passwd;
}
location ~ ^/nagios/(.*\.php)$ {
root /usr/share/nagios/html/;
auth_basic "Nagios";
auth_basic_user_file /etc/nagios/passwd;
rewrite ^/nagios/(.*) /$1 break;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME /usr/share/nagios/html$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
}
location ~ ^/nagios/cgi-bin/(.*\.cgi)$ {
gzip off;
root /usr/lib64/nagios/cgi-bin/;
auth_basic "Nagios";
auth_basic_user_file /etc/nagios/passwd;
rewrite ^/nagios/cgi-bin/(.*) /$1 break;
include /etc/nginx/fastcgi_params;
fastcgi_param AUTH_USER $remote_user;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param SCRIPT_FILENAME /usr/lib64/nagios/cgi-bin$fastcgi_script_name;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
}
location ~ ^/nagios/(.*\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf))$ {
root /usr/share/nagios/html/;
rewrite ^/nagios/(.*) /$1 break;
access_log off; expires max;
}
# id nagios
uid=497(nagios) gid=498(nagios) groups=498(nagios)
# id nginx
uid=498(nginx) gid=499(nginx) groups=499(nginx),498(nagios)
-------------
tried to run my custom perl script in "/usr/lib64/nagios/cgi-bin/" - OK
-------------
# nagios -v /etc/nagios/nagios.cfg
Code: Select all
Nagios Core 3.5.1
Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-30-2013
License: GPL
Website: http://www.nagios.org
Reading configuration data...
Read main config file okay...
Processing object config file '/etc/nagios/objects/commands.cfg'...
Processing object config file '/etc/nagios/objects/contacts.cfg'...
Processing object config file '/etc/nagios/objects/timeperiods.cfg'...
Processing object config file '/etc/nagios/objects/templates.cfg'...
Processing object config file '/etc/nagios/objects/localhost.cfg'...
Processing object config directory '/etc/nagios/servers'...
Processing object config file '/etc/nagios/servers/server.cfg'...
Read object config files okay...
Running pre-flight check on configuration data...
Checking services...
Checked 11 services.
Checking hosts...
Checked 2 hosts.
Checking host groups...
Checked 1 host groups.
Checking service groups...
Checked 0 service groups.
Checking contacts...
Checked 1 contacts.
Checking contact groups...
Checked 1 contact groups.
Checking service escalations...
Checked 0 service escalations.
Checking service dependencies...
Checked 0 service dependencies.
Checking host escalations...
Checked 0 host escalations.
Checking host dependencies...
Checked 0 host dependencies.
Checking commands...
Checked 24 commands.
Checking time periods...
Checked 5 time periods.
Checking for circular paths between hosts...
Checking for circular host and service dependencies...
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...
Total Warnings: 0
Total Errors: 0
Things look okay - No serious problems were detected during the pre-flight check
Home page is OK:
http://img96.imageshack.us/img96/8060/2xy9.png
But when clicking on other menu items with "Whoops":
http://img268.imageshack.us/img268/1224/0pbs.png
No error messages in logs either nginx or nagios
Any clues?
Last edited by
landacorp on Fri Oct 11, 2013 2:37 pm, edited 2 times in total.
abrist
Red Shirt
Posts: 8334 Joined: Thu Nov 15, 2012 1:20 pm
Post
by abrist » Wed Oct 09, 2013 12:14 pm
Have you had this working with Nginx in the past? I seem to recall Nginx having issues with cgis. . . .
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the
Dark Side .
lmiltchev
Bugs find me
Posts: 13589 Joined: Mon May 23, 2011 12:15 pm
Post
by lmiltchev » Wed Oct 09, 2013 12:23 pm
Run the following command and show the output:
Be sure to check out our
Knowledgebase for helpful articles and solutions!
landacorp
Posts: 8 Joined: Wed Oct 09, 2013 4:27 am
Post
by landacorp » Thu Oct 10, 2013 1:49 am
# grep nag /etc/group
nagios
498:apache,nginx
Hadn't used nginx for cgis before...
All packages: nagios, nginx were installed using yum.
apache was also installed automatically with php-fpm, but it's not running and not used... nginx serves all the dynamic and static content
landacorp
Posts: 8 Joined: Wed Oct 09, 2013 4:27 am
Post
by landacorp » Thu Oct 10, 2013 4:08 am
Forgot to mention:
I've checked my custom cgi-bin PERL script in plugins dir, and it's running OK in browser... So maybe it's a problem of chown/chmod?
Code: Select all
[/etc/nagios]# ls -Z
-rw-rw-r-- nagios nagios ? cgi.cfg
drwxr-x--- nagios nagios ? conf.d
-rw-rw-r-- nagios nagios ? nagios.cfg
-rw-r--r-- nagios nagios ? nrpe.cfg
drwxr-x--- nagios nagios ? objects
-rw-r----- nagios nginx ? passwd
drwxr-x--- nagios nagios ? private
drwxr-xr-x nagios nagios ? servers
[/usr/lib64/nagios/]# ls -Z
drwxrwxr-x root root ? cgi-bin
drwxrwxr-x root root ? plugins
[/usr/lib64/nagios/cgi-bin]# ls -Z
-rwxrwxr-x root root ? avail.cgi
-rwxrwxr-x root root ? cmd.cgi
-rwxrwxr-x root root ? config.cgi
-rwxrwxr-x root root ? extinfo.cgi
-rwxrwxr-x root root ? histogram.cgi
-rwxrwxr-x root root ? history.cgi
-rwxrwxr-x root root ? notifications.cgi
-rwxrwxr-x root root ? outages.cgi
-rwxrwxr-x root root ? showlog.cgi
-rwxrwxr-x root root ? status.cgi
-rwxrwxr-x root root ? statusmap.cgi
-rwxrwxr-x root root ? statuswml.cgi
-rwxrwxr-x root root ? statuswrl.cgi
-rwxrwxr-x root root ? summary.cgi
-rwxrwxr-x root root ? tac.cgi
-rwxrwxr-x root root ? trends.cgi
[/usr/lib64/nagios/plugins]# ls -Z
-rwxr-xr-x root root ? check_breeze
-rwxr-xr-x root root ? check_by_ssh
lrwxrwxrwx root root ? check_clamd -> check_tcp
-rwxr-xr-x root root ? check_cluster
-rwsr-x--- root nagios ? check_dhcp
-rwxr-xr-x root root ? check_dig
-rwxr-xr-x root root ? check_disk
-rwxr-xr-x root root ? check_disk_smb
-rwxr-xr-x root root ? check_dns
-rwxr-xr-x root root ? check_dummy
-rwxr-xr-x root root ? check_file_age
-rwxr-xr-x root root ? check_flexlm
-rwsr-x--- root nagios ? check_fping
lrwxrwxrwx root root ? check_ftp -> check_tcp
-rwxr-xr-x root root ? check_game
-rwxr-xr-x root root ? check_hpjd
-rwxr-xr-x root root ? check_http
-rwsr-x--- root nagios ? check_icmp
-rwsr-x--- root nagios ? check_ide_smart
lrwxrwxrwx root root ? check_imap -> check_tcp
-rwxr-xr-x root root ? check_ircd
lrwxrwxrwx root root ? check_jabber -> check_tcp
-rwxr-xr-x root root ? check_ldap
lrwxrwxrwx root root ? check_ldaps -> check_ldap
-rwxr-xr-x root root ? check_load
-rwxr-xr-x root root ? check_log
-rwxr-xr-x root root ? check_mailq
-rwxr-xr-x root root ? check_mrtg
-rwxr-xr-x root root ? check_mrtgtraf
-rwxr-xr-x root root ? check_mysql
-rwxr-xr-x root root ? check_mysql_query
-rwxr-xr-x root root ? check_nagios
lrwxrwxrwx root root ? check_nntp -> check_tcp
lrwxrwxrwx root root ? check_nntps -> check_tcp
-rwxr-xr-x root root ? check_nrpe
-rwxr-xr-x root root ? check_nt
-rwxr-xr-x root root ? check_ntp
-rwxr-xr-x root root ? check_ntp.pl
-rwxr-xr-x root root ? check_ntp_peer
-rwxr-xr-x root root ? check_ntp_time
-rwxr-xr-x root root ? check_nwstat
-rwxr-xr-x root root ? check_oracle
-rwxr-xr-x root root ? check_overcr
-rwxr-xr-x root root ? check_pgsql
-rwxr-xr-x root root ? check_ping
lrwxrwxrwx root root ? check_pop -> check_tcp
-rwxr-xr-x root root ? check_procs
-rwxr-xr-x root root ? check_real
-rwxr-xr-x root root ? check_rpc
-rwxr-xr-x root root ? check_sensors
lrwxrwxrwx root root ? check_simap -> check_tcp
-rwxr-xr-x root root ? check_smtp
-rwxr-xr-x root root ? check_snmp
lrwxrwxrwx root root ? check_spop -> check_tcp
-rwxr-xr-x root root ? check_ssh
lrwxrwxrwx root root ? check_ssmtp -> check_tcp
-rwxr-xr-x root root ? check_swap
-rwxr-xr-x root root ? check_tcp
-rwxr-xr-x root root ? check_time
lrwxrwxrwx root root ? check_udp -> check_tcp
-rwxr-xr-x root root ? check_ups
-rwxr-xr-x root root ? check_users
-rwxr-xr-x root root ? check_wave
drwxr-xr-x root root ? eventhandlers
-rwxr-xr-x root root ? negate
-rwxr-xr-x root root ? urlize
-rw-r--r-- root root ? utils.pm
-rwxr-xr-x root root ? utils.sh
[/usr/share/nagios/html/]# ls -Z
-rw-r----- nginx nginx ? config.inc.php
drwxrwxr-x nginx nginx ? contexthelp
drwxrwxr-x nginx nginx ? docs
-rw-rw-r-- nginx nginx ? favicon.ico
drwxrwxr-x nginx nginx ? images
drwxrwxr-x nginx nginx ? includes
-rw-rw-r-- nginx nginx ? index.php
drwxrwxr-x nginx nginx ? js
-rw-rw-r-- nginx nginx ? main.php
drwxrwxr-x nginx nginx ? media
-rw-rw-r-- nginx nginx ? robots.txt
-rw-rw-r-- nginx nginx ? rss-corefeed.php
-rw-rw-r-- nginx nginx ? rss-newsfeed.php
-rw-rw-r-- nginx nginx ? side.php
drwxrwxr-x nginx nginx ? ssi
drwxrwxr-x nginx nginx ? stylesheets
[/var/spool/nagios/]# ls -Z
drwxrwsr-x nagios nginx ? cmd
[/var/spool/nagios/cmd/]# ls -Z
prw-rw---- nagios nginx ? nagios.cmd
slansing
Posts: 7698 Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...
Post
by slansing » Thu Oct 10, 2013 11:11 am
We do not actively support using nginx as nagios ships with Apache support only however we can try to help, at some point if we cannot get this resolved we may have to point you elsewhere. I would take a look through these guides and make sure you have everything configured properly with nginx, do you have the original guide you followed to configure it? If so please share it so we can take a look:
http://johan.cc/2012/02/06/nagios-nginx/
http://idevit.nl/node/93
There are a number of ways to configure it to serve nagios, which may be part of the issue.
landacorp
Posts: 8 Joined: Wed Oct 09, 2013 4:27 am
Post
by landacorp » Fri Oct 11, 2013 4:04 am
Hi slansing,
Unfortunately both links you've posted are ubuntu related, and I have centos.
Those things are about nginx configurations, but it seems that problem is somewhere between nagios and nginx, because:
1) nagios says no errors in config
2) nginx is working well and if i put my custom test.cgi in "/usr/lib64/nagios/cgi-bin" it's running ok in browser with url ".../nagios/cgi-bin/test.cgi"
3) No errors in logs - which is strange
So what else can it be?
abrist
Red Shirt
Posts: 8334 Joined: Thu Nov 15, 2012 1:20 pm
Post
by abrist » Fri Oct 11, 2013 11:22 am
landacorp wrote: nginx is working well and if i put my custom test.cgi in "/usr/lib64/nagios/cgi-bin" it's running ok in browser with url ".../nagios/cgi-bin/test.cgi"
Does your cgi require authentication though? The nagios cgis do require auth, and this is usually the issue people have with nginx and the nagios cgis.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the
Dark Side .
landacorp
Posts: 8 Joined: Wed Oct 09, 2013 4:27 am
Post
by landacorp » Sat Oct 12, 2013 3:23 am
Hi all,
Just wanted to say thanks for help!
I've moved to apache and it worked right away...
My steps were:
1) Tried to disable authentication for nagios cgis (/etc/nagios/cgi.cfg) use_authentication=0 - didn't help
2) Started httpd with preinstalled (/etc/httpd/conf.d/nagios.conf) - and it worked!
So, it seems like i need to run nginx for the main purposes and apache for "backend"...
I could live with that, but if you have more ideas, i would like to try...