diff -Nur --no-dereference smeserver-smeadmin-1.6.old/root/etc/e-smith/web/functions/smeadmin smeserver-smeadmin-1.6/root/etc/e-smith/web/functions/smeadmin
--- smeserver-smeadmin-1.6.old/root/etc/e-smith/web/functions/smeadmin 2024-05-19 22:52:30.397000000 -0400
+++ smeserver-smeadmin-1.6/root/etc/e-smith/web/functions/smeadmin 2024-05-19 22:53:29.702000000 -0400
@@ -1170,7 +1170,7 @@
sub showPppoe
{
# get first db entry
-my $requete="SELECT substr(debut,1,4), substr(debut,6,2) FROM pppoe ORDER BY debut ASC LIMIT 1";
+my $requete="SELECT substr(debut,1,4), substr(debut,6,2) FROM pppoe WHERE debut >= CURDATE() - INTERVAL 24 MONTH ORDER BY debut ASC LIMIT 1";
#connexion a la base de donnees mySQL
connectBD();
@@ -1180,7 +1180,7 @@
my @debut = $rq->fetchrow_array();
# get first db entry
-my $requete_DESC="SELECT substr(fin,1,4), substr(fin,6,2) FROM pppoe ORDER BY debut DESC LIMIT 1";
+my $requete_DESC="SELECT substr(fin,1,4), substr(fin,6,2) FROM pppoe WHERE debut >= CURDATE() - INTERVAL 24 MONTH ORDER BY debut DESC LIMIT 1";
#connexion a la base de donnees mySQL
connectBD();
@@ -1189,6 +1189,7 @@
$rq_DESC->execute or print $q->p(sprintf(gettext("MySQL error : Can't execute query : %s\n"),$rq_DESC->errstr));
my @fin = $rq_DESC->fetchrow_array();
+ #$debut[1] -- if ($debut[1] == $fin[1]);
my $end_yymm = $debut[0].$debut[1];
my $yymm = $fin[0].$fin[1];
@@ -1208,9 +1209,9 @@
print $q->th(gettext("OUT (GB)"));
print $q->th(gettext("TOTAL (GB)"));
$q->end_Tr;
-
- while ($end_yymm < $yymm) {
-
+ my $nblines = 0;
+ while ($end_yymm < $yymm || $nblines < 1) {
+ $nblines =1;
if ($startMonth eq '12') {
$endMonth = 1;
$endYear = $startYear + 1;
@@ -1233,9 +1234,9 @@
# print "**$end_yymm
\n";
$requete="SELECT substring(`fin`,1,7) as 'month',
-round(SUM(`volume_in`)/1024/1024/1024,3) as 'In (Go)' ,
-round(SUM(`volume_out`) /1024/1024/1024,3) as 'Out (Go)' ,
-round(SUM(`volume_in` + `volume_out`)/1024/1024/1024,3) as 'Total (Go)' ,
+round(SUM(`volume_in`)/1000/1000/1000,3) as 'In (Go)' ,
+round(SUM(`volume_out`) /1000/1000/1000,3) as 'Out (Go)' ,
+round(SUM(`volume_in` + `volume_out`)/1000/1000/1000,3) as 'Total (Go)' ,
SUM(TIME_TO_SEC(`duree`))/3600/24 as 'duree'
FROM `pppoe` WHERE
# mois
@@ -1275,10 +1276,10 @@
[gettext("Duration"),],
[gettext("IP Address"),sub { return ipnum2ipdot(@_); } ],
[gettext("Connection peer"),sub { return ipnum2ipdot(@_); } ],
- [gettext("Incoming data (Ko)"),sub {return sprintf('%.2f',$_[0]/1024);}],
- [gettext("Outgoing data (ko)"),sub {return sprintf('%.2f',$_[0]/1024);}]
+ [gettext("Incoming data (MB)"),sub {return sprintf('%.2f',$_[0]/1000/1000);}],
+ [gettext("Outgoing data (MB)"),sub {return sprintf('%.2f',$_[0]/1000/1000);}]
],
- \"SELECT debut,fin,duree,ip,peer,volume_in,volume_out FROM pppoe ORDER BY debut DESC",
+ \"SELECT debut,fin,duree,ip,peer,volume_in,volume_out,fin-debut as 'encours' FROM pppoe WHERE debut >= CURDATE() - INTERVAL 24 MONTH ORDER BY debut DESC",
\gettext("Detailed list of ADSL/PPPoE connections.\n"));
}
#----------------------------------------------------------------
@@ -1425,9 +1426,17 @@
print $q->Tr($q->td({bgcolor=>"#9999FF",colspan=>"7"},sprintf(gettext("Disconnection lasted more than %s minutes"),$params{'LimitPppoeDisconnect'}))) if (($rq2->fetchrow_array)[0] eq '1');
#on match le nb d'heure de la duree cnx
- $ligne[2]=~/(\d{2}):\d{2}:\d{2}/;
+ my $curdur;
+ if ($ligne[2]) {
+ # ended connection
+ $ligne[2]=~/(\d{2}):\d{2}:\d{2}/;
+ $curdur=$1;
+ }else{
+ # ongoing connection
+ $curdur=$ligne[7]/3600;
+ }
#si le nb d'heure < limite et different de null, surbrillance
- print $q->start_Tr({bgcolor=>((($1 < $params{'LimitPppoeDuration'}) && ($1 ne ''))?"#FF4444":"#FFFFFF")});
+ print $q->start_Tr({bgcolor=>((($curdur < $params{'LimitPppoeDuration'}) && ($1 ne ''))?"#FF4444":"#FFFFFF")});
}
elsif ($q->param('service') eq 'sshd')
{
diff -Nur --no-dereference smeserver-smeadmin-1.6.old/root/usr/bin/smeadmind smeserver-smeadmin-1.6/root/usr/bin/smeadmind
--- smeserver-smeadmin-1.6.old/root/usr/bin/smeadmind 2024-05-19 22:52:30.390000000 -0400
+++ smeserver-smeadmin-1.6/root/usr/bin/smeadmind 2024-05-19 22:53:06.837000000 -0400
@@ -497,7 +497,8 @@
if ($ppoeif ne 'none' && $ppoemode eq 'pppoe') {
my $recBytes=`cat /proc/net/dev|grep $ppoeif|cut -d ':' -f2|tr -s ' '| sed -e 's/^[ \t]*//'|cut -d ' ' -f1`;
- my $senBytes=`cat /proc/net/dev|grep $ppoeif|tr -s ' '| sed -e 's/^[ \t]*//'|cut -d " " -f9`;
+ #my $senBytes=`cat /proc/net/dev|grep $ppoeif|tr -s ' '| sed -e 's/^[ \t]*//'|cut -d " " -f9`;
+ my $senBytes=`cat /proc/net/dev|grep ppp0|cut -d ':' -f2|tr -s ' '| sed -e 's/^[ \t]*//'|cut -d ' ' -f9`;
#my $requete="SELECT pid_pppd FROM pppoe WHERE ORDER DESC LIMIT 1";
#my $rq=$bd->prepare($requete) or print $q->p(sprintf(gettext("MySQL error : Impossible to prepare SQL query \"%s\" : %s\n"),$requete,$bd->errstr));
@@ -904,7 +905,8 @@
#Jul 14 12:49:58 sas pppd[1878]: rcvd [IPCP ConfAck id=0x2 ]
#Match: date hostname pppd[pid]: rcvd [IPCP ConfAck id=0xxx? ]
#if($l =~ /(\w{3}\s{1,2}\d{1,2} [0-9:]{8}) $SystemName pppd\[(\d+)\]: rcvd \[IPCP ConfAck id=0x\w+ \]/o)
- if($l =~ /(\w{3}\s{1,2}\d{1,2} [0-9:]{8}) $SystemName pppd\[(\d+)\]: rcvd \[IPCP ConfAck id=0x\w+ \]/o) {
+ #if($l =~ /(\w{3}\s{1,2}\d{1,2} [0-9:]{8}) $SystemName pppd\[(\d+)\]: rcvd \[IPCP ConfAck id=0x\w+ \]/o) {
+ if($l =~ /(\w{3}\s{1,2}\d{1,2} [0-9:]{8}) $SystemName pppd\[(\d+)\]: local IP address (\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/o) {
#$1: date $2:pid $3.$4.$5.$6:ip
my $date=mkmysqldate($1);
my $ip=ipdot2ipnum($3,$4,$5,$6);
diff -Nur --no-dereference smeserver-smeadmin-1.6.old/root/usr/share/doc/smeserver-smeadmin/tables.sql smeserver-smeadmin-1.6/root/usr/share/doc/smeserver-smeadmin/tables.sql
--- smeserver-smeadmin-1.6.old/root/usr/share/doc/smeserver-smeadmin/tables.sql 2020-10-15 07:31:28.000000000 -0400
+++ smeserver-smeadmin-1.6/root/usr/share/doc/smeserver-smeadmin/tables.sql 2024-05-19 22:55:48.248000000 -0400
@@ -28,8 +28,8 @@
fin datetime,
pid_afpd int unsigned not null,
login varchar(10),
- volume_read int(20) unsigned,
- volume_write int(20) unsigned,
+ volume_read bigint(20) unsigned,
+ volume_write bigint(20) unsigned,
primary key (debut) );
-- Structure de la table dchpd
@@ -52,8 +52,8 @@
pid_proftpd int unsigned not null,
login varchar(10),
connecte bool,
- volume_in int(20) unsigned,
- volume_out int(20) unsigned,
+ volume_in bigint(20) unsigned,
+ volume_out bigint(20) unsigned,
primary key (debut) );
-- Structure de la table pppoe
@@ -65,8 +65,8 @@
pid_pppd int unsigned not null,
ip int unsigned not null,
peer int unsigned not null,
- volume_in int(20) unsigned,
- volume_out int(20) unsigned,
+ volume_in bigint(20) unsigned,
+ volume_out bigint(20) unsigned,
primary key (debut) );
-- Structure de la table ssh
@@ -87,8 +87,8 @@
ip int unsigned,
vpn_clt int unsigned,
vpn_srv int unsigned not null,
- volume_in int unsigned,
- volume_out int unsigned,
+ volume_in bigint unsigned,
+ volume_out bigint unsigned,
login varchar(10),
pid_pptpd int(20) unsigned not null,
pid_pppd int(20) unsigned,
diff -Nur --no-dereference smeserver-smeadmin-1.6.old/root/usr/share/doc/smeserver-smeadmin/tables-update.sql smeserver-smeadmin-1.6/root/usr/share/doc/smeserver-smeadmin/tables-update.sql
--- smeserver-smeadmin-1.6.old/root/usr/share/doc/smeserver-smeadmin/tables-update.sql 2020-10-15 07:31:28.000000000 -0400
+++ smeserver-smeadmin-1.6/root/usr/share/doc/smeserver-smeadmin/tables-update.sql 2024-05-19 22:58:13.446000000 -0400
@@ -5,15 +5,15 @@
ALTER TABLE `pppoe` CHANGE `ip` `ip` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'
;
-- Update size of some fields
-ALTER TABLE `pppoe` CHANGE `volume_in` `volume_in` INT( 20 ) UNSIGNED NULL DEFAULT NULL ,
-CHANGE `volume_out` `volume_out` INT( 20 ) UNSIGNED NULL DEFAULT NULL ;
+ALTER TABLE `pppoe` CHANGE `volume_in` `volume_in` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL ,
+CHANGE `volume_out` `volume_out` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL ;
-ALTER TABLE `vpn` CHANGE `volume_in` `volume_in` INT( 20 ) UNSIGNED NULL DEFAULT NULL ,
-CHANGE `volume_out` `volume_out` INT( 20 ) UNSIGNED NULL DEFAULT NULL ;
+ALTER TABLE `vpn` CHANGE `volume_in` `volume_in` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL ,
+CHANGE `volume_out` `volume_out` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL ;
-ALTER TABLE `ftp` CHANGE `volume_in` `volume_in` INT( 20 ) UNSIGNED NULL DEFAULT NULL ,
-CHANGE `volume_out` `volume_out` INT( 20 ) UNSIGNED NULL DEFAULT NULL ;
+ALTER TABLE `ftp` CHANGE `volume_in` `volume_in` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL ,
+CHANGE `volume_out` `volume_out` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL ;
ALTER TABLE `afp` CHANGE `volume_write` `volume_write` INT( 20 ) UNSIGNED NULL DEFAULT NULL ,
-CHANGE `volume_read` `volume_read` INT( 20 ) UNSIGNED NULL DEFAULT NULL ;
+CHANGE `volume_read` `volume_read` BIGINT( 20 ) UNSIGNED NULL DEFAULT NULL ;