script works only on one RB

Hi there i have two rb433 which is almost setup the same way. All that is different is the qeues and SSID’s. The rules and card are all the same. In the one rb i have setup a script…

:log info “Starting QUEUE Statistics Checker”

#####DEFINE VARIABLES#####
:local slashchecker
:local slashcheckertotal
:local bytecountedup
:local bytecounteddown
:local megcountedup
:local megcounteddown
:local slashcounter
:local precalcbytes
:local pickbegin
:local pickend
:local slashcounted
:local slashcounted1
:local numberofqueues
:local test
:local interfacename
:local emailvariable
:local highsitename
:local fromemailaddress
:local toemailaddress
#####VARIABLES DEFINED#####

########## CHANGE INDIVIDUAL DETAILS HERE: ##########
:set fromemailaddress “EMI_home@kleinkarootoyota.co.za
:set toemailaddress “emile@jcwmail.co.za
########## END OF INDIVIDUAL DETAILS ##########

#####COUNT NUMBER OF QUEUES#####
:set numberofqueues [/queue simple print count-only]
:set highsitename [/system identity get name]
##ADD DETAILS TO E-MAIL VARIABLE##
:set emailvariable "QUEUE STATISTICS FOR:
$highsitename

TOTAL NUMBER OF QUEUES: $numberofqueues"
##ADD DETAILS TO E-MAIL VARIABLE DONE##

#####BEGIN MAIN LOOP FOR QUEUE PROCESSING#####
/queue simple
:foreach n in=[/queue simple find priority=8] do={
:local interfacename [/queue simple get [$n] name]

#####SEPERATE UP/DOWN BYTES FROM QUEUE#####
##PRESET VARIABLES##
:local precalcbytes [:pick [/queue simple get [$n] bytes] 0 30]
:set slashcheckertotal $precalcbytes
:set pickbegin 1
:set pickend 2
:set slashcounter 0

#####START SLASH CHECKER#####
/queue simple
:for i from=1 to=20 do={

:set pickbegin (pickbegin + 1)
:set pickend (pickend + 1)
:set slashchecker [:pick $slashcheckertotal $pickbegin $pickend]

:if ($slashchecker = “/”) do={
:set slashcounted $pickbegin } else={ :set slashcounter ($slashcounter +1)}
}
#:log info “SLASHCOUNTED: $slashcounted”
#####SLASHCHECKER LOOP END#####

#####GOT SLASH PICK COUNT, STARTING BYTES UP AND DOWN SPLIT#####
:set slashcounted1 ($slashcounted + 1)
:set bytecountedup [:pick $precalcbytes 0 $slashcounted]
:set bytecounteddown [:pick $precalcbytes $slashcounted1 30]
:set megcountedup ($bytecountedup / 1000000)
:set megcounteddown ($bytecounteddown / 1000000)
#:log info “INTERFACE NAME: $interfacename”
#:log info “PRECALCBYTES: $precalcbytes”
#:log info “BYTECOUNTEDUP $bytecountedup BYTES”
#:log info “BYTECOUNTEDDOWN $bytecounteddown BYTES”
#:log info “MEGCOUNTEDUP $megcountedup MB”
#:log info “MEGCOUNTEDDOWN $megcounteddown MB”
#:log info " "
#:log info " "
##ADD ABOVE INFO TO EMAIL VARIABLE##
:set emailvariable "$emailvariable

QUEUE NAME:\t\t\t$interfacename
TOTAL BYTES:\t\t$precalcbytes
UPLOADED BYTES:\t\t$megcountedup MB
DOWNLOADED BYTES:\t\t$megcounteddown MB

"
##UPDATE OF EMAIL VARIABLE DONE##

}
#####END OF QUEUE PROCCESSOR LOOP#####


#####SENDING DETAIL TO EMAIL#####
:set emailvariable “$emailvariable
END OF QUEUE STATISTICS FOR: $highsitename”

/tool e-mail send from=$fromemailaddress to=$toemailaddress server=192.168.0.51 subject=“$highsitename QUEUE Statistics” body=$emailvariable
#####END OF SENDING EMAIL#####

:log info “Total number of queues processed: $numberofqueues”
:log info “QUEUE Statistics Check DONE and E-Mailed to $toemailaddress”

It is working in the one RB but not in the other. i was thinking maybe the email system was not working. So i type in /tool/e-mail/send to=emile@jcwmail.co.za and it send. But the script is not working. What can it be? Both are setup the same way with everything the same but it is not working.

different version of RouterOS?

they both have ros3.23, they are both rb433, same script. Im trying to figure out the problem now.

Strange but the script it working now. All that i have done is to setup hotspot and now it works