Forum Discussion

Tim's avatar
Tim
Data Pipeline
09-20-2024
Solved

SSH show online users

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

  • 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.

3 Replies

  • Tim's avatar
    Tim
    Data Pipeline

    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.

  • 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.