Jenkins problems usually surface as complaints: "my build is stuck", "no agents available", "everything was green yesterday". The Jenkins UI shows the current state, but not how the queue grew or when the free executors ran out. This post covers the metrics that answer those questions and five alert rules in PromQL.
The examples use a free Grafana dashboard, Jenkins Lite: https://grafana.com/grafana/dashboards/26040/ . Every metric name below comes from the dashboard JSON.
Expose the metrics
Install the Prometheus metrics plugin in Jenkins. It serves metrics at /prometheus , with the default prefix default_jenkins_ . If you changed the prefix in the plugin settings, the dashboard queries need the same change.
scrape_configs : - job_name : jenkins metrics_path : /prometheus static_configs : - targets : [ "jenkins:8080" ]
Enter fullscreen mode
Exit fullscreen mode
If your Jenkins requires authentication, add credentials to the scrape job (use placeholders in anything you share).…