# opkg install sysstat
# /opt/etc/init.d/S99sysstat start
# sar -d 2 5
cru a sa1 "*/10 * * * * /opt/lib/sysstat/sa1 600 1 -S DISK"
cru a sa2 "59 23 * * * /opt/lib/sysstat/sa2 -A"
ASUSWRT-Merlin RT-AC86U 384.17_0 Sun Apr 26 02:28:53 UTC 2020
miazza@RT-AC86U-3150:/tmp/home/root# sar -d 2 5
Linux 4.1.27 (RT-AC86U-3150) 06/17/20 _aarch64_ (2 CPU)
15:12:25 DEV tps rkB/s wkB/s dkB/s areq-sz aqu-sz await %util
15:12:27 dev8-0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
15:12:27 dev8-16 0.50 0.00 29.70 0.00 60.00 0.21 430.00 21.29
15:12:27 DEV tps rkB/s wkB/s dkB/s areq-sz aqu-sz await %util
15:12:29 dev8-0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
15:12:29 dev8-16 1.00 0.00 11.94 0.00 12.00 0.00 5.00 0.50
15:12:29 DEV tps rkB/s wkB/s dkB/s areq-sz aqu-sz await %util
15:12:31 dev8-0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
15:12:31 dev8-16 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
15:12:31 DEV tps rkB/s wkB/s dkB/s areq-sz aqu-sz await %util
15:12:33 dev8-0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
15:12:33 dev8-16 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
15:12:33 DEV tps rkB/s wkB/s dkB/s areq-sz aqu-sz await %util
15:12:35 dev8-0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
15:12:35 dev8-16 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Average: DEV tps rkB/s wkB/s dkB/s areq-sz aqu-sz await %util
Average: dev8-0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Average: dev8-16 0.30 0.00 8.34 0.00 28.00 0.04 146.67 4.37
miazza@RT-AC86U-3150:/tmp/home/root# iostat -y 5 sdb
Linux 4.1.27 (RT-AC86U-3150) 06/18/20 _aarch64_ (2 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
35.46 0.00 39.51 0.12 0.00 24.91
Device tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd
sdb 0.40 0.00 3.18 0.00 0 16 0
avg-cpu: %user %nice %system %iowait %steal %idle
37.83 0.00 38.58 0.12 0.00 23.47
Device tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd
sdb 0.40 0.00 3.98 0.00 0 20 0
avg-cpu: %user %nice %system %iowait %steal %idle
38.24 0.00 40.28 0.00 0.00 21.48
Device tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd
sdb 0.60 0.00 4.78 0.00 0 24 0
avg-cpu: %user %nice %system %iowait %steal %idle
40.00 0.00 38.53 0.12 0.00 21.35
Device tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd
sdb 0.40 0.00 5.58 0.00 0 28 0
avg-cpu: %user %nice %system %iowait %steal %idle
38.91 0.00 44.83 0.00 0.00 16.26
Device tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd
sdb 0.40 0.00 3.98 0.00 0 20 0
avg-cpu: %user %nice %system %iowait %steal %idle
36.56 0.00 43.25 0.00 0.00 20.19
Device tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd
sdb 0.99 0.00 5.57 0.00 0 28 0
avg-cpu: %user %nice %system %iowait %steal %idle
35.79 0.00 41.40 0.12 0.00 22.69
Device tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd
sdb 0.40 0.00 3.98 0.00 0 20 0
avg-cpu: %user %nice %system %iowait %steal %idle
33.97 0.00 45.62 0.12 0.00 20.29
Device tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd
sdb 0.40 0.00 3.98 0.00 0 20 0
avg-cpu: %user %nice %system %iowait %steal %idle
41.68 0.00 36.67 0.00 0.00 21.65
Device tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd
sdb 0.40 0.00 3.19 0.00 0 16 0
avg-cpu: %user %nice %system %iowait %steal %idle
33.25 0.00 42.62 0.00 0.00 24.13
Device tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd
sdb 0.40 0.00 3.19 0.00 0 16 0
avg-cpu: %user %nice %system %iowait %steal %idle
37.81 0.00 47.35 0.12 0.00 14.72
Device tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd
sdb 0.60 0.00 7.17 0.00 0 36 0
avg-cpu: %user %nice %system %iowait %steal %idle
34.39 0.00 43.86 0.00 0.00 21.75
Device tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd
sdb 0.40 0.00 3.98 0.00 0 20 0
avg-cpu: %user %nice %system %iowait %steal %idle
38.28 0.00 41.27 0.00 0.00 20.45
Device tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd
sdb 1.00 0.00 6.37 0.00 0 32 0
avg-cpu: %user %nice %system %iowait %steal %idle
38.17 0.00 40.12 0.12 0.00 21.59
Device tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd
sdb 0.40 0.00 3.98 0.00 0 20 0
avg-cpu: %user %nice %system %iowait %steal %idle
39.06 0.00 42.81 0.12 0.00 18.02
Device tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd
sdb 0.40 0.00 3.98 0.00 0 20 0
avg-cpu: %user %nice %system %iowait %steal %idle
37.70 0.00 37.82 0.12 0.00 24.35
Device tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd
sdb 0.40 0.00 3.98 0.00 0 20 0
avg-cpu: %user %nice %system %iowait %steal %idle
39.66 0.00 44.72 0.00 0.00 15.62
Device tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd
sdb 0.80 0.00 6.36 0.00 0 32 0
Assuming that works you need to setup the data collection. You need to add these two lines to one of your existing startup scripts. I suggest that you find out which script is starting Entware (rc.unslung start) and then add them just after that.
Code:cru a sa1 "*/10 * * * * /opt/lib/sysstat/sa1 600 1 -S DISK" cru a sa2 "59 23 * * * /opt/lib/sysstat/sa2 -A"
miazza@RT-AC86U-3150:/tmp/mnt/Entware/entware/etc/init.d# ls
S80pixelserv-tls rc.func rc.unslung
S99sysstat rc.func.div
/opt/etc/init.d/rc.unslung start
/opt/etc/init.d/rc.unslung start
cru a sa1 "*/10 * * * * /opt/lib/sysstat/sa1 600 1 -S DISK"
cru a sa2 "59 23 * * * /opt/lib/sysstat/sa2 -A"
# cru l
< various other stuff here >
*/10 * * * * /opt/lib/sysstat/sa1 600 1 -S DISK #sa1#
59 23 * * * /opt/lib/sysstat/sa2 -A #sa2#
Thanks. That is significantly different than my setup./jffs/addons/diversion/mount-entware.div
#!/bin/sh
#bof
# Diversion is free to use under the GNU General Public License version 3 (GPL- >
# https://opensource.org/licenses/GPL-3.0
# Proudly coded by thelonelycoder
# Copyright (c) 2016-2066 thelonelycoder - All Rights Reserved
# https://www.snbforums.com/members/thelonelycoder.25480/
# https://diversion.ch
# Script Version 4.1.12
mount_entware(){
if [ -f "${opkgFile%/opkg}/diversion" ]; then
logger -t Diversion "Starting Entware and Diversion services on >
ln -nsf "${opkgFile%/bin/opkg}" /tmp/opt
/opt/etc/init.d/rc.unslung start $0
service restart_dnsmasq
sh /opt/share/diversion/file/ash-history.div
else
logger -t Entware "Starting Entware services, Diversion not fou >
ln -nsf "${opkgFile%/bin/opkg}" /tmp/opt
/opt/etc/init.d/rc.unslung start $0
fi
}
opkgFile=$(/usr/bin/find $1/entware/bin/opkg 2> /dev/null)
if [ "$opkgFile" ] && [ ! -d /opt/bin ]; then
mount_entware $1
elif [ "$opkgFile" ] && [ -d /opt/bin ]; then
logger -t Diversion "Not starting Entware services on $1, Entware is al >
else
opkgUnknown=$(/usr/bin/find $1/entware*/bin/opkg 2> /dev/null)
if [ "$opkgUnknown" ]; then
mv "${opkgUnknown%/bin/opkg}" "${opkgUnknown%/entware*/bin/opkg >
logger -t Diversion "(Alert) Entware folder ${opkgUnknown%/bin/ >
opkgFile=$(/usr/bin/find $1/entware/bin/opkg 2> /dev/null)
mount_entware $1
else
logger -t Diversion "(Notice) $1 does not contain Entware, skip >
fi
fi
#eof
Given that this script is dependent on Diversion and any changes to it are likely to be overwritten if Diversion is updated or reinstalled I suggest a different approach. Just add the cru lines to the end of your existing /jffs/scripts/services-start script.Where is the right point where to add cru ?
Yes, I was just going to suggest that. Alternatively, it could be added to post-mount right after the line that calls mount-entware; here's mine:Given that this script is dependent on Diversion and any changes to it are likely to be overwritten if Diversion is updated or reinstalled I suggest a different approach. Just add the cru lines to the end of your existing /jffs/scripts/services-start script.
#!/bin/sh
swapon /tmp/mnt/Cruzer/myswap.swp # Skynet
rm -f /tmp/mnt/Cruzer/entware/var/log/messages
cru a tls-report "59 23 * * * /jffs/scripts/tls-alert.sh" # added by tlsupdate-installer
cru a logrotate "5 0 * * * /opt/sbin/logrotate /opt/etc/logrotate.conf >> /opt/tmp/logrotate.daily 2>&1" # added by scribe
. /jffs/addons/diversion/mount-entware.div # Added by Diversion
/jffs/addons/unbound/unbound_stats.sh startup # Unbound_Stats.sh
Thanks. That's what I was looking for in post #51. Yes near the end of post-mount would be best in that case.Alternatively, it could be added to post-mount right after the line that calls mount-entware
#!/bin/sh
swapon /tmp/mnt/Entware/myswap.swp # Added by amtm
. /jffs/addons/diversion/mount-entware.div # Added by Diversion
cru a sa1 "*/10 * * * * /opt/lib/sysstat/sa1 600 1 -S DISK"
cru a sa2 "59 23 * * * /opt/lib/sysstat/sa2 -A"
Yes. Now reboot the router and check it withSo you mean in post-mount like this:
Code:#!/bin/sh swapon /tmp/mnt/Entware/myswap.swp # Added by amtm . /jffs/addons/diversion/mount-entware.div # Added by Diversion cru a sa1 "*/10 * * * * /opt/lib/sysstat/sa1 600 1 -S DISK" cru a sa2 "59 23 * * * /opt/lib/sysstat/sa2 -A"
cru l
ASUSWRT-Merlin RT-AC86U 384.17_0 Sun Apr 26 02:28:53 UTC 2020
miazza@RT-AC86U-3150:/tmp/home/root# cru l
*/2 * * * * /etc/openvpn/server1/vpns-watchdog1.sh #CheckVPNServer1#
*/2 * * * * /etc/openvpn/server2/vpns-watchdog2.sh #CheckVPNServer2#
00 2 * * Mon sh /opt/share/diversion/file/update-bl.div reset #Diversion_UpdateBL#
20 5 * * * sh /opt/share/diversion/file/rotate-logs.div #Diversion_RotateLogs#
20 17 * * * diversion count_ads count #Diversion_CountAds#
* * * * * sh /opt/share/diversion/file/yt-blocking.div #Diversion_YTblocking#
*/10 * * * * /opt/lib/sysstat/sa1 600 1 -S DISK #sa1#
59 23 * * * /opt/lib/sysstat/sa2 -A #sa2#
37 7 */7 * * service restart_letsencrypt #LetsEncrypt#
Welcome To SNBForums
SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.
If you'd like to post a question, simply register and have at it!
While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!