diff --git a/usr/local/www/widgets/widgets/interface_statistics.widget.php b/usr/local/www/widgets/widgets/interface_statistics.widget.php new file mode 100644 index 0000000000..a8b99503c3 --- /dev/null +++ b/usr/local/www/widgets/widgets/interface_statistics.widget.php @@ -0,0 +1,144 @@ + + 'WAN', 'lan' => 'LAN'); + for ($j = 1; isset($config['interfaces']['opt' . $j]); $j++) { + $ifdescrs['opt' . $j] = $config['interfaces']['opt' . $j]['descr']; + } + + $array_in_packets = array(); + $array_out_packets = array(); + $array_in_bytes = array(); + $array_out_bytes = array(); + $array_in_errors = array(); + $array_out_errors = array(); + $array_collisions = array(); + $array_interrupt = array(); + + //build data arrays + foreach ($ifdescrs as $ifdescr => $ifname){ + $ifinfo = get_interface_info($ifdescr); + + $array_in_packets[] = $ifinfo['inpkts']; + $array_out_packets[] = $ifinfo['outpkts']; + $array_in_bytes[] = format_bytes($ifinfo['inbytes']); + $array_out_bytes[] = format_bytes($ifinfo['outbytes']); + if (isset($ifinfo['inerrs'])){ + $array_in_errors[] = $ifinfo['inerrs']; + $array_out_errors[] = $ifinfo['outerrs']; + } + else{ + $array_in_errors[] = "n/a"; + $array_out_errors[] = "n/a"; + } + if (isset($ifinfo['collisions'])) + $array_collisions[] = htmlspecialchars($ifinfo['collisions']); + else + $array_collisions[] = "n/a"; + + + + }//end for + + + + + ?> +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
   
Packets In
Packets Out
Bytes In
Bytes Out
Errors In
Errors Out
Collisions
+
+
+ + + + $ifname): ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+
\ No newline at end of file