Our SonarQube integration monitors the performance of your SonarQube application, helping you diagnose and optimize the code. Our SonarQube integration makes use of our infrastructure agent, PosgreSQL agent, NRI-Prometheus, and NRI-JMX and gives you a pre-built dashboard with your most important SonarQube metrics.
After setting up our SonarQube integration, we give you a dashboard for your SonarQube metrics.
Install the infrastructure agent
You can install the infrastructure agent two different ways:
- Our guided install is a CLI tool that inspects your system and installs the infrastructure agent alongside the application monitoring agent that best works for your system. To learn more about how our guided install works, check out our Guided install overview.
- If you'd rather install our infrastructure agent manually, you can follow a tutorial for manual installation for Linux, Windows, or macOS.
Install the PostgreSQL
- Check out our PostgreSQL agent requirements in our documentation before installing the agent.
- Open PostgreSQL Quickstart page PostgreSQL quickstart installation.
- Click Install now to start the PostgreSQL quickstart installation.
Integrate SonarQube with New Relic
Below are the two ways which has to be followed to integrate SonarQube with New Relic.
- nri-prometheus configuration
- nri-jmx configuration
Configure NRI-JMX
Our SonarQube dashboard takes data scraped from your JMX integration and translates it into dashboards. By storing all your data in New Relic, you've a one stop shop to get a full overview of your system's health.
If you haven't already, you'll need to install our JMX monitoring integration. You'll need to make some additional configurations once it's installed.
Example: sudo apt-get install nri-jmx
Forward SonarQube logs to New Relic
You can use our log forwarding to forward SonarQube logs to New Relic.
On Linux machines, your log file named logging.yml
should be present in this path:
$cd /etc/newrelic-infra/logging.d/
After creating the log file, add the following script to the logging.yml
file:
logs: - name: sonar_logs file: /opt/sonarqube/logs/sonar.log attributes: logtype: sonar_logs - name: ce_logs file: /opt/sonarqube/logs/ce.log attributes: logtype: sonar_ce_logs - name: es_logs file: /opt/sonarqube/logs/es.log attributes: logtype: sonar_es_logs - name: web_logs file: /opt/sonarqube/logs/web.log attributes: logtype: sonar_web_logs
Restart the New Relic infrastructure agent
Restart your infrastructure agent.
$sudo systemctl restart newrelic-infra.service
In a couple of minutes, your application will send metrics to one.newrelic.com.
Find your data
You can choose our pre-built dashboard template named SonarQube
to monitor your SonarQube application metrics. Follow these steps to use our pre-built dashboard template:
- From one.newrelic.com, go to the + Add data page.
- Click on Dashboards.
- In the search bar, type
sonarqube
. - The SonarQube dashboard should appear. Click on it to install it.
Your SonarQube dashboard is considered a custom dashboard and can be found in the Dashboards UI. For docs on using and editing dashboards, see our dashboard docs.
Here is a NRQL query to check your SonarQube web status:
SELECT latest(sonarqube_web_uptime_minutes) AS 'SonarQube Web Uptime (minutes)' FROM Metric
Run the following NRQL query using EVENT_NAME
to view the JVM metrics:
SELECT latest(PoolIdleConnections) FROM JVMSampleSonarQubeWebMetrics
What's next?
To learn more about building NRQL queries and generating dashboards, check out these docs:
- Introduction to the query builder to create basic and advanced queries.
- Introduction to dashboards to customize your dashboard and carry out different actions.
- Manage your dashboard to adjust your dashboards display mode, or to add more content to your dashboard.