Revision: 7418
          http://sourceforge.net/p/ipcop/svn/7418
Author:   owes
Date:     2014-04-05 19:57:44 +0000 (Sat, 05 Apr 2014)
Log Message:
-----------
Add a (simple) GUI page for proxy status directly from squid/manager.

Modified Paths:
--------------
    ipcop/trunk/config/rootfiles/common/ipcop-gui
    ipcop/trunk/src/scripts/makegraphs.pl
    ipcop/trunk/updates/2.1.4/ROOTFILES.i486-2.1.4

Added Paths:
-----------
    ipcop/trunk/html/cgi-bin/proxystatus.cgi

Modified: ipcop/trunk/config/rootfiles/common/ipcop-gui
===================================================================
--- ipcop/trunk/config/rootfiles/common/ipcop-gui       2014-04-05 19:54:00 UTC 
(rev 7417)
+++ ipcop/trunk/config/rootfiles/common/ipcop-gui       2014-04-05 19:57:44 UTC 
(rev 7418)
@@ -33,6 +33,7 @@
 home/httpd/cgi-bin/pppsetup.cgi
 home/httpd/cgi-bin/proxy.cgi
 home/httpd/cgi-bin/proxygraphs.cgi
+home/httpd/cgi-bin/proxystatus.cgi
 home/httpd/cgi-bin/remote.cgi
 home/httpd/cgi-bin/scheduler.cgi
 home/httpd/cgi-bin/servicegrps.cgi

Added: ipcop/trunk/html/cgi-bin/proxystatus.cgi
===================================================================
--- ipcop/trunk/html/cgi-bin/proxystatus.cgi                            (rev 0)
+++ ipcop/trunk/html/cgi-bin/proxystatus.cgi    2014-04-05 19:57:44 UTC (rev 
7418)
@@ -0,0 +1,82 @@
+#!/usr/bin/perl
+#
+# This file is part of the IPCop Firewall.
+#
+# IPCop is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# IPCop is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with IPCop.  If not, see <http://www.gnu.org/licenses/>.
+#
+# $Id$
+#
+
+# Add entry in menu
+# MENUENTRY status 035 "proxy" "proxy"
+#
+# Make sure translation exists $Lang::tr{'proxy'}
+
+use strict;
+
+use warnings; no warnings 'once';
+use CGI::Carp 'fatalsToBrowser';
+
+require '/usr/lib/ipcop/general-functions.pl';
+require '/usr/lib/ipcop/lang.pl';
+require '/usr/lib/ipcop/header.pl';
+
+&Header::showhttpheaders();
+&Header::openpage($Lang::tr{'proxy'}, 1, '');
+&Header::openbigbox('100%', 'left');
+&Header::openbox('100%', 'left', $Lang::tr{'proxy'});
+
+my $sactive = &General::isrunning('squid', 'nosize');
+
+print <<END
+<form method='post' action='$ENV{'SCRIPT_NAME'}'>
+<table width='100%'>
+<tr>
+    <td width='25%'>$Lang::tr{'web proxy'}:</td>
+    $sactive
+    <td width='25%'>&nbsp;</td>
+    <td width='25%'>&nbsp;</td>
+</tr>
+</table>
+<hr />
+<table width='100%'>
+<tr>
+    <td class='comment1button'>&nbsp;</td>
+    <td class='button1button'><input type='submit' name='ACTION' 
value='$Lang::tr{'refresh'}' /></td>
+    <td class='onlinehelp'>
+        <a href='${General::adminmanualurl}/status-proxy.html' 
target='_blank'><img src='/images/web-support.png' alt='$Lang::tr{'online help 
en'}' title='$Lang::tr{'online help en'}' /></a>
+    </td>
+</tr>
+</table></form>
+<hr />
+END
+;
+
+if (open(IPACHTML, '/var/log/squid/info')) {
+    my $skip = 1;
+    print "<pre>";
+    while (<IPACHTML>) {
+        $skip = 0 if (/Squid Object Cache/);
+        print unless ($skip);
+    }
+    print "</pre>";
+    close(IPACHTML);
+}
+else {
+    print $Lang::tr{'no information available'};
+}
+
+&Header::closebox();
+&Header::closebigbox();
+&Header::closepage();


Property changes on: ipcop/trunk/html/cgi-bin/proxystatus.cgi
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Modified: ipcop/trunk/src/scripts/makegraphs.pl
===================================================================
--- ipcop/trunk/src/scripts/makegraphs.pl       2014-04-05 19:54:00 UTC (rev 
7417)
+++ ipcop/trunk/src/scripts/makegraphs.pl       2014-04-05 19:57:44 UTC (rev 
7418)
@@ -25,6 +25,7 @@
 
 #use warnings;
 
+use IO::Socket;
 use RRDs;
 require '/usr/lib/ipcop/general-functions.pl';
 require '/usr/lib/ipcop/lang.pl';
@@ -494,6 +495,26 @@
     print "Error in RRD::update for $interface: $ERROR\n" if $ERROR;
 }
 
+sub updatesquiddata {
+    my $sock;
+    my $host = "127.0.0.1";
+    my $port = "82";
+
+    $sock = IO::Socket::INET->new(PeerAddr => scalar($host), PeerPort => 
$port, Proto => 'tcp') or die("$host:$port: $!");
+    $sock->autoflush(1);
+    print $sock "GET cache_object://$host/info HTTP/1.0\n\n";
+    my @result = <$sock>;
+    close $sock;
+
+    open(FILE, ">/var/log/squid/info");
+    foreach(@result) {
+        print FILE $_;
+    }
+    close(FILE);
+
+}
+
+
 ###
 ### Squid Graphs
 ###
@@ -597,3 +618,5 @@
         updateifgraph($thisitf, "year");
     }
 }
+
+updatesquiddata();

Modified: ipcop/trunk/updates/2.1.4/ROOTFILES.i486-2.1.4
===================================================================
--- ipcop/trunk/updates/2.1.4/ROOTFILES.i486-2.1.4      2014-04-05 19:54:00 UTC 
(rev 7417)
+++ ipcop/trunk/updates/2.1.4/ROOTFILES.i486-2.1.4      2014-04-05 19:57:44 UTC 
(rev 7418)
@@ -1,6 +1,8 @@
 ## please place IPCop files first, then packages sorted by alphabetical order
 ##
 /home/httpd/cgi-bin/credits.cgi
+/home/httpd/cgi-bin/proxystatus.cgi
+/usr/local/bin/makegraphs.pl
 /usr/local/sbin/setup
 ##
 ## memtest-5.01

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
_______________________________________________
Ipcop-svn mailing list
Ipcop-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipcop-svn

Reply via email to