Unix/Linux 系统: 网络接口带宽管理(3)
脚本使用示例
以下为 bandmonitor.sh 脚本在 AIX 上使用示例。
1 .编辑 crontab 文件,每天零点运行一次 bandmonitor.sh 脚本。其中,-s 30, 表示脚本每 30 秒查询并计算网络接口带宽利用率,– c 172800,将查询计算 172800 次,这两个参数保证脚本能运行一天时间, -u 85,表示该接口带宽利用率门限值设为 85%,监控日志可通过– l 参数指定,本例采用默认值,即为 /root/en0.log 文件。
清单 12. 编辑 crontab
[AIXn01]> crontab – e
# start to monitor bandwidth of interface en0 every 0 o ’ clock
0 0 * * * /root/bandmonitor.sh -i en0 – s 30 – c 172800 – u 85 \
>/tmp/bandmonitor.out 2>&1
2 .用户收到告警邮件,需要进一步查询历史记录时,可查看日志文件。
清单 13. 查看日志文件
c209f7n16:/root # cat eth0.log|more
Start to monitor interface eth0 at 20090721074128.
Interface eth0 is working on Duplex:Half Speed:100.
Utilization threshold is 80 percent.
Network traffic recording.....
INT:eth0 TIME:20090721074128 TRANS:570460766 RECV:28919401 ALarm:NO
INT:eth0 TIME:20090721074158 TRANS:570462132 RECV:28923747 ALarm:NO
INT:eth0 TIME:20090721074228 TRANS:570463752 RECV:28925435 ALarm:NO
小结
本文介绍了 Unix/Linux 上的网络接口带宽管理命令并通过一个自动化监控脚本详细介绍了如何实现网络接口带宽的自动化监控管理。网络接口带宽的自动化监控能帮助系统管理员及时发现网络接口带宽的异常问题,通过采取相应的措施使得问题得以消除和缓解。
- 最新评论
