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).
Tim von Ahsen
Posted 1 year ago·Last reply 9 months ago
4 comments
cofele3062
·9 months agoHey folks, this is a classic sysadmin puzzle—I've been there! For showing online users via SSH, the go-to commands are 'who' for a quick list or 'w' for detailed stats including idle time and what they're running. If you're on a Linux box, finger might work too but it's often disabled for security. Pro tip: script it with 'watch -n 5 who' to refresh every 5 seconds.
Tim von Ahsen
OP1 year agoThanks, 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.
DRay
·1 year agoCan 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/12637
DRay
·1 year agoHello 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.