Monitor client connections to server

Is there any way of monitoring client connections to the server? For example, if I am logged into the server via ssh, can I confirm if a particular user’s client is connected?

You can perhaps use this occ-command:

user:list shows list of all registered users

user:lastseen shows when the user was logged in last time

That’s useful, I didn’t know about the Lastseen option. That seems to show the time of the last login, but doesn’t tell me if their client is currently connected.

For simply monitor purpose you can use Server Info API, simply call https://YOURdomain/ocs/v2.php/apps/serverinfo/api/v1/info

This is for reference https://github.com/GAS85/cacti_scripts/blob/master/nextcloud_api_poller.sh

Again, useful information, but it still doesn’t tell me who’s connected now.

If you install Audit app and then use this script https://github.com/GAS85/nextcloud_scripts#nextcloud-auditlog

You will be able to see such kind of information with different option. Feel free to adjust it for your purpose.

Connected in means of sending get requests within a time frame. But not a have a valid cookie and did not hit logout button.

Thanks, I’ll take a look. Looks like you’ve put a lot of work into those scripts!