监控流量
来源:互联网 发布:软件加油站系统 编辑:程序博客网 时间:2024/04/29 08:07
$dev = isset($argv)?$argv:"eth0";while(true){ $result = file_get_contents("/proc/net/dev"); preg_match("/{$dev}:(\d+)\s+\d+\s+\d+\s+\d+\s+\d+\s+\d+\s+\d+\s+\d+\s+(\d+)/", $result, $preg_arr); $lastre = $thisre; $lasttr = $thistr; $thisre = $preg_arr[1]; $thistr = $preg_arr[2]; $re = hbw($thisre - $lastre); $tr = hbw($thistr - $lasttr); echo "\33[2J"; printf("\33[1;1H%-12sss\n", 'Device', 'In', 'Out'); printf("\33[2;1H%-12sss\n", $dev, $re, $tr); sleep(1);}function hbw($size) { $size *= 8; if($size > 1024 * 1024 * 1024) { $size = round($size / 1073741824 * 100) / 100 . ' Gbps'; } elseif($size > 1024 * 1024) { $size = round($size / 1048576 * 100) / 100 . ' Mbps'; } elseif($size > 1024) { $size = round($size / 1024 * 100) / 100 . ' Kbps'; } else { $size = $size . ' Bbps'; } return $size;}
阅读全文
0 0
- 流量监控
- 流量监控
- 监控流量
- 安装流量监控MRTG
- TCP 流量监控
- windows流量监控
- cacti流量监控--verygood
- 电脑流量监控
- iftop 监控 网卡流量
- 监控网卡实时流量
- 监控上网流量
- iftop 监控流量
- ifstat流量监控工具
- Linux iftop 监控流量
- 网卡流量监控脚本
- Nagios 网卡流量监控
- iOS流量监控
- 流量监控实战
- Maven生成项目站点(一)
- 玩得好王者荣耀却做不好团队管理,我看你是白玩了
- 浏览器模式和文档模式怎么玩?
- java——类——RTTI
- PAT练习-个位数统计
- 监控流量
- java maven打包后,修改配置文件无效
- debian opencl环境搭建
- Linux下数据库操作
- SAP中关于物料主数据建错了的更改
- HDU 3332 Windows
- 普通java web项目ant编译打包成war
- 我要15天消化掉Android官方API指南--第四天
- HDU 2485 Destroying the bus stations