Page 1 of 1

that the difference between "Sessions and (numer) A Sessions" in USERMANAGER

Posted: Tue Jun 30, 2015 2:39 pm
by snakepitwalt
hi, i get download and upload since sessions in the usermanager, the problem is know not the difference between Sessions and (numer) A Session" Option.

i need delete all Session for restart the upload and download
and wich is the different.

Image


Thanks!

Re: that the difference between "Sessions and (numer) A Sessions" in USERMANAGER

Posted: Tue Jun 30, 2015 2:45 pm
by boen_robot
The label "A sessions" is short for "Active sessions". Basically, users that are currently logged in, and actively using their connection.

The label "Sessions" refers to available sessions... Meaning that if that particular user tries to login at this time, they'd get the profile seen in there.

Sessions are separate from profiles, because a profile tells you a general template (e.g. the profile "profile1" specifies a rate limit 10M/2M for 30 days since the first login), whereas an available session tells what templates are available to a user (e.g. two instances of "profile1" for this user), particularly useful when users pre-order their offer (e.g. pay you for two months in advance) or if they switch profiles (so in the end, they'd have their current instance of "profile1", with their next profile being "profile2").

Re: that the difference between "Sessions and (numer) A Sessions" in USERMANAGER

Posted: Tue Jun 30, 2015 3:18 pm
by snakepitwalt
Thanks, but how delete o clear all sessions? i have 748.000 sessions, manually is impossible,

existe una manera de hacerlo mediante API PHP or terminal?

Re: that the difference between "Sessions and (numer) A Sessions" in USERMANAGER

Posted: Tue Jun 30, 2015 6:37 pm
by boen_robot
From terminal:
/tool user-manager session remove [find]
This will remove all available, as well as all active sessions. Again, keep in mind that this includes advance payments... Your users are likely going to be pissed off with you.

You can remove specific sessions by fine tuning the "find" part in the command above. So for example, to remove all "active" sessions only, but allow users to use other sessions they have assigned to them, you can use
/tool user-manager session remove [find where active=yes]
or conversely, if you want to remove all "extra" sessions, but ensure logged in users stay logged in until their time is up, replace the "yes" above with "no".


Doing the same with my PHP API client is analogous:
<?php
use PEAR2\Net\RouterOS;
require_once 'PEAR2_Net_RouterOS-1.0.0b5.phar';

$util = new RouterOS\Util($client = new RouterOS\Client('192.168.88.1', 'admin', 'password'));

$util->setMenu('/tool user-manager session')->remove($util->find(RouterOS\Query::where('active', 'yes'))); 

Re: that the difference between "Sessions and (numer) A Sessions" in USERMANAGER

Posted: Wed Jul 01, 2015 3:33 pm
by snakepitwalt
is normal may take so long? and he spent an hour and has not removed any session. i have 746.000 but has not eliminated any

Re: that the difference between "Sessions and (numer) A Sessions" in USERMANAGER

Posted: Wed Jul 01, 2015 3:55 pm
by boen_robot
Did it complete though, or did you stopped it? Stopping it restores anything that might've been deleted.

With so many sessions, it's not surprising that it takes so long...

I think you may have already reached a critical point, where it would be faster if you instead backup the rest of your User Manager database, then remove the database file, rebuild the database (based on a new empty file), and restore from your backup the rest of the things.

The effect will be exactly the same as removing all sessions, but should ultimately happen in minutes, rather than hours, unless perhaps you also have 746000 users/profiles/limitations/routers.

Re: that the difference between "Sessions and (numer) A Sessions" in USERMANAGER

Posted: Wed Jul 01, 2015 4:35 pm
by snakepitwalt
It is over correctly, but did not eliminate the sessions are marked in yellow, if you have deleted me active, have executed to remove both active and inactive

Image


i have 1000 clients in the usermanger approximately

Re: that the difference between "Sessions and (numer) A Sessions" in USERMANAGER

Posted: Wed Jul 01, 2015 5:00 pm
by boen_robot
To remove all sessions (active, as well as inactive sessions) from the API, use
$util->setMenu('/tool user-manager session')->remove(); 
It's possible that with the API, you might need to use "true" instead of "yes", and "false" instead of "no"... I haven't tried removing specific items from that particular menu (and I don't currently have a router with User Manager to try it on...).

From terminal though, the aforementioned
/tool user-manager session remove [find where active=yes]
or
/tool user-manager session remove [find where active=no]
should definitely work.

Re: that the difference between "Sessions and (numer) A Sessions" in USERMANAGER

Posted: Wed Jul 01, 2015 10:52 pm
by snakepitwalt
Sorry, but not delete the sessions, the ejecution finished but the sessions not delete. :(



Image

Re: that the difference between "Sessions and (numer) A Sessions" in USERMANAGER

Posted: Thu Jul 02, 2015 2:39 pm
by boen_robot
Looking at this menu's CLI, there's also the "close-session" command... Maybe try that?

From terminal:
/tool user-manager session close-session [find]
or from API:
$closeRequest = new RouterOS\Request('/tool user-manager session close-session');
$closeRequest->setArgument('numbers', $util->setMenu('/tool user-manager session')->find());
$client->sendSync($closeRequest);

(I suggest you try it from terminal first; If it doesn't work from there, it won't work from the API either...)

Re: that the difference between "Sessions and (numer) A Sessions" in USERMANAGER

Posted: Tue Sep 01, 2015 4:49 pm
by ufoshi
I have the same problem. Anybody have solution for this? I think this is a bug of router os.

Re: that the difference between "Sessions and (numer) A Sessions" in USERMANAGER

Posted: Sat Sep 05, 2015 2:10 pm
by navyday
I have the same problem. Anybody have solution for this? I think this is a bug of router os.


1. open winbox.
2. go system and scripts.
3. add new scripts and save.
4.run the script.

Script clear sessions
:local Flag
:set Flag [/tool user-manager session find]
:if ([:len $Flag] > 0) do={/tool user-manager session print;/tool user-manager session remove [/tool user-manager session find];} 

Script clear log
/tool user-manager database clear-log

Re: that the difference between "Sessions and (numer) A Sessions" in USERMANAGER

Posted: Sat May 09, 2020 10:50 pm
by iratirul
/tool user-manager session remove [find where active=no]
should definitely work.
thats work for me, thanks