Re: SSI problem
Posted: Thu Jan 23, 2014 4:31 am
Finally i decided modified the extinfo.c directly and not use the ssi files
Thank you for your support
Thank you for your support
Support for Nagios products and services
https://support.nagios.com/forum/
Code: Select all
ScriptAlias /nagios/cgi-bin/ "/usr/lib64/nagios/cgi-bin/"
<Directory "/usr/lib64/nagios/cgi-bin/">
# SSLRequireSSL
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /etc/nagios/passwd
Require valid-user
</Directory>
Alias /nagios "/usr/share/nagios/html"
<Directory "/usr/share/nagios/html">
# SSLRequireSSL
Options None
AllowOverride None
Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /etc/nagios/passwd
Require valid-user
</Directory>
Code: Select all
<p>IT IS A TEST </p>
Code: Select all
<!--#echo var="DATE_LOCAL" -->
Code: Select all
<p>IT IS A TEST </p>
Code: Select all
</TD>
</TR>
</TABLE>
</DIV>
<!--#echo var="DATE_LOCAL" -->
<!-- Produced by Nagios (http://www.nagios.org). Copyright (c) 1999-2007 Ethan Galstad. -->
</body>
</html>
Code: Select all
[Thu Jan 23 03:06:01 2014] [error] [client 192.168.176.64] /usr/share/nagios/html/ssi/extinfo-footer.ssi: line 1: syntax error near unexpected token `newline', referer: http://192.168.176.43/nagios/cgi-bin//extinfo.cgi?type=2&host=localhost&service=Current+Load
[Thu Jan 23 03:06:01 2014] [error] [client 192.168.176.64] /usr/share/nagios/html/ssi/extinfo-footer.ssi: line 1: `<!--#echo var="DATE_LOCAL" -->', referer: http://192.168.176.43/nagios/cgi-bin//extinfo.cgi?type=2&host=localhost&service=Current+Load
Code: Select all
[root@nagiostestC ssi]# ./extinfo-footer.ssi
./extinfo-footer.ssi: line 1: syntax error near unexpected token `newline'
./extinfo-footer.ssi: line 1: `<!--#echo var="DATE_LOCAL" -->'
Code: Select all
<!--#echo var="DATE_LOCAL" -->
Code: Select all
#!/usr/bin/perl
#
#
use strict;
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
print eval($year+1900) . '-' . eval($mon+1) . '-' . $mday . ' ' . $hour . ':' . $min . ':' . $sec ."\n";
exit(0);
Code: Select all
chmod 755 /usr/share/nagios/html/ssi/extinfo-footer.ssi
Code: Select all
[root@nagiostestC ssi]# /usr/share/nagios/html/ssi/extinfo-footer.ssi
2014-1-23 3:9:59
Code: Select all
</TD>
</TR>
</TABLE>
</DIV>
2014-1-23 3:29:31
<!-- Produced by Nagios (http://www.nagios.org). Copyright (c) 1999-2007 Ethan Galstad. -->
</body>
Code: Select all
#!/usr/bin/ruby
#
#
time = Time.new
puts "Current time: " + time.inspect
Code: Select all
[root@nagiostestC ssi]# ./extinfo-footer.ssi
Current time: Thu Jan 23 03:55:52 -0600 2014
Unless you want to make the change every time you update nagios, you really don't want to do that...pepe_carlos wrote:Finally i decided modified the extinfo.c directly and not use the ssi files
Code: Select all
<Directory "/usr/local/nagios/sbin">
# SSLRequireSSL
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
</Directory>
Alias /nagios "/usr/local/nagios/share"
<Directory "/usr/local/nagios/share">
# SSLRequireSSL
# Options None
Options Includes
AllowOverride None
Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
</Directory>Code: Select all
# SAMPLE CONFIG SNIPPETS FOR APACHE WEB SERVER
# Last Modified: 11-26-2005
#
# This file contains examples of entries that need
# to be incorporated into your Apache web server
# configuration file. Customize the paths, etc. as
# needed to fit your system.
ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"
<Directory "/usr/local/nagios/sbin">
# SSLRequireSSL
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
</Directory>
Alias /nagios "/usr/local/nagios/share"
<Directory "/usr/local/nagios/share">
# SSLRequireSSL
Options None
AllowOverride None
Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
</Directory>
Code: Select all
#!/usr/bin/ruby
#
#
time = Time.new
puts "Current time: " + time.inspect
Code: Select all
chmod 755 /usr/local/nagios/share/ssi/extinfo-footer.ssi
Code: Select all
root@nagiostestC ssi]# /usr/local/nagios/share/ssi/extinfo-footer.ssi
Current time: Thu Jan 23 06:11:15 -0600 2014
Code: Select all
ls -aslh /usr/local/nagios
Code: Select all
ls -aslh /usr/local/nagios/share
Code: Select all
ls -aslh /usr/local/nagios/share/ssi
Code: Select all
# /usr/local/nagios/share/ssi/extinfo-footer.ssi
Current time: Thu Jan 23 13:31:05 +0100 2014Code: Select all
ls -aslh /usr/local/nagios
total 36K
4.0K drwxr-xr-x 9 root root 4.0K Jan 23 13:34 .
4.0K drwxr-xr-x. 18 root root 4.0K Jan 15 17:51 ..
4.0K drwxrwxr-x 2 nagios nagios 4.0K Jan 8 18:39 bin
4.0K drwxrwxr-x 3 nagios nagios 4.0K Jan 16 17:11 etc
4.0K drwxrwxr-x 5 nagios nagios 4.0K Jan 22 11:28 libexec
4.0K drwxrwxr-x 2 nagios nagios 4.0K Jan 22 18:37 sbin
4.0K drwxrwxr-x 17 nagios nagios 4.0K Jan 22 17:10 share
4.0K drwxrwxr-x 5 nagios nagios 4.0K Jan 23 13:34 varCode: Select all
# ls -aslh /usr/local/nagios/share
total 740K
4.0K drwxrwxr-x 17 nagios nagios 4.0K Jan 22 17:10 .
4.0K drwxr-xr-x 9 root root 4.0K Jan 23 13:34 ..
4.0K -rw-rw-r-- 1 nagios nagios 576 Mar 17 2011 config.inc.php
4.0K -rwxr-xr-x 1 nagios nagios 1.8K May 13 2005 config.js
4.0K drwxrwxr-x 2 nagios nagios 4.0K Mar 17 2011 contexthelp
4.0K drwxrwxr-x 4 nagios nagios 4.0K Jul 17 2012 docs
4.0K drwxr-xr-x 4 nagios nagios 4.0K Sep 20 2012 images
4.0K drwxrwxr-x 3 nagios nagios 4.0K Mar 17 2011 includes
4.0K -rw-r--r-- 1 nagios nagios 1.7K Sep 19 15:33 index.html
4.0K -rw-rw-r-- 1 nagios nagios 1.5K Jun 17 2011 index.php
4.0K drwxrwxr-x 2 nagios nagios 4.0K Jan 16 16:46 js
4.0K drwxr-xr-x 4 nagios nagios 4.0K Oct 26 2009 locale
8.0K -rw-rw-r-- 1 nagios nagios 5.8K Oct 4 10:29 main.php
4.0K drwxrwxr-x 2 nagios nagios 4.0K Oct 26 2009 media
4.0K -rw-rw-r-- 1 nagios nagios 26 Mar 17 2011 robots.txt
4.0K drwxrwxr-x 2 nagios nagios 4.0K Jan 22 18:13 ssi
4.0K drwxr-xr-x 2 nagios nagios 4.0K May 9 2011 stylesheets
4.0K -rw-r--r-- 1 root root 31 Jan 22 17:07 test.shtmlCode: Select all
# ls -aslh /usr/local/nagios/share/ssi
total 36K
4.0K drwxrwxr-x 2 nagios nagios 4.0K Jan 22 18:13 .
4.0K drwxrwxr-x 17 nagios nagios 4.0K Jan 22 17:10 ..
4.0K -rwxr-xr-x 1 nagios nagios 73 Jan 23 13:28 extinfo-footer.ssiCode: Select all
ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"
Code: Select all
[root@nagiostestC ssi]# cat /usr/local/nagios/etc/cgi.cfg |grep physical_html_path
physical_html_path=/usr/local/nagios/share
What about settings in your /usr/local/nagios/etc/cgi.cfg, specifically the physical_html_path:
Code: Select all
# cat /usr/local/nagios/etc/cgi.cfg |grep physical_html_path
physical_html_path=/usr/local/nagios