Am I missing something ?
I'm new to Prometheus, Trying to monitor a service, I followed the doc as it is, however when I run prometheus to supervise my springboot application it shows me always that its status is down :
when I get : http://localhost:8080/prometheus
that's the docker-compose I'm using:
version: '3.8'
services:
prometheus:
image: prom/prometheus:v2.33.1
container_name: prometheus
ports:
- 9090:9090
volumes:
- ./prometheus.yaml:/etc/prometheus/prometheus.yml:ro
grafana:
image: grafana/grafana:8.2.2
container_name: grafana
ports:
- 3000:3000
environment:
- GF_INSTALL_PLUGINS=grafana-piechart-panel
volumes:
- grafana_data:/var/lib/grafana
volumes:
grafana_data:
and the Prometheus.yaml file :
global:
scrape_interval: 15s
evaluation_interval: 15s
external_labels:
monitor: 'codelab-monitor'
rule_files:
scrape_configs:
- job_name: 'prometheus'
scrape_interval: 5s
static_configs:
- targets: ['localhost:9090']
- job_name: 'spring-boot-app'
scrape_interval: 5s
metrics_path: '/prometheus'
static_configs:
- targets: ['localhost:8080']
Am I missing something ?
docker inspect network of Prometheus and Grafana network
docker inspect prometheus-grafana_default
[
{
"Name": "prometheus-grafana_default",
"Id": "b3396f20e2d469f2b58cae086c744d7dd2fa762739e78d184da210ce39d4f76b",
"Created": "2023-05-05T11:48:40.775115395Z",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.18.0.0/16",
"Gateway": "172.18.0.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {
"b997dabca9a209a74e604439a579635a1a396469077bcb6c77c5c155a8658115": {
"Name": "prometheus-grafana-prometheus-1",
"EndpointID": "a01a7c0001aa8159a1844d7bf63788f774480fbf19318e29ae349f97ff36564e",
"MacAddress": "02:42:ac:12:00:02",
"IPv4Address": "172.18.0.2/16",
"IPv6Address": ""
},
"dc68bc1b86be8e3b4b97553f0e44b7984914dc41d81f1bed667a33a9faca8d40": {
"Name": "prometheus-grafana-grafana-1",
"EndpointID": "e56f01bb9b2c66fbdc6b4c51cccb26c99b7c6b1fd60f785d8808178de5655322",
"MacAddress": "02:42:ac:12:00:03",
"IPv4Address": "172.18.0.3/16",
"IPv6Address": ""
}
},
"Options": {},
"Labels": {
"com.docker.compose.network": "default",
"com.docker.compose.project": "prometheus-grafana",
"com.docker.compose.version": "2.10.2"
}
}
]