1
0
mirror of https://github.com/newnius/YAO-agent.git synced 2025-06-06 05:21:55 +00:00

update, add monitor scripts

This commit is contained in:
Newnius 2020-07-03 15:04:36 +08:00
parent e03c5bbfb9
commit fe963127c5
2 changed files with 34 additions and 0 deletions

25
bin/monitor_bw.sh Executable file
View File

@ -0,0 +1,25 @@
#!/usr/bin/env bash
IF=$1
if [[ -z "$IF" ]]; then
IF=`ls -1 /sys/class/net/ | head -1`
fi
RX_PREV=-1
TX_PREV=-1
echo "Listening $IF..."
while [[ 1 == 1 ]] ; do
RX=`cat /sys/class/net/${IF}/statistics/rx_bytes`
TX=`cat /sys/class/net/${IF}/statistics/tx_bytes`
if [ ${RX_PREV} -ne -1 ] ; then
let BWRX=($RX-$RX_PREV)/1024/1024/3
let BWTX=($TX-$TX_PREV)/1024/1024/3
#echo "Received: $BWRX MB/s Sent: $BWTX MB/s"
date=`date`
echo "$date:${BWRX},${BWTX}"
fi
RX_PREV=${RX}
TX_PREV=${TX}
sleep 3
done

9
bin/monitor_gpu_util.sh Executable file
View File

@ -0,0 +1,9 @@
#!/usr/bin/env bash
while true
do
utils=`nvidia-smi -q -x | grep gpu_util | awk '{print $1}' | awk -F'>' '{print $2}' | xargs echo`
echo "$(date):${utils}"
sleep 1
done