My old school way is a one liner. And will search for average from SAR, to get the data receive rate. But, I dont think it is practical or accurate,. Because it calculates to off peak hours. I am planning to change it. My cron runs every 30 mins. When my cron runs, and my time is 14:47pm,, it will only seach in SAR file or SAR output all 2:00pm-247pm, only the block, I will take care of the data and cloumn and calculation. I just want to know if my script runs at my system stime 19:20 it will get all the data from SAR only from 7pm-720pm.. 2400 military time.
My orig one liner script
for i in `cat /home/ave2.list`;do echo -n $i",";ssh $i "echo -n $i,|cut -c1-7 -n; f=\`/sbin/ip a|egrep '127.127|128.128' |head -1| awk '{print \$NF }' \` ; sar -n DEV|grep \$f|grep Average|awk '{print \$5 * 8 / 1000 \" Mbps\" }'" ; done |sed 'N;s/\n/, /' > /home/rawdata2.log
$ date
Tue Aug 20 15:44:31 UTC 2019
sample:
01:20:01 PM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s
01:30:01 PM lo 0.19 0.19 0.03 0.03 0.00 0.00 0.00
01:30:01 PM eth0 29.56 6.58 2.46 8.42 0.00 0.00 7.04
01:30:01 PM eth1 98130.98 0.00 66635.96 0.00 0.00 0.00 0.05
01:30:01 PM eth2 0.00 0.00 0.00 0.00 0.00 0.00 0.00
01:30:01 PM eth3 0.00 0.00 0.00 0.00 0.00 0.00 0.00
01:40:02 PM lo 0.19 0.19 0.03 0.03 0.00 0.00 0.00
01:40:02 PM eth0 28.26 3.85 2.38 4.28 0.00 0.00 7.00
01:40:02 PM eth1 98787.53 0.00 65109.20 0.00 0.00 0.00 0.05
01:40:02 PM eth2 0.00 0.00 0.00 0.00 0.00 0.00 0.00
01:40:02 PM eth3 0.00 0.00 0.00 0.00 0.00 0.00 0.00
01:50:01 PM lo 0.19 0.19 0.03 0.03 0.00 0.00 0.00
01:50:01 PM eth0 29.18 5.18 2.44 6.26 0.00 0.00 7.04
01:50:01 PM eth1 97797.48 0.00 64819.71 0.00 0.00 0.00 0.05
01:50:01 PM eth2 0.00 0.00 0.00 0.00 0.00 0.00 0.00
01:50:01 PM eth3 0.00 0.00 0.00 0.00 0.00 0.00 0.00
02:00:01 PM lo 0.19 0.19 0.03 0.03 0.00 0.00 0.00
02:00:01 PM eth0 30.25 8.30 2.48 11.15 0.00 0.00 7.00
02:00:01 PM eth1 99495.59 0.00 66608.09 0.00 0.00 0.00 0.05
02:00:01 PM eth2 0.00 0.00 0.00 0.00 0.00 0.00 0.00
02:00:01 PM eth3 0.00 0.00 0.00 0.00 0.00 0.00 0.00
02:00:01 PM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s
02:10:01 PM lo 0.19 0.19 0.03 0.03 0.00 0.00 0.00
02:10:01 PM eth0 29.35 6.18 2.44 7.88 0.00 0.00 7.00
02:10:01 PM eth1 112297.64 0.00 75682.19 0.00 0.00 0.00 0.05
02:10:01 PM eth2 0.00 0.00 0.00 0.00 0.00 0.00 0.00
02:10:01 PM eth3 0.00 0.00 0.00 0.00 0.00 0.00 0.00
02:20:01 PM lo 0.19 0.19 0.03 0.03 0.00 0.00 0.00
02:20:01 PM eth0 29.05 5.57 2.45 6.76 0.00 0.00 7.02
02:20:01 PM eth1 105654.26 0.00 69330.72 0.00 0.00 0.00 0.05
02:20:01 PM eth2 0.00 0.00 0.00 0.00 0.00 0.00 0.00
02:20:01 PM eth3 0.00 0.00 0.00 0.00 0.00 0.00 0.00
02:30:02 PM lo 0.19 0.19 0.03 0.03 0.00 0.00 0.00
02:30:02 PM eth0 31.29 10.13 2.56 13.71 0.00 0.00 7.01
02:30:02 PM eth1 104931.75 0.00 70139.40 0.00 0.00 0.00 0.05
02:30:02 PM eth2 0.00 0.00 0.00 0.00 0.00 0.00 0.00
02:30:02 PM eth3 0.00 0.00 0.00 0.00 0.00 0.00 0.00
02:40:01 PM lo 0.19 0.19 0.03 0.03 0.00 0.00 0.00
02:40:01 PM eth0 38.72 25.23 3.17 35.77 0.00 0.00 7.02
02:40:01 PM eth1 104897.98 0.00 70268.52 0.00 0.00 0.00 0.05
02:40:01 PM eth2 0.00 0.00 0.00 0.00 0.00 0.00 0.00
02:40:01 PM eth3 0.00 0.00 0.00 0.00 0.00 0.00 0.00
02:40:01 PM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s
02:50:01 PM lo 0.19 0.19 0.03 0.03 0.00 0.00 0.00
02:50:01 PM eth0 28.72 5.14 2.38 6.33 0.00 0.00 7.00
02:50:01 PM eth1 106437.62 0.00 71325.17 0.00 0.00 0.00 0.05
02:50:01 PM eth2 0.00 0.00 0.00 0.00 0.00 0.00 0.00
02:50:01 PM eth3 0.00 0.00 0.00 0.00 0.00 0.00 0.00
03:00:01 PM lo 0.19 0.19 0.03 0.03 0.00 0.00 0.00
03:00:01 PM eth0 30.09 7.76 2.52 10.06 0.00 0.00 7.02
03:00:01 PM eth1 105988.49 0.00 71232.42 0.00 0.00 0.00 0.05
03:00:01 PM eth2 0.00 0.00 0.00 0.00 0.00 0.00 0.00
03:00:01 PM eth3 0.00 0.00 0.00 0.00 0.00 0.00 0.00
03:10:01 PM lo 0.19 0.19 0.03 0.03 0.00 0.00 0.00
03:10:01 PM eth0 31.31 10.48 2.57 14.18 0.00 0.00 7.01
03:10:01 PM eth1 116581.94 0.00 78709.01 0.00 0.00 0.00 0.05
03:10:01 PM eth2 0.00 0.00 0.00 0.00 0.00 0.00 0.00
03:10:01 PM eth3 0.00 0.00 0.00 0.00 0.00 0.00 0.00
03:20:02 PM lo 0.19 0.19 0.03 0.03 0.00 0.00 0.00
03:20:02 PM eth0 29.12 5.85 2.43 7.27 0.00 0.00 7.01
03:20:02 PM eth1 117457.21 0.00 78036.86 0.00 0.00 0.00 0.05
03:20:02 PM eth2 0.00 0.00 0.00 0.00 0.00 0.00 0.00
03:20:02 PM eth3 0.00 0.00 0.00 0.00 0.00 0.00 0.00
03:20:02 PM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s
03:30:01 PM lo 0.18 0.18 0.03 0.03 0.00 0.00 0.00
03:30:01 PM eth0 28.17 3.81 2.37 4.22 0.00 0.00 7.02
03:30:01 PM eth1 112443.23 0.00 74472.20 0.00 0.00 0.00 0.05
03:30:01 PM eth2 0.00 0.00 0.00 0.00 0.00 0.00 0.00
03:30:01 PM eth3 0.00 0.00 0.00 0.00 0.00 0.00 0.00
03:40:01 PM lo 0.19 0.19 0.03 0.03 0.00 0.00 0.00
03:40:01 PM eth0 39.85 29.56 3.17 42.19 0.00 0.00 7.00
03:40:01 PM eth1 116666.73 0.00 77904.30 0.00 0.00 0.00 0.05
03:40:01 PM eth2 0.00 0.00 0.00 0.00 0.00 0.00 0.00
03:40:01 PM eth3 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Average: lo 0.19 0.19 0.03 0.03 0.00 0.00 0.00
Average: eth0 28.97 5.15 2.42 6.46 0.00 0.00 7.07
Average: eth1 57011.34 0.00 35401.68 0.00 0.00 0.00 0.09
Average: eth2 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Average: eth3 0.00 0.00 0.00 0.00 0.00 0.00 0.00