Page 1 of 2
manual compile of CGIs and incorrect image/css source
Posted: Fri Mar 20, 2015 7:25 pm
by node-nine_inc
Hello.
I'm likely doing something face-palm stupid here, but I'm pretty familiar with the compilation process...yet am stumped where I'm going wrong.
nagios-4.0.8. Just pulled down the latest source of this version. I need to build from source and have been building Nagios from source since back in the 1.x days, so have definitely done this many many many times before.
I'm using the following configure string:
=====
Code: Select all
./configure --enable-event-broker --localstatedir=/var/demo.foo.com --sysconfdir=/etc/demo.foo.com --infodir=/var/www/localhost/demo.foo.com/info --mandir=/var/www/localhost/demo.foo.com/man --prefix=/var/www/localhost/demo.foo.com --with-nagios-user=demo.foo.com --with-nagios-grp=apache --with-command-user=demo.foo.com --with-command-grp=apache --datarootdir=/var/www/localhost/demo.foo.com/share --with-htmurl= --with-cgiurl=/cgi-bin
=====
Everything compiles and installs just fine.
The trouble I'm having is that the CGIs are for some reason looking in their local dir (sbin) for the images and CSS files that control their page output/display as opposed to looking in the share/images and share/stylesheets dir as they should.
ex>
=====[ Apache logs of problem
Code: Select all
[Fri Mar 20 12:11:15.577821 2015] [cgi:error] [pid 2746] [client x.x.x.x:52356] script not found or unable to stat: /var/www/localhost/demo.foo.com/sbin/status.css, referer: http://demo.foo.com/cgi-bin/status.cgi?host=all
[Fri Mar 20 12:11:15.577821 2015] [cgi:error] [pid 32020] [client x.x.x.x:52354] script not found or unable to stat: /var/www/localhost/demo.foo.com/sbin/common.css, referer: http://demo.foo.com/cgi-bin/status.cgi?host=all
[Fri Mar 20 12:11:15.578049 2015] [cgi:error] [pid 9474] [client x.x.x.x:52357] script not found or unable to stat: /var/www/localhost/demo.foo.com/sbin/jquery-1.7.1.min.js, referer: http://demo.foo.com/cgi-bin/status.cgi?host=all
[Fri Mar 20 12:11:15.651873 2015] [cgi:error] [pid 32020] [client x.x.x.x:52354] script not found or unable to stat: /var/www/localhost/demo.foo.com/sbin/contexthelp1.gif, referer: http://demo.foo.com/cgi-bin/status.cgi?host=all
[Fri Mar 20 12:11:15.651870 2015] [cgi:error] [pid 9474] [client x.x.x.x:52357] script not found or unable to stat: /var/www/localhost/demo.foo.com/sbin/up.gif, referer: http://demo.foo.com/cgi-bin/status.cgi?host=all
[Fri Mar 20 12:11:15.658766 2015] [cgi:error] [pid 2746] [client x.x.x.x:52356] script not found or unable to stat: /var/www/localhost/demo.foo.com/sbin/down.gif, referer: http://demo.foo.com/cgi-bin/status.cgi?host=all
[Fri Mar 20 12:11:15.665647 2015] [cgi:error] [pid 9474] [client x.x.x.x:52357] script not found or unable to stat: /var/www/localhost/demo.foo.com/sbin/ndisabled.gif, referer: http://demo.foo.com/cgi-bin/status.cgi?host=all
=====
This causes the output of all the CGIs to be garbled and missing content since none of the layout or imagery renders.
Has anyone run across this? And if so, can you please smack me upside the head with the clue bat? I'm not seeing where I'm missing what's going on.
Re: manual compile of CGIs and incorrect image/css source
Posted: Sat Mar 21, 2015 5:07 am
by rhassing
Which OS and distribution are you using?
Re: manual compile of CGIs and incorrect image/css source
Posted: Sat Mar 21, 2015 3:18 pm
by node-nine_inc
This particular installation is on a Gentoo Linux system, but I am building entirely from source -vs- using emerge.
Re: manual compile of CGIs and incorrect image/css source
Posted: Mon Mar 23, 2015 10:31 am
by tgriep
Could you run the following in a shell and post back the results?
Code: Select all
ll /var/www/localhost/demo.foo.com
ll /var/www/localhost/demo.foo.com/sbin
Re: manual compile of CGIs and incorrect image/css source
Posted: Mon Mar 23, 2015 5:06 pm
by node-nine_inc
Don't have an 'll' command or alias.
Code: Select all
sdca-m5-1 ~ # ll /var/www/localhost/demo.foo.com
-bash: ll: command not found
sdca-m5-1 ~ # ll /var/www/localhost/demo.foo.com/sbin
-bash: ll: command not found
But assuming you're looking for a long file listing, here it is. I create a separate user to run the process as.
Code: Select all
sdca-m5-1 ~ # ls -l /var/www/localhost/demo.foo.com
total 28
drwxrwxr-x 2 demo.foo.com nagios 4096 Mar 19 18:28 bin
drwxr-xr-x 3 root root 4096 Mar 19 17:09 include
drwxr-xr-x 2 root root 4096 Mar 19 18:28 lib
drwxrwxr-x 2 demo.foo.com nagios 4096 Mar 19 17:19 libexec
drwxr-xr-x 5 root root 4096 Mar 19 17:19 perl
drwxrwxr-x 2 demo.foo.com nagios 4096 Mar 19 18:28 sbin
drwxrwxr-x 11 demo.foo.com nagios 4096 Mar 19 18:28 share
sdca-m5-1 ~ # ls -l /var/www/localhost/demo.foo.com/sbin
total 5844
-rwxrwxr-x 1 demo.foo.com nagios 356916 Mar 19 18:28 archivejson.cgi
-rwxrwxr-x 1 demo.foo.com nagios 341452 Mar 19 18:28 avail.cgi
-rwxrwxr-x 1 demo.foo.com nagios 330396 Mar 19 18:28 cmd.cgi
-rwxrwxr-x 1 demo.foo.com nagios 312708 Mar 19 18:28 config.cgi
-rwxrwxr-x 1 demo.foo.com nagios 353696 Mar 19 18:28 extinfo.cgi
-rw-r--r-- 1 demo.foo.com nagios 822 Mar 19 17:33 favicon.ico
-rwxrwxr-x 1 demo.foo.com nagios 300496 Mar 19 18:28 histogram.cgi
-rwxrwxr-x 1 demo.foo.com nagios 279980 Mar 19 18:28 history.cgi
-rwxrwxr-x 1 demo.foo.com nagios 275872 Mar 19 18:28 notifications.cgi
-rwxrwxr-x 1 demo.foo.com nagios 361908 Mar 19 18:28 objectjson.cgi
-rwxrwxr-x 1 demo.foo.com nagios 271756 Mar 19 18:28 outages.cgi
-rwxrwxr-x 1 demo.foo.com nagios 271764 Mar 19 18:28 showlog.cgi
-rwxrwxr-x 1 demo.foo.com nagios 357820 Mar 19 18:28 status.cgi
-rwxrwxr-x 1 demo.foo.com nagios 350740 Mar 19 18:28 statusjson.cgi
-rwxrwxr-x 1 demo.foo.com nagios 300480 Mar 19 18:28 statusmap.cgi
-rwxrwxr-x 1 demo.foo.com nagios 292256 Mar 19 18:28 statuswml.cgi
-rwxrwxr-x 1 demo.foo.com nagios 275884 Mar 19 18:28 statuswrl.cgi
-rwxrwxr-x 1 demo.foo.com nagios 300500 Mar 19 18:28 summary.cgi
-rwxrwxr-x 1 demo.foo.com nagios 288228 Mar 19 18:28 tac.cgi
-rwxrwxr-x 1 demo.foo.com nagios 308696 Mar 19 18:28 trends.cgi
Re: manual compile of CGIs and incorrect image/css source
Posted: Tue Mar 24, 2015 11:41 am
by ssax
Looks like your --with-htmurl= is blank, did you try fixing that and compiling?
Re: manual compile of CGIs and incorrect image/css source
Posted: Tue Mar 24, 2015 7:19 pm
by node-nine_inc
Whenever I fill that out, I get weird output at the completion summary for configure.
ex>
Code: Select all
./configure --enable-event-broker --localstatedir=/var/demo.foo.com --sysconfdir=/etc/demo.foo.com --infodir=/var/www/localhost/demo.foo.com/info --mandir=/var/www/localhost/demo.foo.com/man --prefix=/var/www/localhost/demo.foo.com --with-nagios-user=demo.foo.com --with-nagios-grp=apache --with-command-user=demo.foo.com --with-command-grp=apache --datarootdir=/var/www/localhost/demo.foo.com/share --with-htmurl=http://demo.foo.com --with-cgiurl=/cgi-bin
ends up outputting the following when it completes:
Code: Select all
*** Configuration summary for nagios 4.0.8 08-12-2014 ***:
General Options:
-------------------------
Nagios executable: nagios
Nagios user/group: demo.foo.com,nagios
Command user/group: demo.foo.com,nagios
Event Broker: yes
Install ${prefix}: /var/www/localhost/demo.foo.com
Install ${includedir}: /var/www/localhost/demo.foo.com/include/nagios
Lock file: /var/demo.foo.com/nagios.lock
Check result directory: /var/demo.foo.com/spool/checkresults
Init directory: /etc/init.d
Apache conf.d directory: /etc/httpd/conf.d
Mail program: /usr/bin/mail
Host OS: linux-gnu
IOBroker Method: epoll
Web Interface Options:
------------------------
HTML URL: http://localhosthttp://demo.foo.com/
CGI URL: http://localhost/cgi-bin/
Traceroute (used by WAP): /usr/bin/traceroute
Review the options above for accuracy. If they look okay,
type 'make all' to compile the main program and CGIs.
If I leave out the http portion, I still see weird outputs:
Code: Select all
./configure --enable-event-broker --localstatedir=/var/demo.foo.com --sysconfdir=/etc/demo.foo.com --infodir=/var/www/localhost/demo.foo.com/info --mandir=/var/www/localhost/demo.foo.com/man --prefix=/var/www/localhost/demo.foo.com --with-nagios-user=demo.foo.com --with-nagios-grp=apache --with-command-user=demo.foo.com --with-command-grp=apache --datarootdir=/var/www/localhost/demo.foo.com/share --with-htmurl=demo.foo.com --with-cgiurl=/cgi-bin
results in:
Code: Select all
*** Configuration summary for nagios 4.0.8 08-12-2014 ***:
General Options:
-------------------------
Nagios executable: nagios
Nagios user/group: demo.foo.com,nagios
Command user/group: demo.foo.com,nagios
Event Broker: yes
Install ${prefix}: /var/www/localhost/demo.foo.com
Install ${includedir}: /var/www/localhost/demo.foo.com/include/nagios
Lock file: /var/demo.foo.com/nagios.lock
Check result directory: /var/demo.foo.com/spool/checkresults
Init directory: /etc/init.d
Apache conf.d directory: /etc/httpd/conf.d
Mail program: /usr/bin/mail
Host OS: linux-gnu
IOBroker Method: epoll
Web Interface Options:
------------------------
HTML URL: http://localhostdemo.foo.com/
CGI URL: http://localhost/cgi-bin/
Traceroute (used by WAP): /usr/bin/traceroute
Review the options above for accuracy. If they look okay,
type 'make all' to compile the main program and CGIs.
In the past, all my custom compile versions (from 3.x back down to 1.x) I've always left the html-url portion blank and it has worked appropriately.
Re: manual compile of CGIs and incorrect image/css source
Posted: Wed Mar 25, 2015 11:21 am
by ssax
Re: manual compile of CGIs and incorrect image/css source
Posted: Wed Mar 25, 2015 5:24 pm
by node-nine_inc
Sadly still no dice.
Code: Select all
nagios-4.0.8 # ./configure --enable-event-broker --localstatedir=/var/demo.foo.com --sysconfdir=/etc/demo.foo.com --infodir=/var/www/localhost/demo.foo.com/info --mandir=/var/www/localhost/demo.foo.com/man --prefix=/var/www/localhost/demo.foo.com --with-nagios-user=demo.foo.com --with-nagios-grp=apache --with-command-user=demo.foo.com --with-command-grp=apache --datarootdir=/var/www/localhost/demo.foo.com/share --with-htmurl='/' --with-cgiurl=/cgi-bin
*** Configuration summary for nagios 4.0.8 08-12-2014 ***:
General Options:
-------------------------
Nagios executable: nagios
Nagios user/group: demo.foo.com,nagios
Command user/group: demo.foo.com,nagios
Event Broker: yes
Install ${prefix}: /var/www/localhost/demo.foo.com
Install ${includedir}: /var/www/localhost/demo.foo.com/include/nagios
Lock file: /var/demo.foo.com/nagios.lock
Check result directory: /var/demo.foo.com/spool/checkresults
Init directory: /etc/init.d
Apache conf.d directory: /etc/httpd/conf.d
Mail program: /usr/bin/mail
Host OS: linux-gnu
IOBroker Method: epoll
Web Interface Options:
------------------------
HTML URL: http://localhost//
CGI URL: http://localhost/cgi-bin/
Traceroute (used by WAP): /usr/bin/traceroute
Review the options above for accuracy. If they look okay,
type 'make all' to compile the main program and CGIs.
The CGIs still end up looking in the /cgi-bin/ location for their related .css and .png files (which is the sbin folder).
Code: Select all
demo.foo.com 68.8.82.222 - - [25/Mar/2015:15:12:47 -0700] "GET /cgi-bin/tac.cgi HTTP/1.1" 200 12423 "http://demo.foo.com/side.php" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:36.0) Gecko/20100101 Firefox/36.0" VLOG=-
demo.foo.com 68.8.82.222 - - [25/Mar/2015:15:12:47 -0700] "GET /cgi-bin/common.css HTTP/1.1" 404 289 "http://demo.foo.com/cgi-bin/tac.cgi" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:36.0) Gecko/20100101 Firefox/36.0" VLOG=-
demo.foo.com 68.8.82.222 - - [25/Mar/2015:15:12:47 -0700] "GET /cgi-bin/tac.css HTTP/1.1" 404 286 "http://demo.foo.com/cgi-bin/tac.cgi" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:36.0) Gecko/20100101 Firefox/36.0" VLOG=-
demo.foo.com 68.8.82.222 - - [25/Mar/2015:15:12:47 -0700] "GET /cgi-bin/contexthelp2.gif HTTP/1.1" 404 295 "http://demo.foo.com/cgi-bin/tac.cgi" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:36.0) Gecko/20100101 Firefox/36.0" VLOG=-
demo.foo.com 68.8.82.222 - - [25/Mar/2015:15:12:47 -0700] "GET /cgi-bin/thermok.png HTTP/1.1" 404 290 "http://demo.foo.com/cgi-bin/tac.cgi" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:36.0) Gecko/20100101 Firefox/36.0" VLOG=-
demo.foo.com 68.8.82.222 - - [25/Mar/2015:15:12:47 -0700] "GET /cgi-bin/tacenabled.png HTTP/1.1" 404 293 "http://demo.foo.com/cgi-bin/tac.cgi" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:36.0) Gecko/20100101 Firefox/36.0" VLOG=-
demo.foo.com 68.8.82.222 - - [25/Mar/2015:15:12:47 -0700] "GET /cgi-bin/thermcrit.png HTTP/1.1" 404 292 "http://demo.foo.com/cgi-bin/tac.cgi" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:36.0) Gecko/20100101 Firefox/36.0" VLOG=-
I'd even tried copying these .css and .png files to the location being referenced, but seeing as how this it the ScriptAlias cgi-bin folder, I then get errors about 'unable to execute' for these files.
Something is still amiss.
Re: manual compile of CGIs and incorrect image/css source
Posted: Thu Mar 26, 2015 7:51 am
by node-nine_inc
+ssax
I finally read the whole bug report you linked to. Manually setting the 'url_html_path' value in cgi.cfg did the trick.
I cannot thank you enough for helping me find this!!!!!!!!! I've been pulling out my little remaining hair trying to find what option was mistaken causing the URL pathing to be incorrect.
Your linked bug-report saved the day.
Cheers mate. If you're ever out in the San Diego California area...hit me up and I owe you a couple sudsy malted hops beverages.
