Docker/System Stats
From charlesreid1
Contents
netdata docker
charlesreid1 git repo: (TBA)
Standalone netdata docker container: https://hub.docker.com/r/firehol/netdata/~/dockerfile/
(Note: this is the standard netdata repo https://github.com/firehol/netdata but the Dockerfile is conveniently embedded in there so it's picked up as a docker container)
The netdata container is am arm image, lightweight at 60 mb, and uses /host to connect to the host.
Not sure about the run script or the connection between the host and the container.
graphite docker
charlesreid1 git repo: https://git.charlesreid1.com/docker/d-graphite
graphite container comes from graphiteapp docker image: https://hub.docker.com/r/graphiteapp/graphite-statsd/
Note that currently, the installed netstat instance (currently, an aptitude-installed instance of netdata) steps on the toes of this graphite container because port 8125 is open on the host machine.
To fix: slight modification of the port mappings in the docker run
call.
Link: https://hub.docker.com/r/graphiteapp/graphite-statsd/
original Docker run call:
docker run -d\ --name graphite\ --restart=always\ -p 80:80\ -p 2003-2004:2003-2004\ -p 2023-2024:2023-2024\ -p 8125:8125/udp\ -p 8126:8126\ graphiteapp/graphite-statsd
Now, remap 8125 in the graphite container to 8124 on the host:
docker run -d\ --name graphite\ --restart=always\ -p 80:80\ -p 2003-2004:2003-2004\ -p 2023-2024:2023-2024\ -p 8124:8125/udp\ -p 8126:8126\ graphiteapp/graphite-statsd
One of the things mentioned on the docker hub page that is not explained is "mounted volumes", with a few directories listed. [1]
This comes from the Dockerfile that this is based on, which is hopsoft's graphite dockerfile: https://github.com/hopsoft/docker-graphite-statsd/blob/master/Dockerfile
Looking in the Dockerfile we see this line:
VOLUME ["/opt/graphite/conf", "/opt/graphite/storage", "/etc/nginx", "/opt/statsd", "/etc/logrotate.d", "/var/log"]
This simply indicates that we are now able to mount these volumes to the host container using the -v flag. However, we need to decide where and how to mount these volumes, and set the appropriate locations in the docker run command.
docker run \ ... lots of other parameters and flags ... \ -v /path/on/host:/path/in/container
where the path in the container would be one of the directories in the VOLUME list.
Also, this nice pain-in-the-ass task: the image we stupidly decided to pull does not do anything as far as configuration files.
Copy all the goddamn config files from the conf dir of this repo into the host directories being mapped into the container: https://github.com/hopsoft/docker-graphite-statsd
mongo docker
mongodb docker
charlesreid1 git repo: https://git.charlesreid1.com/docker/d-mongodb
mongodb is a nosql database and it runs on port 27017. The volume is run using the -v flag to create a mapping from the database's data directory to a folder on the host so that the data is persistent after the container goes away.
we have successfully set up a mongodb docker container to use a persistent data directory in /opt/mongodb
and to start up on boot.
The final docker run command is here: https://git.charlesreid1.com/docker/d-mongodb/src/master/run_mongodb.sh
mongo express docker
charlesreid1 git repo: https://git.charlesreid1.com/docker/d-mongoexpress
mongo express is the web interface to mongodb, and runs on port 8081. this container is linked to the mongodb container and communicates with it via port 27017.
The final docker run command is here: https://git.charlesreid1.com/docker/d-mongoexpress/src/master/run_stock.sh
run mongo docker containers on boot
To run the mongo docker containers at boot, I created run scripts containing the docker run commands (with all flags setting up port mappings, etc.)
This script does the following:
- List all docker processes and pass each one to docker rm to remove any old versions of the containers
- Sleep to let the removal finish
- Start the mongodb container
- Sleep to let mongodb start up
- Start the mongoexpress container
Many Bothans died to bring us these steps.
#!/bin/bash # # Start MongoDB container # and MongoExpress container. # # This script should be made executable # and called in /etc/rc.local # by the desired user: # # su charles -c '/path/to/script' # remove crusty processes docker ps -qa | xargs -I% docker rm -f % sleep 5; # run mongodb /home/charles/codes/docker/d-mongodb/run_mongodb.sh sleep 5; # run mongo express /home/charles/codes/docker/d-mongoexpress/run_stock.sh
Next, add this script to the /etc/rc.local
file to run it at boot:
su charles -c '/path/to/above/script.sh
flags
Dashboards and Monitoring tools for creating dashboards and monitoring applications
MongoDB: MongoDB · Category:MongoDB Graphite: Graphite · Category:Graphite Prometheus: Prometheus · Category:Prometheus
Netdata: Netdata · Netdata/Prometheus · Netdata/Security · Category:Netdata Collectd: Collectd · Collectd/Mongo · Category:Collectd
Standalone: Grafana · Carbon/Graphite Javascript: D3 Python: Bokeh
|
docker notes on the virtual microservice container platform
Installing the docker platform: Docker/Installing Docker Hello World: Docker/Hello World
Creating Docker Containers: Getting docker containers from docker hub: Docker/Dockerhub Creating docker containers with dockerfiles: Docker/Dockerfiles Managing Dockerfiles using git: Docker/Dockerfiles/Git Setting up Python virtualenv in container: Docker/Virtualenv
Running docker containers: Docker/Basics Dealing with volumes in Docker images: Docker/Volumes Removing Docker images: Docker/Removing Images Rsync Docker Container: Docker/Rsync
Networking with Docker Containers:
|
docker pods pods are groups of docker containers that travel together
Docker pods are collections of Docker containers that are intended to run in concert for various applications.
Wireless Sensor Data Acquisition Pod The wireless sensor data acquisition pod deploys containers This pod uses the following technologies: Stunnel · Rsync · Apache · MongoDB · Python · Jupyter (numerical Python stack)
Deep Learning Pod This pod utilizes the following technologies: Python · Sklearn · Jupyter (numerical Python stack) · Keras · TensorFlow
|