Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Try to get the number of logged in users in add-on.

Joel Suter March 2, 2018

Hello together

I am writing a monitor plugin for Bitbucket. I need to get the number of users who are logged in, so i need the number of user sessions. I tried to do it with the Bitbucket Java API but I can't seem to find a class and method that provides this information.

Do you guys know where i can get that information? Java or REST API? Database? I couldn't find it anywhere but it's almost certainly possible.

Thanks for the help.

1 answer

0 votes
Caterina Curti
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 2, 2018

Hi Joel,

An approach you could take here could be to use a combination of the following information:

- last login for a user

- session duration

The last authentication can be retrieved with the /rest/api/1.0/admin/users REST API and is also displayed in the user interface (see this article for more details) and. The GET method will return the lastAuthenticationTimestamp.

Just by using the last authentication, you should get a good understanding of which users are using Bitbucket Server. This value is update both for browser login and git operations.

The session timeout is 30 minutes, but depending on the remember-me configuration may be longer (see bitbucket.properties).

 

For monitoring, we usually suggest to rely on the access log (see how to read the Bitbucket Server logs) and enabling the JMX counters (JMX counters for Bitbucket Server). At the moment they don't provide exactly the session count, but may give you some alternative ideas on the items to monitor.

 

Thanks, Caterina - Atlassian

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events