Last active
August 29, 2015 14:25
-
-
Save prologic/f28a4ab3fbb492efdaa8 to your computer and use it in GitHub Desktop.
autodock based Docker Compose for Sensu monitoring
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"checks": { | |
"load_docker_metrics": { | |
"type": "metric", | |
"command": "load-docker-metrics.sh", | |
"subscribers": [ | |
"docker" | |
], | |
"interval": 10 | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
autodock: | |
image: prologic/autodock | |
ports: | |
- "1338:1338/udp" | |
- "1338:1338/tcp" | |
volumes: | |
- /var/run/docker.sock:/var/run/docker.sock | |
restart: always | |
autodockhipache: | |
image: prologic/autodock-hipache | |
links: | |
- autodock | |
- hipache:redis | |
restart: always | |
sensu: | |
image: hiroakis/docker-sensu-server | |
ports: | |
- "3000:3000" | |
- "4567:4567" | |
- "5671:5671" | |
- "15672:15672" | |
volumes: | |
- /home/prologic/etc/sensu/check-docker.json:/etc/sensu/conf.d/check-docker.json | |
environment: | |
- PORT=3000 | |
- VIRTUALHOST=sensu.vz1.bne.shortcircuit.net.au | |
restart: always | |
sensuclient: | |
image: prologic/docker-sensu-client | |
privileged: true | |
volumes: | |
- /home/prologic/etc/sensu/plugins/load-docker-metrics.sh:/etc/sensu/plugins/load-docker-metrics.sh | |
- /var/run/docker.sock:/var/run/docker.sock | |
environment: | |
- HOSTNAME=daisy | |
command: 10.0.0.2 sensu password daisy 10.0.0.2 | |
restart: always | |
hipache: | |
image: hipache:0.2.8 | |
ports: | |
- "80:80" | |
- "443:443" | |
restart: always |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
# Count all running containers | |
running_containers=$(echo -e "GET /containers/json HTTP/1.0\r\n" | nc -U /var/run/docker.sock \ | |
| tail -n +5 \ | |
| python -m json.tool \ | |
| grep \"Id\" \ | |
| wc -l) | |
# Count all containers | |
total_containers=$(echo -e "GET /containers/json?all=1 HTTP/1.0\r\n" | nc -U /var/run/docker.sock \ | |
| tail -n +5 \ | |
| python -m json.tool \ | |
| grep \"Id\" \ | |
| wc -l) | |
# Count all images | |
total_images=$(echo -e "GET /images/json HTTP/1.0\r\n" | nc -U /var/run/docker.sock \ | |
| tail -n +5 \ | |
| python -m json.tool \ | |
| grep \"Id\" \ | |
| wc -l) | |
HOSTNAME=${HOSTNAME:-$(hostname)} | |
echo "docker.${HOSTNAME}.running_containers ${running_containers}" | |
echo "docker.${HOSTNAME}.total_containers ${total_containers}" | |
echo "docker.${HOSTNAME}.total_images ${total_images}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Based on what I learned from: http://rancher.com/comparing-monitoring-options-for-docker-deployments/