Hi,
I would like to use this WAN Data Monitoring script from Syed Jahanzaib to save daily reports for my pppoe client interface:
https://aacable.wordpress.com/2015/03/09/5386/
I added the script on my Mikrotik RB751U 6.30 and it looks like this:
# MONITOR_DATA Script (to get interface usage in file)
# First Part of WAN Data Quota Monitoring System
# Syed Jahanzaib / aacable@hotmail.com
# https://aacable.wordpress.com
# Set WAN interface you want to monitor
:local INT pppoe-thome *this is the name of my interface
# Gather Interface RX bytes
:local counter [/interface get $INT rx-byte]
# Set Counter DATA value gathered by Interface RX bytes and add TX bytes to get combined value
:set $counter ($counter + [/interface get $INT tx-byte])
:local traffic
# If previous data file not found, then create new one
:if ([:len [/file find where name=wandatauseage.txt]] < 1 ) do={
/file print file=wandatauseage.txt where name=wandatauseage.txt;
# Add some delay, for slow or high load routers
/delay delay-time=2;
# Adding Traffic Value in the file
/file set wandatauseage.txt contents="0";
};
:local before value=[/file get wandatauseage.txt contents]
:if ($counter > $before) do={
/file set wandatauseage.txt contents=$counter
} else= {
:set $traffic ($counter+$before)
/file set wandatauseage.txt contents=$traffic
};
When I run the script the wandatauseage.txt file is created but the numbers in the file are completely unrelated to the TX byte/RX byte counters on my interface.
The number in the script looks like this:
106258568
Could someone please check and see if there are any errors/if it’s incompatible with 6.30
Thank you