Community discussions

 
chubbs596
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 51
Joined: Fri Dec 06, 2013 6:07 pm

to many winbox/dude sessions

Thu Mar 22, 2018 11:25 am

Hi Guys

We currently use a chr router for a central upgrade server using the Auto upgrade feature, I have written a script that wil check for software and firmware

/system upgrade upgrade-package-source
add address=x.x.x.x user=upgrade
/system upgrade refresh
/system upgrade print
/system upgrade download-all reboot-after-download=yes

We now face a issue where we will see the below error in the log file for the central upgrade CHR

mar/21 02:00:01 warning too many winbox/dude sessions, drop connect from 10.192.1.102
mar/21 02:00:01 warning too many winbox/dude sessions, drop connect from 10.192.0.30
mar/21 02:00:02 warning too many winbox/dude sessions, drop connect from 10.192.0.254
mar/21 02:00:02 warning too many winbox/dude sessions, drop connect from 10.192.0.34
mar/21 02:00:02 warning too many winbox/dude sessions, drop connect from 10.192.0.190
mar/21 02:00:02 warning too many winbox/dude sessions, drop connect from 10.215.0.18

Where can we increase this session count?
 
chubbs596
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 51
Joined: Fri Dec 06, 2013 6:07 pm

Re: to many winbox/dude sessions

Fri Mar 23, 2018 2:33 pm

Anybody that can give me some info or advice?
 
chubbs596
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 51
Joined: Fri Dec 06, 2013 6:07 pm

Re: to many winbox/dude sessions

Fri Mar 30, 2018 7:38 pm

Anybody that can give me some info or advice?
 
chubbs596
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 51
Joined: Fri Dec 06, 2013 6:07 pm

Re: to many winbox/dude sessions

Fri Mar 30, 2018 7:40 pm

This is the scripts used to do the upgrade check everynight at 2am,

/system script
add name=upgrade owner=master policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source=":global pkdowned 2\r\
\n:global davailable 2\r\
\n:global indownload 2\r\
\n:global adone 2\r\
\n:global dgrade 2\r\
\n:global ugrade 2\r\
\n/system upgrade refresh\r\
\n:delay 10\r\
\n:foreach i in=[/system upgrade find] do={\r\
\n:if ([/system upgrade get \$i version] < [/system package update get installed-version]) do={:set \$dgrade 1;} else={:set \$dgrade 0}\r\
\n:if ([/system upgrade get \$i version] > [/system package update get installed-version]) do={:set \$ugrade 1;} else={:set \$ugrade 0}\r\
\n:if ([/system upgrade get \$i version] = [/system package update get installed-version]) do={file remove [find where name ~ \"routeros-\"];:set \$ado\
ne 1;} else={:set \$adone 0}\r\
\n:if ([/system upgrade get \$i status]=\"available\") \tdo={:log warning \"RouterOS available\"; :set \$davailable 1;} else={:set \$davailable 0}\r\
\n:if ([/system upgrade get \$i status]=\"downloaded\") do={:log warning \"RouterOS downloaded\"; :set \$pkdowned 1;} else={:set \$pkdowned 0}\r\
\n/;}\r\
\n:delay 2\r\
\n:while (\$davailable=1) do={\r\
\n :delay 10\r\
\n :foreach i in=[/system upgrade find] do={\r\
\n :if ([/system upgrade get \$i status]=\"available\") do={:log warning \"RouterOS start download\"; /system upgrade download numbers=\$i;}\r\
\n\t :if ([/system upgrade get \$i status]=\"downloading\") do={:log warning \"RouterOS downloading\"; :set \$indownload 1;}\r\
\n\t :if ([/system upgrade get \$i status]=\"downloaded\") do={:log warning \"RouterOS downloaded \"; :set \$pkdowned 1; :set \$davailable 0;}\r\
\n }\r\
\n}\r\
\n:if ((\$pkdowned=1 && \$ugrade=1)) do={:log error \"reboot for upgrade\"; /system reboot;}\r\
\n:if ((\$pkdowned=1 && \$dgrade=1)) do={:log error \"reboot for downgrade\"; /system package downgrade;}\r\
\n:if (\$adone=1) do={:log warning \"RouterOS upto Date\"}\r\
\n:set pkdowned;\r\
\n:set davailable;\r\
\n:set indownload;\r\
\n:set adone;\r\
\n:set dgrade;\r\
\n:set ugrade;\r\
\n"
/system scheduler
add interval=1d name=sched_upgrade_software on-event=upgrade policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon start-date=jan/01/1970 start-time=02:00:00
 
User avatar
Karas
just joined
Posts: 9
Joined: Sat Apr 21, 2012 2:53 am
Location: Port Elizabeth, South Africa

Re: to many winbox/dude sessions

Tue Feb 05, 2019 8:10 am

Having the same issue here.
Ironically, its also at 2am even...
Any advise from anyone?
 
User avatar
Deantwo
Member
Member
Posts: 308
Joined: Tue Sep 30, 2014 4:07 pm

Re: to many winbox/dude sessions

Tue Mar 19, 2019 11:04 am

I don't see any options to set or increase the limit of sessions. I didn't even know there was one.

One thing you could do is spread the update checks out over a larger time period so all the requests don't come at the same time.
Change your schedulers to have a start-time that depends on the router's IP address or something else unique.
For example I use this in one of mine:
/system scheduler {
    :local calculation 
    :local lanIP [/ip address get [:pick [/ip address find interface="bridge"] 0] address]
    :local dotPos
    
    :set dotPos [:find $lanIP "." -1]
    :set lanIP [:pick $lanIP ($dotPos + 1) 15]
    :set dotPos [:find $lanIP "." -1]
    :set calculation [:pick $lanIP 0 $dotPos]
    :set lanIP [:pick $lanIP ($dotPos + 1) 15]
    :set dotPos [:find $lanIP "." -1]
    :set calculation (([:pick $lanIP 0 $dotPos] * 256) + $calculation)
    
    :set calculation ($calculation * 20)
    :set calculation ((($calculation / 3600) % 19) . ":" . \
        (($calculation / 60) % 60) . ":" . ($calculation % 60))
    :put $calculation
    
    remove [find name="myScheduler"]
    add interval=1w name="myScheduler" on-event="myScript" \
        start-date=jan/04/1970 start-time=$calculation
}
Far from perfect, but it gives a little less stress. This script was however originally made to make a weekly script run on any hour during sunday and the script relies on the LAN IP-address scheme I use, so you'll have to change the calculation to suit your needs.

I am slowly gearing up to make a mass upgrade of my ~300 routers, so I guess I'll get to see some of this issue here soon enough.
I wish my FTP was FTL.
 
User avatar
Deantwo
Member
Member
Posts: 308
Joined: Tue Sep 30, 2014 4:07 pm

Re: to many winbox/dude sessions

Tue Mar 19, 2019 4:55 pm

/system scheduler {
    :local uptime [/system resource get uptime]
    :set uptime [:pick $uptime ([:len $uptime] - 5) [:len $uptime]]

    :local calculation (([:tonum [:pick $uptime 0 2]] + [:tonum [:pick $uptime 3 5]]) * 40)
    :set calculation [:totime $calculation]
    :set calculation (04:00:00 + $calculation)

    remove [find name="myScheduler"]
    add interval=1d name="myScheduler" on-event="myScript" \
        start-date=jan/01/1970 start-time=$calculation
}
My predecessor has again been clever when making our setup. Found this snippet in our configuration script (and simplified it a little bit for readability).
Reason for using uptime being that it is the most random thing you have on the router.
It should give a time somewhere between 04:00:00 and 05:00:00 I think.
I wish my FTP was FTL.

Who is online

Users browsing this forum: No registered users and 100 guests