Docker Cookbook


| Chapter 9: Monitoring Containers



Download 6,31 Mb.
Pdf ko'rish
bet227/260
Sana21.04.2022
Hajmi6,31 Mb.
#570749
1   ...   223   224   225   226   227   228   229   230   ...   260
Bog'liq
Docker Cookbook

288 | Chapter 9: Monitoring Containers


The other host runs four containers as well: a Logstash container to collect the logs
coming from Logspout, an Elasticsearch container to store the logs, a Kibana con‐
tainer to visualize those logs, and a Graphite container. The Graphite container also
runs 
carbon
to store the metrics.
Figure 9-2
illustrates this two-host, eight-container setup.
Figure 9-2. Two-host, Collectd, Logstash, Kibana, Graphite setup
On the first host (the worker), you can start all the containers with Docker Compose
(see 
Recipe 7.1
) using a YAML file like this one:
nginx:
image: nginx
ports:
- 80:80
logspout:
image: gliderlabs/logspout
volumes:
- /var/run/docker.sock:/tmp/docker.sock
command: syslog://192.168.33.11:5000
collectd:
build: .
volumes:
- /var/run/docker.sock:/var/run/docker.sock
load:
image: borja/unixbench
The Logspout container uses a command that specifies your Logstash endpoint.
Change the IP if you are running in a different networking environment. The Col‐
lectd container is built by Docker Compose and based on the following Dockerfile:
9.9 Using Collectd to Visualize Container Metrics | 289


FROM debian:jessie
RUN apt-get update && apt-get -y install \
collectd \
python \
python-pip
RUN apt-get clean
RUN pip install docker-py
RUN groupadd -r docker && useradd -r -g docker docker
ADD docker-stats.py /opt/collectd/bin/docker-stats.py
ADD docker-report.py /opt/collectd/bin/docker-report.py
ADD collectd.conf /etc/collectd/collectd.conf
RUN chown -R docker /opt/collectd/bin
CMD ["/usr/sbin/collectd","-f"]
In the discussion section of this recipe, you will go over the scripts used in this Dock‐
erfile.
On the second host (the monitor), you can start all containers with Docker Compose
(see 
Recipe 7.1
) using a YAML file like this one:
es:
image: ehazlett/elasticsearch
ports:
- 9300:9300
- 9200:9200
kibana:
image: ehazlett/kibana
ports:
- 8080:80
graphite:
image: hopsoft/graphite-statsd
ports:
- 80:80
- 2003:2003
- 8125:8125/udp
logstash:
image: ehazlett/logstash
ports:
- 5000:5000
- 5000:5000/udp
volumes:
- /root/docbook/ch09/collectd/logstash.conf:/etc/logstash.conf
links:
- es:elasticsearch
command: -f /etc/logstash.conf

Download 6,31 Mb.

Do'stlaringiz bilan baham:
1   ...   223   224   225   226   227   228   229   230   ...   260




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish