Status API returns UP while SonarQube is not reachable

  • versions used: SonarQube version
  • When for some reason the database connection is lost the status api will return UP, while SonarQube is not reachable. SonarQube will return a HTTP status 500.
  • steps to reproduce: Start SonarQube correctly, disconnect SonarQube from the database by for example turn off your database and go to the status API.
  • This is a problem because we cannot rely on the status API to check whether SonarQube is reachable or not.

Hi, i guess you are mentioning about api/system/status ? You should use api/system/health, that actually verify the DB connectivity, Web process status, CE process status, and elasticsearch status.

Hi Pierre, the status api is public and the health api is not (for good reasons). We do not need to know the exact reason why sonarqube is unavailable, we just need to know that it is down for monitoring purposes. The status api would be perfect for that.

We could use the health API instead but this requires provisioning a monitoring user with administer system permissions in every sonarqube instance under our management. Any reason why the status API stays available and status “UP” when sonarqube is in fact not up?

api/system/status is more like a readiness endpoint, and api/system/health a liveness endpoint.

Would it be possible to change this behavior so that the status api returns DOWN, or just does not respond at all in the case where sonarqube is offline? Any non-200 code is also acceptable for our monitoring.