]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
Add a cgi to display atm-modem status
authorArne Fitzenreiter <arne_f@ipfire.org>
Sun, 22 Feb 2009 11:10:13 +0000 (12:10 +0100)
committerArne Fitzenreiter <arne_f@ipfire.org>
Sun, 22 Feb 2009 11:10:13 +0000 (12:10 +0100)
config/menu/20-status.menu
config/rootfiles/common/apache2
config/rootfiles/core/27/files
html/cgi-bin/atm-status.cgi [new file with mode: 0644]

index daf5f49a8cf3bfc3521bc5d95d1cec1172a04c66..3e80adae6cf9ec484c6e135e6a0aa900ecaa8b93 100644 (file)
@@ -64,3 +64,8 @@
                                'title' => "$Lang::tr{'qos graphs'}",
                                'enabled' => 1,
                                };
                                'title' => "$Lang::tr{'qos graphs'}",
                                'enabled' => 1,
                                };
+    $substatus->{'75.atm-status'} = {'caption' => 'Atm-status',
+                                 'uri' => '/cgi-bin/atm-status.cgi',
+                                 'title' => 'Atm-status',
+                                 'enabled' => `find /sys/class/atm/*/device`,
+                                 };
index eb6d38d1092eaf2b424d40f19733fe611a7262cb..0154fd45d56da4c21127899c4b27d758fa7e8f69 100644 (file)
@@ -1298,6 +1298,7 @@ etc/httpd/conf/uid.conf
 #etc/httpd/conf/vhosts.d
 etc/httpd/conf/vhosts.d/ipfire-interface-ssl.conf
 etc/httpd/conf/vhosts.d/ipfire-interface.conf
 #etc/httpd/conf/vhosts.d
 etc/httpd/conf/vhosts.d/ipfire-interface-ssl.conf
 etc/httpd/conf/vhosts.d/ipfire-interface.conf
+srv/web/ipfire/cgi-bin/atm-status.cgi
 srv/web/ipfire/cgi-bin/backup.cgi
 srv/web/ipfire/cgi-bin/chpasswd.cgi
 srv/web/ipfire/cgi-bin/connections.cgi
 srv/web/ipfire/cgi-bin/backup.cgi
 srv/web/ipfire/cgi-bin/chpasswd.cgi
 srv/web/ipfire/cgi-bin/connections.cgi
index 32537b66a859c6e5f85b95455c367bf31b811cc5..b69e5bfe92ff21b448383cfe3712c1df53a64384 100644 (file)
@@ -55,3 +55,5 @@ usr/bin/madwifi-unload
 usr/bin/wlanconfig
 usr/bin/wpakey
 usr/local/bin/rebuild-initrd
 usr/bin/wlanconfig
 usr/bin/wpakey
 usr/local/bin/rebuild-initrd
+var/ipfire/menu.d/20-status.menu
+srv/web/ipfire/cgi-bin/atm-status.cgi
diff --git a/html/cgi-bin/atm-status.cgi b/html/cgi-bin/atm-status.cgi
new file mode 100644 (file)
index 0000000..5c0fa8b
--- /dev/null
@@ -0,0 +1,77 @@
+#!/usr/bin/perl
+###############################################################################
+#                                                                             #
+# IPFire.org - A linux based firewall                                         #
+# Copyright (C) 2008  Michael Tremer & Christian Schmidt                      #
+#                                                                             #
+# This program 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 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+###############################################################################
+
+use strict;
+
+# enable only the following on debugging purpose
+#use warnings;
+#use CGI::Carp 'fatalsToBrowser';
+
+require '/var/ipfire/general-functions.pl';
+require "${General::swroot}/lang.pl";
+require "${General::swroot}/header.pl";
+
+my %color = ();
+my %mainsettings = ();
+
+&General::readhash("${General::swroot}/main/settings", \%mainsettings);
+&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
+
+&Header::showhttpheaders();
+&Header::openpage($Lang::tr{'status information'}, 1, '');
+&Header::openbigbox('100%', 'left');
+
+my @modems = `find /sys/class/atm/*/device 2>/dev/null | cut -d'/' -f5`;
+foreach (@modems){
+       chomp($_);
+       &Header::openbox('100%', 'left',"ATM MODEM $_ State");
+       my $lines=0;
+       print "<center><table>";
+       my $modem=$_;
+       my @pfile = `grep . /sys/class/atm/$modem/device/* 2>/dev/null`;
+       foreach (@pfile){
+               chomp($_);
+               my $param= `echo $_ | cut -d'/' -f7 | cut -d':' -f1`;
+               my $value= `cat /sys/class/atm/$modem/device/$param`;
+               chomp($param);
+               chomp($value);
+               if (!($param =~"uevent") 
+                 && !($param =~"modalias") 
+                 && !($param =~"bInterface")
+                 && !($param =~"bAlternateSetting")
+                 && !($param =~"bNumEndpoints")
+                 && !($param eq "")
+               ) {
+                               
+                       $lines++;
+                       if ($lines % 2){
+                               print "<tr bgcolor='$color{'color22'}'>";
+                       }else{
+                               print "<tr bgcolor='$color{'color20'}'>";
+                       }
+                       print "<td align='left'>$param</td><td align='left'>$value</td> ";              
+               }
+       }
+       print "</table><br>\n";
+       &Header::closebox();
+}
+&Header::closebigbox();
+&Header::closepage();