Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Table of Contents

The SonarQube Server offers visibility about what happens internally through the exposure of JMX MBeans. ElasticSearch (ES) is used for searching in SonarQube, and there are multiple dedicated tools for ES monitoring.

Exposed JMX MBeans

In addition to the classical Java MBeans providing information about the ClassLoader, OS, Memory and Threads you have access to four more MBeans in the SonarQube Server:

  • ComputeEngine
  • Database
  • ElasticSearch
  • SonarQube

All these MBeans are read-only. It's not possible to modify or reset their values in real time.

ComputeEngineTasks MBean

Attribute Name

Description

ProcessingTime

Measure the time (in ms) spent to process Background Tasks since the last restart of SonarQube. Its value will always increase and will be reset by a restart of SonarQube.

This measure is very powerful when:

  • combined with SuccessCount and ErrorCount measures to get the average time to handle a Background Task
  • used to understand how much time the SonarQube Server is spending during a day to handle Background Tasks. It gives you an indication of the load on your server.
ErrorCountNumber of Background Tasks which failed since the last restart of SonarQube
PendingCountNumber of Background Tasks waiting to be processed since the last restart of SonarQube
InProgressCountNumber of Background Tasks currently under processing. Its value is either 1 or 0, since SonarQube can process only one task at a time.
SuccessCount

Number of Background Tasks successfully processed since the last restart of SonarQube

WorkerCountNumber of Background Tasks that can be processed at the same time

Note:

  • the total number of Background Tasks handled since the last restart of SonarQube is equal to SuccessCount + ErrorCount
  • these values are reset to their default values by restarting SonarQube

Database MBean

Same attributes are available for both ComputeEngineServer and WebServer.

Attribute Name

Description

MigrationStatus

Possible values are: UP_TO_DATE, REQUIRES_UPGRADE, REQUIRES_DOWNGRADE, FRESH_INSTALL

(only available for WebServer).

PoolActiveConnectionsNumber of active database connections
PoolIdleConnectionsNumber of database connections waiting to be used
PoolInitialSizeInitial size of the database connections pool.
PoolMaxActiveConnectionsMaximum number of active database connections
PoolMaxIdleConnectionsMaximum number of database connections waiting to be used
PoolMaxWaitMillisIn milliseconds
PoolRemoveAbandonedPossible values : true, false
PoolRemoveAbandonedTimeoutSecondsIn Seconds

ElasticSearch MBean

Attribute Name

Description

NumberOfNodesNumber of ES Nodes in your SonarQube installation.
StatePossible values are: GREEN, YELLOW, RED

SonarQube MBean

Attribute Name

Description

LogLevelLog Level: INFO, DEBUG, TRACE
ServerId

SonarQube Server ID

VersionSonarQube Version

How to Activate JMX ?

Local Access

There is nothing to activate to view SonarQube MBeans if your tool is running on the same server as the SonarQube Server.

Remote Access

Here are examples of configuration to activate remote access to JMX MBeans.

For the WebServer:

# JMX WEB - 10443/10444
sonar.web.javaAdditionalOpts=-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=true -Dcom.sun.management.jmxremote.port=10443 -Dcom.sun.management.jmxremote.rmi.port=10444 -Dcom.sun.management.jmxremote.password.file=/opt/sonarsource/sonar/conf/jmxremote.password -Dcom.sun.management.jmxremote.access.file=/opt/sonarsource/sonar/conf/jmxremote.access

For the SearchServer:

sonar.search.javaAdditionalOpts=-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=true -Dcom.sun.management.jmxremote.port=19010 -Dcom.sun.management.jmxremote.rmi.port=19011 -Dcom.sun.management.jmxremote.password.file=/opt/sonarsource/sonar/conf/jmxremote.password -Dcom.sun.management.jmxremote.access.file=/opt/sonarsource/sonar/conf/jmxremote.access

For the ComputeEngine:

There is no specific javaAdditionalOpts entry, simply amend the sonar.ce.javaOpts one.

Example of jmxremote.access:

#
# JMX Access Control file
#
reader readonly
admin  readwrite \
              create javax.management.monitor.*,javax.management.timer.*,com.sun.management.*,com.oracle.jrockit.* \
              unregister

Example of jmxremote.password:

#
# JMX Access Password file
#
reader readerpassword
admin  adminpassword

Note: on jmxremote.password, you should apply chmod 600 or 400 for security reasons.

How to Monitor ElasticSearch?

Configure in conf/sonar.properties the entry sonar.search.httpPort. This will activate the ElasticSearch REST End-Point required by most ES Monitoring Tools.

Here what you can get using Elastic HQ (Free, OS) :


  • No labels