突然想对linux的网卡流量进行监控,又不想使用cacti,觉得配置snmp很麻烦。现成的工具好像也没啥太好用的。决定自己写一个脚本。
另存为traffic
使用方法如下:
效果如下:
阅读(114) | 评论(0) | 转发(0) |
<script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"16"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
点击(此处)折叠或打开
- #!/bin/bash
- rx1=$(ifconfig $1|grep "RX bytes"|awk '{print $2}'|awk -F: '{print $2}')
- sleep 1
- rxa=$(($rx1 / 1000))
- rx2=$(ifconfig eth0|grep "RX bytes"|awk '{print $2}'|awk -F: '{print $2}')
- rxb=$(($rx2 / 1000))
- echo "Net Traffic is:" $(($rxb - $rxa))k/s
使用方法如下:
点击(此处)折叠或打开
- chmod 777 traffic
- watch ./traffic eth0
相关热门文章
- A sample .exrc file for vi e...
- IBM System p5 服务器 HACMP ...
- 游标的特征
- busybox的httpd使用CGI脚本(Bu...
- Solaris PowerTOP 1.0 发布
给主人留下些什么吧!~~
评论热议