mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
update omr-quota to compare in kbits as mentioned in GUI
vnstat by default reports the values in bits, however the OMR UI configuration asks values to be given in kbits. This commit fixes the omr-quota script by converting vnstat output to kbits.
This commit is contained in:
parent
a3f974749e
commit
fe68088b4f
1 changed files with 4 additions and 2 deletions
|
@ -11,8 +11,10 @@ shift
|
|||
# main loop
|
||||
while true; do
|
||||
OMR_QUOTA_REAL_INTERFACE="$(ifstatus $OMR_QUOTA_INTERFACE | jsonfilter -e '@.l3_device')"
|
||||
rx=`vnstat -i $OMR_QUOTA_REAL_INTERFACE --json | jsonfilter -q -e '@.interfaces[0].traffic.month[-1].rx' | tr -d "\n"`
|
||||
tx=`vnstat -i $OMR_QUOTA_REAL_INTERFACE --json | jsonfilter -q -e '@.interfaces[0].traffic.month[-1].tx' | tr -d "\n"`
|
||||
rx_bits=`vnstat -i $OMR_QUOTA_REAL_INTERFACE --json | jsonfilter -q -e '@.interfaces[0].traffic.month[-1].rx' | tr -d "\n"`
|
||||
tx_bits=`vnstat -i $OMR_QUOTA_REAL_INTERFACE --json | jsonfilter -q -e '@.interfaces[0].traffic.month[-1].tx' | tr -d "\n"`
|
||||
rx=$((rx_bits/1024))
|
||||
tx=$((tx_bits/1024))
|
||||
tt=$((rx + tx))
|
||||
if [ -n "$OMR_QUOTA_RX" ] && [ "$OMR_QUOTA_RX" -gt 0 ] && [ -n "$rx" ] && [ "$OMR_QUOTA_RX" -le "$rx" ]; then
|
||||
if [ "$(ifstatus $OMR_QUOTA_INTERFACE | jsonfilter -e '@.up')" = "true" ]; then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue