How to retrieve scan metrics from Sonarqube

“Sonarqube”

I been using Sonarqube community for some time now, and one thing that I’m missing is the ability to retrieve some metrics on how are the teams using it.

  • Goal: Get Scan Events

With Administrative privileges go to Administration + Projects + Background Tasks However, I found out that that information is limited to a short number of events. “Background Tasks”

  • Goal: Get Events from API

Now that I know that this information is stored, lets look at the APIs to see which one would allow me to retrieve this? Web-API Or in your own instance documentation: api/ce/activity

  • Goal: Get a Script to do this automatically

If you follow and run curl with the generated token you will be limited to 1000 entries, so I need to develop a simple script to do this for me GitHub link

  • Done!

Script Output Statistics

Referenced in the Sonarqube community “forum”: Sonarqube usage for last 6 months time