using of this script im getting down / upload (rx/tx) value in sms but i want to get report of more then one interface upload and download value in one sms how its possible
interface monitor-traffic [/interface find name=WAN-1] once do={
:local lx (tx-bits-per-second / 1000000);
:local dx (rx-bits-per-second / 1000000);
/tool sms send message="WAN-1 :--\n$dx Mbps Download\n$lx Mbps Upload" phone-number=01XXXXXXX usb3
You could collect the reads in an array that’s defined outside, and then send the SMS after all reads are done.
e.g.
#Setup interfaces
:local reads ({"WAN-1"={};"WAN-2"={}});
#Gather reads for each interface
:foreach name,read in=$reads do={
/interface monitor-traffic interface=$name once do={
:set ($reads->$name) ({"upload"=($"tx-bits-per-second" / 1000000);"download"=($"rx-bits-per-second" / 1000000)});
};
};
#Compose the message out of the reads
:local message "";
:foreach name,read in=$reads do={
:set message ($message . $name . " :--\n" . ($read->"download") . "Mbps Download\n" . ($read->"upload") . "Mbps Upload\n");
};
#Send the message
/tool sms send message=$message phone-number=01XXXXXXX usb3
thanks for reply i just change interface names and number but not working no sms received
boen_robot:
You could collect the reads in an array that’s defined outside, and then send the SMS after all reads are done.
e.g.
#Setup interfaces
:local reads ({"WAN-1"={};"WAN-2"={}});
#Gather reads for each interface
:foreach name,read in=$reads do={
/interface monitor-traffic interface=$name once do={
:set ($reads->$name) ({"upload"=($"tx-bits-per-second" / 1000000);"download"=($"rx-bits-per-second" / 1000000)});
};
};
#Compose the message out of the reads
:local message "";
:foreach name,read in=$reads do={
:set message ($message . $name . " :--\n" . ($read->"download") . "Mbps Download\n" . ($read->"upload") . "Mbps Upload\n");
};
#Send the message
/tool sms send message=$message phone-number=01XXXXXXX usb3