script for interface traffic

i need script to current interface bandwidth / traffic in sms

for example

Interface name PPP 86Mbps
some thing like that
need experts suggestion

Have you considered using snmp?

If you don’t use snmp, you can get these values with scripting. Use this script as an example, modify it to send the output over sms, email or other..:

{
:local iname;
:local monitor;
:local speedRX;
:local speedTX;
:local mbpsRX;
:local mbpsTX;
:foreach interface in=[/interface find] do={
:delay 100ms;
:set $iname [/interface get $interface name];
:set $monitor [/interface monitor-traffic $iname as-value once];
:set $speedRX ($monitor->“rx-bits-per-second”);
:set $speedTX ($monitor->“tx-bits-per-second”);
:set $mbpsRX (($speedRX/1000)/1000);
:set $mbpsTX (($speedTX/1000)/1000);
:put “$iname RX:$mbpsRX Mbps TX:$mbpsTX Mbps”;
}
}

thx for reply bro im doing this

interface monitor-traffic [/interface find name=Local] once do={
:local tx (tx-bits-per-second / 1000)/1000);
:local rx (rx-bits-per-second / 1000)/1000);
:put $tx;
:put $rx;
/tool e-mail send to=> youremail@hotmail.com > subject=“test” body=“Mbps = $tx Mbps = $rx” tls=yes
}

getting result Mbps = 80 Mbps = 9 :slight_smile: