I just started exploring Prometheus and would be glad if someone could help me with thr issue I am facing right now.
I am trying the docker image.
This is my docker-compose file.
prometheus:
image: prom/prometheus
container_name: prom
expose:
- 9090
ports:
- "9090:9090"
volumes:
- ~/prometheus.yml:/etc/prometheus/prometheus.yml
- /home/eit/prometheus:/etc/prometheus
command:
- '-config.file=/etc/prometheus/prometheus.yml'
restart: always
This is my prometheus.yml file:
global:
scrape_interval: 15s # By default, scrape targets every 15 seconds.
# Attach these labels to any time series or alerts when communicating with
# external systems (federation, remote storage, Alertmanager).
external_labels:
monitor: 'codelab-monitor'
# A scrape configuration scraping a Node Exporter and the Prometheus server
# # itself.
scrape_configs:
- job_name: 'example-random'
# Override the global default and scrape targets from this job every 5 seconds.
scrape_interval: 5s
static_configs:
- targets: ['localhost:8080', 'localhost:8081']
labels:
group: 'production'
- targets: ['localhost:8082']
labels:
group: 'canary'
Now, I am trying the Getting Started tutorial described here. https://prometheus.io/docs/introduction/getting_started/
I am able to get results before the "Starting up some sample targets" but after that when I configure everything as per the wiki, I am not getting results and from the UI I get the "Get http://localhost:8080/metrics: dial tcp [::1]:8080: getsockopt: connection refused".
Also, when I try the IP of the host machine instead of Localhost in the above config it gives me "Context Deadline Exceeded".
Please tell me where I am going wrong.
Regards
RK