Community discussions

MikroTik App
 
actnoon
just joined
Topic Author
Posts: 1
Joined: Fri Aug 18, 2017 1:57 am
Location: Egypt

Script to monitor interface bytes

Fri Aug 18, 2017 2:13 am

:global monitorIN1 0;
:global monitorIN2 0;
:local newin1 0;
:local newin2 0;
:local usedin1 0;
:local usedin2 0;
:local totalin1 0;
:local totalin2 0;
:set newin1 ([/interface get [find name=IN1] rx-byte] + [/interface get [find name=IN1] tx-byte]);
:set newin2 ([/interface get [find name=IN2] rx-byte] + [/interface get [find name=IN2] tx-byte]);
:set usedin1 [/interface get [find name=monitor1] comment];
:set usedin2 [/interface get [find name=monitor2] comment];
:set totalin1 ($newin1 + $usedin1);
:set totalin2 ($newin2 + $usedin2);
/interface set [find name=monitor1] comment= $totalin1;
/interface set [find name=monitor2] comment= $totalin2;
:set monitorIN1 ($totalin1 / 1073741824);
:set monitorIN1 ($monitorIN1." GB");
:set monitorIN2 ($totalin2 / 1073741824);
:set monitorIN2 ($monitorIN2." GB");
/interface ethernet reset-counters IN1;
/interface ethernet reset-counters IN2;
:log info("Interfaces counters have been reset");
I got a syntax error and a script error when I put that script into terminal
any help would be appreciated :)
 
SilverNodashi
Frequent Visitor
Frequent Visitor
Posts: 87
Joined: Mon Sep 04, 2017 4:18 pm
Location: South Africa
Contact:

Re: Script to monitor interface bytes

Tue Sep 19, 2017 1:41 pm

Can you post the syntax error and script error here?
 
Ma7m0d
just joined
Posts: 1
Joined: Tue Dec 12, 2017 12:57 pm

Re: Script to monitor interface bytes

Tue Dec 12, 2017 1:15 pm

hi all i need script to make a qouta like 20 GB to a name in simple queue monitor upload and download when ritch a limt speed well be change to 128
 
User avatar
ADahi
Member Candidate
Member Candidate
Posts: 209
Joined: Thu Sep 21, 2017 7:16 pm
Location: Iraq, Ninavah
Contact:

Re: Script to monitor interface bytes

Fri Dec 15, 2017 5:01 pm

hi all i need script to make a qouta like 20 GB to a name in simple queue monitor upload and download when ritch a limt speed well be change to 128


viewtopic.php?f=9&t=126573#p631249
 
User avatar
ADahi
Member Candidate
Member Candidate
Posts: 209
Joined: Thu Sep 21, 2017 7:16 pm
Location: Iraq, Ninavah
Contact:

Re: Script to monitor interface bytes

Fri Dec 15, 2017 5:15 pm

{
:global monitorIN1 0;
:global monitorIN2 0;
:local newin1 0;
:local newin2 0;
:local usedin1 0;
:local usedin2 0;
:local totalin1 0;
:local totalin2 0;
:set newin1 ([/interface get [find name=IN1] rx-byte] + [/interface get [find name=IN1] tx-byte]);
:set newin2 ([/interface get [find name=IN2] rx-byte] + [/interface get [find name=IN2] tx-byte]);
:set usedin1 [/interface get [find name=monitor1] comment];
:set usedin2 [/interface get [find name=monitor2] comment];
:set totalin1 ($newin1 + $usedin1);
:set totalin2 ($newin2 + $usedin2);
/interface set [find name=monitor1] comment= $totalin1;
/interface set [find name=monitor2] comment= $totalin2;
:set monitorIN1 ($totalin1 / 1073741824);
:set monitorIN1 ($monitorIN1." GB");
:set monitorIN2 ($totalin2 / 1073741824);
:set monitorIN2 ($monitorIN2." GB");
/interface ethernet reset-counters IN1;
/interface ethernet reset-counters IN2;
:log info ("Interfaces counters have been reset"); 
}

space after ":log info " , and do not forgot to put script inside { }

Who is online

Users browsing this forum: No registered users and 12 guests