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

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.




Thanks!

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”).

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?

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'))); 

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

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.

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




i have 1000 clients in the usermanger approximately

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.

Sorry, but not delete the sessions, the ejecution finished but the sessions not delete. :frowning:



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…)

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

thats work for me, thanks