Last active
October 14, 2021 13:07
-
-
Save knabben/6481f0a1720539703b0a to your computer and use it in GitHub Desktop.
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
#cloud-config | |
--- | |
coreos: | |
fleet: | |
public-ip: "$public_ipv4" | |
units: | |
- name: flanneld.service | |
drop-ins: | |
- name: 50-network-config.conf | |
content: | | |
[Service] | |
ExecStartPre=/usr/bin/etcdctl set /coreos.com/network/config '{ "Network": "10.1.0.0/16" }' | |
command: start | |
- name: docker-tcp.socket | |
command: start | |
enable: true | |
content: | | |
[Unit] | |
Description=Docker Socket for the API | |
[Socket] | |
ListenStream=2375 | |
Service=docker.service | |
BindIPv6Only=both | |
[Install] | |
WantedBy=sockets.target | |
- name: cadvisor.service | |
runtime: true | |
command: start | |
content: | | |
[Unit] | |
Description=Analyzes resource usage and performance characteristics of running containers. | |
After=docker.service | |
Requires=docker.service | |
[Service] | |
Restart=always | |
ExecStartPre=/usr/bin/docker pull google/cadvisor:latest | |
ExecStartPre=-/bin/bash -c "docker inspect cadvisor >/dev/null 2>&1 && docker rm -f cadvisor || true" | |
ExecStart=/usr/bin/docker run --volume=/var/run:/var/run:rw --volume=/sys:/sys:ro --volume=/var/lib/docker/:/var/lib/docker:ro --volume=/:/rootfs:ro --publish=8080:8080 --name=cadvisor google/cadvisor:latest | |
ExecStop=/usr/bin/docker rm -f cadvisor | |
- name: grafana.service | |
runtime: true | |
command: start | |
content: | | |
[Unit] | |
Description=Grafana | |
After=docker.service | |
Requires=docker.service | |
[Service] | |
Restart=always | |
ExecStartPre=/usr/bin/docker pull grafana/grafana:2.6.0 | |
ExecStart=/usr/bin/docker run --link=prometheus --name=grafana -p 3000:3000 grafana/grafana | |
ExecStop=/usr/bin/docker rm -f grafana | |
- name: prometheus.service | |
runtime: true | |
command: start | |
content: | | |
[Unit] | |
Description=Prometheus | |
After=docker.service | |
Before=grafana.service | |
Requires=docker.service | |
[Service] | |
Restart=always | |
ExecStartPre=/usr/bin/docker pull prom/prometheus | |
ExecStart=/usr/bin/docker run -p 9090:9090 --name prometheus prom/prometheus | |
ExecStop=/usr/bin/docker rm -f prometheus | |
- name: mysql_prom.service | |
runtime: true | |
command: start | |
content: | | |
[Unit] | |
Description=MySQL Prometheus Exporter | |
Before=prometheus.service | |
Requires=docker.service | |
[Service] | |
Restart=always | |
ExecStartPre=/usr/bin/docker pull prom/mysqld-exporter | |
ExecStart=/usr/bin/docker run -p 9104:9104 --name=mysql_prom -e DATA_SOURCE_NAME="root:local@(192.168.2.1:3306)/db1" prom/mysqld-exporter | |
ExecStop=/usr/bin/docker rm -f mysql_prom | |
ssh_authorized_keys: | |
- ssh-rsa mykey | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As you are linking the container, you will have a grafana /etc/hosts entries like:
root@06d871812f6c:/# cat /etc/hosts
172.17.0.3 prometheus c95bd47aee6b
Add on your Grafana datasource: http://prometheus:9090/