mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-27 11:13:24 +02:00
Some fixes on traffic.cgi if no data is present (not translated yet)
This commit is contained in:
@@ -50,7 +50,7 @@ my %netsettings;
|
|||||||
&Header::openpage($Lang::tr{'sstraffic'}, 1, '');
|
&Header::openpage($Lang::tr{'sstraffic'}, 1, '');
|
||||||
&Header::openbigbox('100%', 'left');
|
&Header::openbigbox('100%', 'left');
|
||||||
|
|
||||||
&Header::openbox('100%', 'left', "$Lang::tr{'traffics'}");
|
&Header::openbox('100%', 'center', "$Lang::tr{'traffics'}");
|
||||||
|
|
||||||
# Display internal network
|
# Display internal network
|
||||||
display_vnstat($netsettings{'GREEN_DEV'});
|
display_vnstat($netsettings{'GREEN_DEV'});
|
||||||
@@ -83,23 +83,23 @@ sub display_vnstat
|
|||||||
{
|
{
|
||||||
my $device = $_[0];
|
my $device = $_[0];
|
||||||
|
|
||||||
# Sumary graph sometimes hang so i print the text
|
my $testdata = `/usr/bin/vnstat -i $device | grep "enough data"`;
|
||||||
print "<B><PRE>";
|
|
||||||
system("/usr/bin/vnstat -s -i $device");
|
if (! $testdata) {
|
||||||
print "</PRE></B>";
|
system("/usr/bin/vnstati -c 5 -s -i $device -o /srv/web/ipfire/html/graphs/vnstat-s-$device.png");
|
||||||
# generate Graphs if they are older than 5 min (-c 5)
|
# Hour graph
|
||||||
# Hour graph
|
system("/usr/bin/vnstati -c 5 -h -i $device -o /srv/web/ipfire/html/graphs/vnstat-h-$device.png");
|
||||||
system("/usr/bin/vnstati -c 5 -h -i $device -o /srv/web/ipfire/html/graphs/vnstat-h-$device.png");
|
# Day graph
|
||||||
# Day graph
|
system("/usr/bin/vnstati -c 5 -d -i $device -o /srv/web/ipfire/html/graphs/vnstat-d-$device.png");
|
||||||
system("/usr/bin/vnstati -c 5 -d -i $device -o /srv/web/ipfire/html/graphs/vnstat-d-$device.png");
|
# Month graph
|
||||||
# Month graph
|
system("/usr/bin/vnstati -c 5 -m -i $device -o /srv/web/ipfire/html/graphs/vnstat-m-$device.png");
|
||||||
system("/usr/bin/vnstati -c 5 -m -i $device -o /srv/web/ipfire/html/graphs/vnstat-m-$device.png");
|
# Top10 graph
|
||||||
# Top10 graph
|
system("/usr/bin/vnstati -c 5 -t -i $device -o /srv/web/ipfire/html/graphs/vnstat-t-$device.png");
|
||||||
system("/usr/bin/vnstati -c 5 -t -i $device -o /srv/web/ipfire/html/graphs/vnstat-t-$device.png");
|
|
||||||
|
|
||||||
# Generate HTML-Table with the graphs
|
# Generate HTML-Table with the graphs
|
||||||
print <<END
|
print <<END
|
||||||
<table>
|
<table>
|
||||||
|
<tr><td><img src="/graphs/vnstat-s-$device.png"></td></tr>
|
||||||
<tr><td><img src="/graphs/vnstat-h-$device.png"></td></tr>
|
<tr><td><img src="/graphs/vnstat-h-$device.png"></td></tr>
|
||||||
<tr><td><img src="/graphs/vnstat-d-$device.png"></td></tr>
|
<tr><td><img src="/graphs/vnstat-d-$device.png"></td></tr>
|
||||||
<tr><td><img src="/graphs/vnstat-m-$device.png"></td></tr>
|
<tr><td><img src="/graphs/vnstat-m-$device.png"></td></tr>
|
||||||
@@ -107,4 +107,8 @@ print <<END
|
|||||||
</table>
|
</table>
|
||||||
END
|
END
|
||||||
;
|
;
|
||||||
|
} else {
|
||||||
|
print"No data for $device !<br>";
|
||||||
|
}
|
||||||
|
print"<hr>";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user