简体   繁体   English

PHP网络监控debian

[英]PHP network monitoring debian

My plan is to monitor network activity/usage on eth0 on my debian wheezy 7.1 using php. 我的计划是使用php在我的debian wheezy 7.1上监控eth0上的网络活动/使用情况。 Could this done be done somehow by php? 这可以通过php以某种方式完成吗? Does exist some library for this? 是否存在一些库? Or should I use exec() and parse the output? 或者我应该使用exec()并解析输出?

Would be really thankful for every tutorial, suggestion or a tip, thanks! 非常感谢每一个教程,建议或提示,谢谢!

The info you need is in /proc/net/dev 您需要的信息在/ proc / net / dev中

# cat /proc/net/dev
Inter-|   Receive                                                |  Transmit
 face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
    lo:  177937    1304    0    0    0     0          0         0   177937    1304    0    0    0     0       0          0
  eth0:16268834   14619    0    0    0 10091          0         0  1201136   10555   20    0    0     0       0          0

For the transfer rate you will have to calculate the delta from the previous capture but the value will be approximate. 对于传输速率,您必须计算上一次捕获的增量,但该值将是近似值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM