Code: Select all
: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");
any help would be appreciated