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

  • 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
name: sonarqube-pod-monitor
namespace: infra
- sonarqube

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

prometheus targets:

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