Skip to content

Instantly share code, notes, and snippets.

@jazzbanzai
Created March 24, 2024 21:07
Show Gist options
  • Save jazzbanzai/9625ea59437a9ed1a99508445719ca04 to your computer and use it in GitHub Desktop.
Save jazzbanzai/9625ea59437a9ed1a99508445719ca04 to your computer and use it in GitHub Desktop.
#Collect the Data Stats from a MikroTik LTE Interface
#make the empty file
#/file print file="lteCount.txt"
{
#Get RX and TX data from LTE1 interface
:local counterRX [/interface get lte1 rx-byte]
:local counterTX [/interface get lte1 tx-byte]
#Convert to MB
:local counterALL [(($counterRX+$counterTX)/1000000)]
#Get Date/Time
:local date [/system clock get date]
:local time [/system clock get time]
#Print and Log
:put "$date--$time : Interface LTE1 total Data: $counterALL MB"
:log info "$date--$time : Interface LTE1 total Data: $counterALL MB"
:local before value=[/file get "lteCount.txt" contents]
/file set "lteCount.txt" contents="$before \n $date--$time : Interface LTE1 total Data: $counterALL MB"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment