cancel
Showing results for 
Search instead for 
Did you mean: 

SSH show online users

Tim
10 - ETL
10 - ETL

In the SSH CLI, can I see who's currently online on the Sisense website?

I want to reboot my server, but first I want to check no one is online.

Normally I do this through the Admin page. But that's broken at the moment (that's why I want to reboot).

1 ACCEPTED SOLUTION

Tim
10 - ETL
10 - ETL

Thanks, that got me there.

For others (and future me), what I did was:

I used kubectl to query mongodb. My query returned a list of usernames and lastupdated datetimes. I think lastupdated here refers to the last time the user did something like loading a page or updating a dashboard; you might like to experiment exactly what causes lastupdated to update.

1. kubectl -n sisense get pods
Make a note of the "sisense-mongodb-*" pod's name.

2. kubectl -n sisense exec -it sisense-mongodb-<name you got in 1> -c mongodb -- mongo prismWebDB --quiet --eval 'db.getCollection("socket-sessions").find({"registrationDetails.headers.authentication.isAuthenticated": true }, {_id: 0, "registrationDetails.user.userName": 1, "registrationDetails.user.tenant.name": 1, "registrationDetails.user.lastUpdated": 1}).toArray();'

3 (Optional). You get a JSON array representing lots of sessions. I parsed and aggregated it to get the latest lastUpdated datetime for each user. You might like to also filter to where lastUpdated is in the last 24hr.

View solution in original post

3 REPLIES 3

DRay
Community Team Member
Community Team Member

Hello @Tim,

Thank you for reaching out. You are on Linux, correct? Can you specify which version, and if you are self-hosted or not?

Thank you.

David Raynor (DRay)

DRay
Community Team Member
Community Team Member

Can you take a look at this post and let me know if it helps? https://community.sisense.com/t5/product-feedback-forum/api-to-retrieve-sessions-table-details/idi-p...

David Raynor (DRay)

Tim
10 - ETL
10 - ETL

Thanks, that got me there.

For others (and future me), what I did was:

I used kubectl to query mongodb. My query returned a list of usernames and lastupdated datetimes. I think lastupdated here refers to the last time the user did something like loading a page or updating a dashboard; you might like to experiment exactly what causes lastupdated to update.

1. kubectl -n sisense get pods
Make a note of the "sisense-mongodb-*" pod's name.

2. kubectl -n sisense exec -it sisense-mongodb-<name you got in 1> -c mongodb -- mongo prismWebDB --quiet --eval 'db.getCollection("socket-sessions").find({"registrationDetails.headers.authentication.isAuthenticated": true }, {_id: 0, "registrationDetails.user.userName": 1, "registrationDetails.user.tenant.name": 1, "registrationDetails.user.lastUpdated": 1}).toArray();'

3 (Optional). You get a JSON array representing lots of sessions. I parsed and aggregated it to get the latest lastUpdated datetime for each user. You might like to also filter to where lastUpdated is in the last 24hr.