2017年2月6日

获取网卡网络流量

摘要: #!/bin/bash while [ "1" ] do eth=$1 RXpre=$(cat /proc/net/dev | grep $eth | tr : " " | awk '{print $2}') TXpre=$(cat /proc/net/dev | grep $eth | tr : 阅读全文

posted @ 2017-02-06 14:04 guoqp 阅读(563) 评论(0) 推荐(0) 编辑

获取进程cpu占用

摘要: #!/usr/bin/env pythonimport mathimport timewhile 1:#########time1 total1_cpu = [] total2_cpu = [] with open('/proc/[pid]/stat','r') as f: context = f. 阅读全文

posted @ 2017-02-06 13:43 guoqp 阅读(422) 评论(0) 推荐(0) 编辑

导航