PodMonitor with prometheus metric scraping in kubernetes

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarQube Developer edition
    Version: 9.7.1.62043

  • what are you trying to achieve
    scrap sonarqube metrics to monitor the server with podmonitor

  • what have you tried so far to achieve this
    created a podmonitor crd inside namespace where prometheus is deployed, I can see podmonitor in target in prometheus targets but how can I access the metrics or how can I create a dashboard out of the scraped metrics?

podmonitor yaml:

apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: sonarqube-pod-monitor
namespace: infra
spec:
namespaceSelector:
matchNames:
- sonarqube
podMetricsEndpoints:

  • interval: 30s
    path: /
    scheme: http
    targetPort: monitoring-ce
  • interval: 30s
    path: /
    scheme: http
    targetPort: monitoring-web
    selector:
    matchLabels:
    app: sonarqube

prometheus targets:
image

Hi @kemil-sakhareliya,

You probaby want to create a dashboard in grafana using Prometheus as a time series database for that. As far as I remember the sonarqube metrics all start with sonarqube_.

Hope that helps

Hey. thanks for the suggestion, I actually tried querying and yes I could see the metrics but when I try to import any dashboard of sonarqube then I receive no metrics on it.

I tried these:

but I think these dashboards are not made for the metrics podmonitor provides.
These are the metrics I am scraping:

If you would know any pre-made dashboard for podmonitor metrics. Please share. Thank you.

There are examples in the github repo of the official Helm charts of sonarsource: helm-chart-sonarqube/examples/grafana at master · SonarSource/helm-chart-sonarqube · GitHub