docker run -d --name jenkins -p 8081:8080 -p 50000:50000 jenkins/jenkins:latest
docker run -d --name prometheus -p 9090:9090 prom/prometheus
docker run -d --name grafana -p 3000:3000 grafana/grafana
Go to “manage Jenkins” then “manage plugins” and install “Prometheus metrics”.
Prometheus metrics
docker restart jenkins
prometheus plugin doesn’t support dynamic loading. Jenkins needs to be restarted for the update to take effect.
You can see the output of this plugin visiting this URL “http://Jenkins_HOST:PORT/prometheus”
In the scrape_configs part you need to add a job for Jenkins server:
docker exec -it prometheus sh
tee -a /etc/prometheus/prometheus.yml <<EOF
- job_name: jenkins
metrics_path: /prometheus
static_configs:
- targets: ['172.17.0.1:8081']
EOF
172.17.0.1 docker bridges ip
docker restart prometheus
check it: go to http://localhost:9090/targets
-
1.Go to Grafana server localhost:3000 and login. The default user and password are “admin/admin”
-
2.From “ Home Dashboard” click on “add data source” then click on “Prometheus”.
Login to Grafana, and add Dashboard with ID: 9964
Ref: