How to monitor if Bitbucket Server is up and running
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Purpose
Administrators may wish to monitor if Bitbucket Server is up and running at any given time. This can also be used as a health check status endpoint for load balancers or proxies. This article suggests a simple approach to address this requirement.
Solution
For monitoring if your Bitbucket Server is up, you can periodically send the <Bitbucket_Base_URL>/status
request and interpret the response received to such request.
For example, the following command:
curl <Bitbucket_Base_URL>/status
will return one of the following responses, depending on the current status of your Bitbucket Server:
Response | HTTP response code | Meaning |
---|---|---|
| Other | Tomcat/Bitbucket Server is too busy to respond to this request. |
{"state":"STARTING"} | 503 | The application is starting up, but not yet available Not yet ready to receive in-coming requests. It is optional to forward requests in this state. Users will see the Starting Bitbucket with the progress bar and Git requests will be queued until Bitbucket is ready for them. Requests could time out. |
{"state":"FIRST_RUN"} | 200 | The application is running for the first time and has not yet been configured. All requests to the web UI will be redirected to the First Run Wizard. Not ready to receive in-coming requests but request should still be forwarded to Bitbucket. |
{"state":"RUNNING"} | 200 | Bitbucket is up and running Ready to receive in-coming requests. |
{"state":"MAINTENANCE"} | 200 | The application is currently not available because the application is under maintenance. Blocking with the Load Balancer or proxy could block Bitbucket from coming out of maintenance mode. Should allow in-coming requests. |
{"state":"ERROR"} | 500 | The application is currently not available because of an error. Not ready to receive in-coming requests. |
{"state":"STOPPING"} | 503 | The application is shutting down. |
Note
- If you have Bitbucket Data Center, with multiple nodes accessed via Load Balancer, you will need to send these requests directly to the individual nodes.
- For more advanced scenarios, please consult: Bitbucket Data Center sample deployment and monitoring strategy