Community discussions

MikroTik App
 
snakepitwalt
just joined
Topic Author
Posts: 17
Joined: Wed May 27, 2015 5:11 pm

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

Tue Jun 30, 2015 2:39 pm

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!
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2400
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

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

Tue Jun 30, 2015 2:45 pm

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").
 
snakepitwalt
just joined
Topic Author
Posts: 17
Joined: Wed May 27, 2015 5:11 pm

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

Tue Jun 30, 2015 3:18 pm

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?
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2400
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

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

Tue Jun 30, 2015 6:37 pm

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'))); 
 
snakepitwalt
just joined
Topic Author
Posts: 17
Joined: Wed May 27, 2015 5:11 pm

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

Wed Jul 01, 2015 3:33 pm

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
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2400
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

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

Wed Jul 01, 2015 3:55 pm

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.
 
snakepitwalt
just joined
Topic Author
Posts: 17
Joined: Wed May 27, 2015 5:11 pm

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

Wed Jul 01, 2015 4:35 pm

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
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2400
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

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

Wed Jul 01, 2015 5:00 pm

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.
 
snakepitwalt
just joined
Topic Author
Posts: 17
Joined: Wed May 27, 2015 5:11 pm

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

Wed Jul 01, 2015 10:52 pm

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



Image
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2400
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

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

Thu Jul 02, 2015 2:39 pm

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...)
 
ufoshi
just joined
Posts: 1
Joined: Tue Sep 01, 2015 4:30 pm

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

Tue Sep 01, 2015 4:49 pm

I have the same problem. Anybody have solution for this? I think this is a bug of router os.
 
navyday
just joined
Posts: 3
Joined: Thu Nov 13, 2014 1:17 pm
Location: Greece

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

Sat Sep 05, 2015 2:10 pm

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
 
iratirul
just joined
Posts: 4
Joined: Sat Jan 28, 2017 7:20 pm

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

Sat May 09, 2020 10:50 pm

/tool user-manager session remove [find where active=no]
should definitely work.
thats work for me, thanks