我通过运行脚本在文本文件中写入数据,如下所示。此数据每秒钟更新一次。
eth0: Sent Bytes: 1 Kb/s | Received Bytes: 2 Kb/s | Sent Packets: 18 Pkts/s | Received Packets: 13 Pkts/s
eth0: Sent Bytes: 1 Kb/s | Received Bytes: 2 Kb/s | Sent Packets: 18 Pkts/s | Received Packets: 12 Pkts/s
eth0: Sent Bytes: 1 Kb/s | Received Bytes: 3 Kb/s | Sent Packets: 20 Pkts/s | Received Packets: 13 Pkts/s
eth0: Sent Bytes: 15 Kb/s | Received Bytes: 4 Kb/s | Sent Packets: 33 Pkts/s | Received Packets: 25 Pkts/s
eth0: Sent Bytes: 1 Kb/s | Received Bytes: 3 Kb/s | Sent Packets: 19 Pkts/s | Received Packets: 12 Pkts/s我想要做一个图的#字节发送和接收的字节#。包也一样。
发布于 2014-12-19 20:24:20
您可以使用https://github.com/holman/spark创建一个只使用shell脚本的图形(尽管它只适用于bash,而不是POSIX sh)。您可以使用watch实时观看它的更新。
graph.sh
!/bin/sh
field=1
tail "$1" | cut -d '|' -f $field | sed -e 's!.*: \([0-9]\+\) .*!\1!' | ./spark/spark交互式控制台
git clone https://github.com/holman/spark
your-process > logfile &
watch sh graph.sh logfile输出
Every 2.0s: sh graph.sh logfile Fri Dec 19 22:22:04 2014
▁▁▁█▁https://stackoverflow.com/questions/27566954
复制相似问题