On Sun, Dec 20, 2015 at 01:31:24PM +0800, Siu Man wrote:
> Hi
> 
> I have more question for cat network interface packet numbers for monitor
> 
> Example easy to do on linux  cat /proc/net/dev
> 
> root@ubuntu:/var/www/html# cat /proc/net/dev
> Inter-|   Receive                                                |  Transmit
> face |bytes    packets errs drop fifo frame compressed multicast|bytes 
> packets errs drop fifo colls carrier compressed
>   eth0:   19982     202    0    0    0     0          0         0    38148 
> 187    0    0    0     0       0          0
>     lo:   13132     162    0    0    0     0          0         0    13132 
> 162    0    0    0     0       0          0
> root@ubuntu:/var/www/html#
> 
>   eth0:   19982     202    0    0    0     0          0         0    38148 
> 187    0    0    0     0       0          0
> 
> Read packets to SVG graph on browser
> 
> But OpenBSD do not find /proc/net/dev
> 
> It can read by SVG monitor
> 
> <?php
> $intf=$_GET['intf'];
> if(file_exists('/proc/net/dev')) {
> $data = file_get_contents('/proc/net/dev');
> $lines = explode("\n",$data);
> foreach($lines as $line){
>         if(strpos($line, $intf)!==false) {
>                 echo strftime('%a %b %d %H:%M:%S UTC %Y')."\n";
>                 echo $line;
>         }
> }
> }
> ?>
> 
> 
> 
> http://10.0.0.100/getbw.php?intf=eth0
> 
> Sun Dec 20 13:21:46 UTC 2015 eth0: 23630 243 0 0 0 0 0 0 54734 211 0 0 0 0 0 
> 0
> 
> 
> 
> 
> how to do OpenBSD ?
> 
> [demime 1.01d removed an attachment of type image/png which had a name of 
> svg.PNG]
> 

netstat -w 1 -c 1

Add -b for bytes instead of packets

-- 

Reply via email to