• /
  • EnglishEspañolFrançais日本語한국어Português
  • Se connecterDémarrer

Cette traduction automatique est fournie pour votre commodité.

En cas d'incohérence entre la version anglaise et la version traduite, la version anglaise prévaudra. Veuillez visiter cette page pour plus d'informations.

Créer un problème

Intégration monitoring SonarQube

Notre intégration SonarQube monitore les performances de votre application SonarQube, vous aidant à diagnostiquer et à optimiser le code. Notre intégration SonarQube utilise notre agent infrastructure , l'intégration PosgreSQL, NRI-Prometheus et NRI-JMX et vous offre un dashboard prédéfini avec vos métriques SonarQube les plus importantes.

New Relic SonarQube dashboard

Après avoir configuré notre intégration SonarQube, nous vous fournissons un dashboard pour vos métriques SonarQube.

Installer l' agent d'infrastructure

Pour utiliser l’intégration SonarQube, vous devez d’abord installer l’agent d’infrastructure sur le même hôte. Toutes nos intégrations sur hôte nécessitent l'agent infrastructure , qui permet d'exposer et de rapporter les métriques à New Relic.

Installer l'intégration PostgreSQL

Pour utiliser l'intégration SonarQube, vous devez d'abord installer notre intégration PostgreSQL.

  1. Consultez nos exigences d’intégration PostgreSQL dans notre documentation avant d’installer l’intégration. Confirmez votre compatibilité, puis revenez à ce document.
  2. Ouvrir la page de démarrage rapide de PostgreSQL Installation quickstart de PostgreSQL.
  3. Cliquez sur Install now pour démarrer l’installation quickstart de PostgreSQL.

Configurer NRI-Prometheus

  1. Exécutez la commande suivante pour créer un fichier de configuration NRI-Prometheus :

    bash
    $
    touch /etc/newrelic-infra/integrations.d/nri-prometheus-config.yml
  2. Collez le snippet suivant dans le nouveau fichier de configuration. Assurez-vous de mettre à jour les cluster_name et urls avec vos champs pertinents :

    integrations:
    - name: nri-prometheus
    config:
    # When standalone is set to false nri-prometheus requires an infrastructure agent to work and send data. Defaults to true
    standalone: false
    # When running with infrastructure agent emitters will have to include infra-sdk
    emitters: infra-sdk
    # The name of your cluster. It's important to match other New Relic products to relate the data.
    cluster_name: "YOUR_CLUSTER_NAME"
    targets:
    - description: Sonarqube metrics list
    urls: ["http://user_name:password@YOUR_HOST_IP:9000/api/monitoring/metrics"]
    # tls_config:
    # ca_file_path: "/etc/etcd/etcd-client-ca.crt"
    # cert_file_path: "/etc/etcd/etcd-client.crt"
    # key_file_path: "/etc/etcd/etcd-client.key"
    # Whether the integration should run in verbose mode or not. Defaults to false
    verbose: false
    # Whether the integration should run in audit mode or not. Defaults to false.
    # Audit mode logs the uncompressed data sent to New Relic. Use this to log all data sent.
    # It does not include verbose mode. This can lead to a high log volume, use with care
    audit: false
    # The HTTP client timeout when fetching data from endpoints. Defaults to 30s.
    # scrape_timeout: "30s"
    # Length in time to distribute the scraping from the endpoints
    scrape_duration: "5s"
    # Number of worker threads used for scraping targets.
    # For large clusters with many (>400) endpoints, slowly increase until scrape
    # time falls between the desired `scrape_duration`.
    # Increasing this value too much will result in huge memory consumption if too
    # many metrics are being scraped.
    # Default: 4
    # worker_threads: 4
    # Whether the integration should skip TLS verification or not. Defaults to false
    insecure_skip_verify: true
    timeout: 10s

Installer et configurer l'intégration JMX

Pour utiliser l'intégration SonarQube, vous devez également installer notre intégration de monitoring JMX. L'intégration JMX récupère les données SonarQube, que nous transformerons plus tard en dashboard et en données interrogeables.

  1. Installez notre intégration de monitoring JMX.

  2. Ajoutez le snippet de code suivant à /opt/sonarqube/conf/sonar.properties:

    # SonarQube Web Server JMX configuration.
    sonar.web.javaOpts=-Dcom.sun.management.jmxremote \
    -Dcom.sun.management.jmxremote.port=9010 \
    -Dcom.sun.management.jmxremote.authenticate=false \
    -Dcom.sun.management.jmxremote.ssl=false
    # SonarQube Compute Engine JMX configuration.
    sonar.ce.javaOpts=-Dcom.sun.management.jmxremote \
    -Dcom.sun.management.jmxremote.port=9011 \
    -Dcom.sun.management.jmxremote.authenticate=false \
    -Dcom.sun.management.jmxremote.ssl=false
  3. Ajoutez le snippet de code suivant à /etc/newrelic-infra/integrations.d/jvm-sonarqube-web-metrics.yml/:

    collect:
    - domain: SonarQube
    event_type: JVMSampleSonarQubeWebMetrics
    beans:
    - query: name=AsyncExecution
    attributes:
    - QueueSize
    - WorkerCount
    - LargestWorkerCount
    - query: name=Database
    attributes:
    - MigrationStatus
    - PoolActiveConnections
    - PoolMaxActiveConnections
    - PoolIdleConnections
    - PoolMaxIdleConnections
    - PoolMinIdleConnections
    - PoolInitialSize
    - PoolMaxWaitMillis
    - PoolRemoveAbandoned
    - PoolRemoveAbandonedTimeoutSeconds
    - query: name=SonarQube
    attributes:
    - Version
    - ServerId
    - LogLevel
  4. Ajoutez le snippet de code suivant à /etc/newrelic-infra/integrations.d/jvm-sonarqube-compute-engine-metrics.yml:

    collect:
    - domain: SonarQube
    event_type: JVMSampleSonarQubeComputeEngineMetrics
    beans:
    - query: name=ComputeEngineDatabaseConnection
    attributes:
    - PoolInitialSize
    - PoolActiveConnections
    - PoolMaxActiveConnections
    - PoolIdleConnections
    - PoolMaxIdleConnections
    - PoolMinIdleConnections
    - PoolMaxWaitMillis
    - PoolRemoveAbandoned
    - PoolRemoveAbandonedTimeoutSeconds
    - query: name=ComputeEngineTasks
    attributes:
    - PendingCount
    - LongestTimePending
    - InProgressCount
    - ErrorCount
    - SuccessCount
    - ProcessingTime
    - WorkerMaxCount
    - WorkerCount
    - WorkerUuids
    - EnabledWorkerUuids
  5. Ajoutez le snippet de code suivant à /etc/newrelic-infra/integrations.d/jmx-sonarqube-compute-engine-config.yml:

    integrations:
    - name: nri-jmx
    env:
    COLLECTION_FILES: /etc/newrelic-infra/integrations.d/jvm-sonarqube-compute-engine-metrics.yml
    JMX_HOST: <YOUR_HOST>
    JMX_PASS: admin
    JMX_PORT: 9010
    JMX_USER: admin
    CONNECTION_URL: service:jmx:rmi://<YOUR_IP>:9010/jndi/rmi://<YOUR_IP>:9010/jmxrmi
    REMOTE_MONITORING: "true"
    interval: 15s
    labels:
    env: staging
  6. Ajoutez le snippet de code suivant à /etc/newrelic-infra/integrations.d/jmx-sonarqube-web-config.yml:

    integrations:
    - name: nri-jmx
    env:
    COLLECTION_FILES: /etc/newrelic-infra/integrations.d/jvm-sonarqube-web-metrics.yml
    JMX_HOST: <YOUR_HOST>
    JMX_PASS: admin
    JMX_PORT: 9011
    JMX_USER: admin
    CONNECTION_URL: service:jmx:rmi://<YOUR_IP>:9011/jndi/rmi://<YOUR_IP>:9011/jmxrmi
    REMOTE_MONITORING: "true"
    interval: 15s
    labels:
    env: staging

Transférer le log SonarQube vers New Relic

Suivez ces étapes pour transférer le log SonarQube vers New Relic :

  1. Créez un fichier de log nommé logging.yml dans le chemin suivant :

    bash
    $
    cd /etc/newrelic-infra/logging.d
  2. Ajoutez le script suivant au fichier logging.yml :

    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

Redémarrez l'agent New Relic Infrastructure

Redémarrez votre agent d’infrastructure :

bash
$
sudo systemctl restart newrelic-infra.service

Dans quelques minutes, votre application enverra des métriques à one.newrelic.com.

Trouvez vos données

Vous pouvez choisir notre modèle dashboard prédéfini nommé SonarQube pour monitorer les métriques de votre application SonarQube. Suivez ces étapes pour utiliser notre modèle dashboard prédéfini :

  1. De one.newrelic.com, aller à la page + Integrations & Agents .

  2. Cliquez sur Dashboards.

  3. Dans la barre de recherche, tapez sonarqube.

  4. Le dashboard SonarQube devrait apparaître. Cliquez dessus pour l'installer.

    Votre dashboard SonarQube est considéré comme un dashboard personnalisé et peut être trouvé dans l'UI Dashboards. Pour obtenir des documents sur l'utilisation et la modification du dashboard, consultez notre documentation dashboard .

    Voici quelques exemples de requêtes NRQL pour les données Postfix :

Quelle est la prochaine étape ?

Pour en savoir plus sur la création de requêtes NRQL et la génération de dashboards, consultez ces documents :

Droits d'auteur © 2025 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.