Interface TX, RX byte Backup every day

:slight_smile:
HI

I want to take Interface tx byte and rx byte backup and email every 6 hour. can any one help me?


Tuhin

Write a script that is scheduled to run every 6 hours. In that script use this command to get your current rx and tx values:

:local tx [/interface ethernet get <interface> driver-tx-byte] 
:local rx [/interface ethernet get <interface> driver-rx-byte]

Thanks for the reply

But how to see the value and email it?

Thanks

Tuhin

Change username, password and ether1-LAN to your values

/tool e-mail
set address=0.0.0.0 from=username@gmail.com password=pass port=25 starttls=no user=username



/system script
add name=script1 policy=ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api source="#get tx - rx\r\
    \n:local tx [/interface ethernet get ether1-LAN driver-tx-byte]\r\
    \n:local rx [/interface ethernet get ether1-LAN driver-rx-byte]\r\
    \n\r\
    \n#get name date and time\r\
    \n:local name [/system identity get name];\r\
    \n:local date [/system clock get date];\r\
    \n:local time [/system clock get time];\r\
    \n\r\
    \n#make subject message\r\
    \n:local sub (\$name . \" - \" . \$time . \" - \" . \$date);\r\
    \n#make body message\r\
    \n:local bod (\"Ether1-LAN - TX: \" . \$tx . \" - RX:\" . \$rx);\r\
    \n#send e-mail\r\
    \n/tool e-mail send to=\"username@gmail.com\" subject=\$sub body=\$bod  server=[:resolve smtp.gmail.com] tls=yes;\r\
    \n\r\
    \n"



/system scheduler
add disabled=no interval=6h name=script1 on-event=script1 policy=ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api start-date=dec/11/2013 \
    start-time=12:00:00

You can also use SNMP requests from some server of yours and store the result the way you want (file, dataase, mail, whatever). SNMP command-line clients are widely available.