Skip to content
This repository has been archived by the owner on Aug 31, 2020. It is now read-only.

Commit

Permalink
added some information to the README and added Swarm placement constr…
Browse files Browse the repository at this point in the history
…aints to the compose file
  • Loading branch information
nustiueudinastea committed Mar 30, 2017
1 parent f07f30a commit b44a842
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
# prometheus-swarm-discovery
# Prometheus-Swarm service discovery

This is POC that demonstrates Prometheus service discovery in Docker Swarm. It is implemented as a standalone tool
that writes the scrape targets to a file, that is then read by Prometheus. This uses the `<file_sd_config>` config
directive available in Prometheus.

The discovery tool expects to have access to the Swarm API using `/var/run/docker.sock`. The provided `docker-compose.yaml`
is configured to mount the `docker.sock` file inside the container, and this requires that the `swarm-discover` container
is placed on the Swarm manager node.

## Run Prometheus and the Swarm discovery tool

The only thing required to run Prometheus and the discovery tool is to launch a Swarm stack using the provided docker-compose.yaml
file.

```
$ docker stack deploy -c docker-compose.yaml prometheus
```
10 changes: 8 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,20 @@ services:
- swarm-endpoints:/swarm-endpoints/
labels:
prometheus.ignore: "true"
placement:
constraints:
- node.role == manager
prometheus:
image: prom/prometheus:v1.5.2
ports:
- '9090:9090'
volumes:
- ./prometheus-configs/:/etc/prometheus
- swarm-endpoints:/etc/swarm-endpoints/
command: ["-storage.local.retention=48h", "-storage.local.memory-chunks=1048576", "-config.file=/etc/prometheus/prometheus.yaml"]
command: ["-storage.local.retention=2h", "-storage.local.memory-chunks=1048576", "-config.file=/etc/prometheus/prometheus.yaml"]
placement:
constraints:
- node.role == manager

volumes:
swarm-endpoints:
swarm-endpoints:

0 comments on commit b44a842

Please sign in to comment.