Skip to content

Commit

Permalink
prevent port binding for prometheus & node_exporter
Browse files Browse the repository at this point in the history
  • Loading branch information
Sepovsky committed May 4, 2022
1 parent 1974cd4 commit 727b8d8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@



monitoring server with node exporter, prometheus and grafana in 'prometheus.yml' you should replace machine's ip with "IP"
monitoring server with node exporter, prometheus and grafana.
## command
`docker-compose up -d`
19 changes: 15 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,33 @@ services:
container_name: node_exporter
command:
- '--path.rootfs=/host'
network_mode: host
pid: host
restart: unless-stopped
volumes:
- '/:/host:ro,rslave'
expose:
- 9100
networks:
- monitoring

prometheus:
image: prom/prometheus
container_name: prometheus
ports:
- 9090:9090
volumes:
- './prometheus.yml:/etc/prometheus/prometheus.yml'
expose:
- 9090
networks:
- monitoring

grafana:
image: grafana/grafana
container_name: grafana
ports:
- 3000:3000
- 3000:3000
networks:
- monitoring

networks:
monitoring:
driver: bridge
4 changes: 2 additions & 2 deletions prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ global:
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['IP:9090'] ## IP Address of the Machine
- targets: ['prometheus:9090']
- job_name: 'node-exporter'
static_configs:
- targets: ['IP:9100'] ## IP Address of the Machine
- targets: ['node_exporter:9100']

0 comments on commit 727b8d8

Please sign in to comment.