Ident samples

This commit is contained in:
nemunaire 2018-10-14 22:58:19 +02:00
parent 6184c0bf3d
commit 02db9cc19c
47 changed files with 2658 additions and 213 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View file

@ -0,0 +1,57 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Docker layers</title>
<style>
body { background: white; text-align: center; }
table { width: 100%; }
</style>
</head>
<body>
<h1>Difference image/container</h1>
<table>
<tr>
<td>
<img src="image-layers.jpg" alt="Image layers">
</td>
<td>
<img src="container-layers.jpg" alt="Container layers">
</td>
</tr>
</table>
<hr>
<h1>Block Device <em>Union</em></h1>
<table>
<tr>
<td>
<img src="base_device.jpg" alt="Base device">
</td>
<td>
<img src="two_dm_container.jpg" alt="Base device">
</td>
</tr>
</table>
<hr>
<h1>Filesystem UnionFS</h1>
<table>
<tr>
<td>
<figure>
<img src="aufs_layers.jpg" alt="AUFS layers">
<figcaption>AUFS</figcaption>
</figure>
</td>
<td>
<figure>
<img src="overlay_constructs.jpg" alt="AUFS layers">
<figcaption>OverlayFS</figcaption>
</figure>
</td>
</tr>
</table>
<br>
<p style="text-align: left">
Images from <a href="https://docs.docker.com/">docs.docker.com</a>.
</p>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

View file

@ -0,0 +1,15 @@
FROM debian
ENV CHRONOGRAF_VERSION 1.0.0
RUN apt-get update && apt-get install -y wget && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
wget -q https://dl.influxdata.com/chronograf/releases/chronograf_${CHRONOGRAF_VERSION}_amd64.deb && \
dpkg -i chronograf_${CHRONOGRAF_VERSION}_amd64.deb && \
rm -f chronograf_${CHRONOGRAF_VERSION}_amd64.deb
COPY chronograf.conf /etc/chronograf/chronograf.conf
EXPOSE 10000
VOLUME /var/lib/chronograf
CMD ["/opt/chronograf/chronograf"]

View file

@ -0,0 +1,2 @@
Bind="0.0.0.0:10000"
LocalDatabase="/var/lib/chronograf/chronograf.db"

View file

@ -0,0 +1,31 @@
version: '2'
services:
influxdb:
build: influxdb
ports:
- "8083:8083"
- "8086:8086"
volumes:
- influx-data:/var/lib/influxdb
networks:
- influx
chronograf:
build: chronograf
ports:
- "10000:10000"
volumes:
- chronograf-data:/var/lib/chronograf
networks:
- influx
volumes:
influx-data:
driver: local
chronograf-data:
driver: local
networks:
influx:
driver: bridge

View file

@ -0,0 +1,98 @@
version: '3'
services:
# FRONT
chronograf:
# Full tag list: https://hub.docker.com/r/library/chronograf/tags/
image: chronograf
deploy:
replicas: 3
placement:
constraints:
- node.role == manager
restart_policy:
condition: on-failure
environment:
INFLUXDB_URL: http://influxdb:8086
KAPACITOR_URL: http://kapacitor:9092
volumes:
# Mount for chronograf database
- chronograf-data:/var/lib/chronograf
ports:
# The WebUI for Chronograf is served on port 8888
- "8888:8888"
networks:
- influx
depends_on:
- kapacitor
- influxdb
# MIDDLE
kapacitor:
# Full tag list: https://hub.docker.com/r/library/kapacitor/tags/
image: kapacitor
deploy:
replicas: 1
placement:
constraints:
- node.role == manager
restart_policy:
condition: on-failure
environment:
HOSTNAME: kapacitor
KAPACITOR_INFLUXDB_0_URLS_0: http://influxdb:8086
volumes:
# Mount for kapacitor data directory
- kapacitor-data:/var/lib/kapacitor
# Mount for kapacitor configuration
#- /etc/kapacitor/config:/etc/kapacitor
ports:
# The API for Kapacitor is served on port 9092
- "9092:9092"
networks:
- influx
depends_on:
- influxdb
# BACK
telegraf:
# Full tag list: https://hub.docker.com/r/library/telegraf/tags/
image: telegraf
deploy:
mode: global
restart_policy:
condition: on-failure
volumes:
# Mount for telegraf configuration
- ./telegraf.conf:/etc/telegraf/telegraf.conf
# Mount for Docker API access
- /var/run/docker.sock:/var/run/docker.sock
networks:
- influx
depends_on:
- influxdb
# DATABASE
influxdb:
# Full tag list: https://hub.docker.com/r/library/influxdb/tags/
image: influxdb
deploy:
replicas: 1
placement:
constraints:
- node.role == manager
restart_policy:
condition: on-failure
volumes:
# Mount for influxdb data directory
- influxdb-data:/var/lib/influxdb
# Mount for influxdb configuration
#- /etc/influxdb/config:/etc/influxdb
ports:
# The API for InfluxDB is served on port 8086
- "8086:8086"
networks:
- influx
networks:
influx:
volumes:
chronograf-data:
kapacitor-data:
influxdb-data:

View file

@ -0,0 +1,35 @@
version: '3'
services:
influxdb:
image: influxdb
ports:
- "8083:8083"
- "8086:8086"
volumes:
- influx-data:/var/lib/influxdb
networks:
- influx
chronograf:
image: chronograf
ports:
- "8888:8888"
environment:
INFLUXDB_URL: http://influxdb:8086
KAPACITOR_URL: http://kapacitor:9092
volumes:
- chronograf-data:/var/lib/chronograf
networks:
- influx
depends_on:
- influxdb
volumes:
influx-data:
driver: local
chronograf-data:
driver: local
networks:
influx:

View file

@ -0,0 +1,15 @@
FROM debian
ENV INFLUXDB_VERSION 1.0.0
RUN apt-get update && apt-get install -y wget && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
wget -q https://dl.influxdata.com/influxdb/releases/influxdb_${INFLUXDB_VERSION}_amd64.deb && \
dpkg -i influxdb_${INFLUXDB_VERSION}_amd64.deb && \
rm -f influxdb_${INFLUXDB_VERSION}_amd64.deb
COPY influxdb.conf /etc/influxdb/influxdb.conf
EXPOSE 8083 8086
VOLUME /var/lib/influxdb
CMD ["influxd"]

View file

@ -0,0 +1,10 @@
[meta]
dir = "/var/lib/influxdb/meta"
[data]
dir = "/var/lib/influxdb/data"
engine = "tsm1"
wal-dir = "/var/lib/influxdb/wal"
[admin]
enabled = true

View file

@ -0,0 +1,22 @@
FROM debian
ENV INFLUXDB_VERSION 1.0.0
ENV CHRONOGRAF_VERSION 1.0.0
RUN apt-get update && apt-get install -y wget supervisor && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
wget -q https://dl.influxdata.com/influxdb/releases/influxdb_${INFLUXDB_VERSION}_amd64.deb && \
wget -q https://dl.influxdata.com/chronograf/releases/chronograf_${CHRONOGRAF_VERSION}_amd64.deb && \
dpkg -i influxdb_${INFLUXDB_VERSION}_amd64.deb chronograf_${CHRONOGRAF_VERSION}_amd64.deb && \
rm -f influxdb_${INFLUXDB_VERSION}_amd64.deb chronograf_${CHRONOGRAF_VERSION}_amd64.deb
EXPOSE 8083 8086 10000
VOLUME /var/lib/influxdb
VOLUME /var/lib/chronograf
COPY influxdb.conf /etc/influxdb/influxdb.conf
COPY chronograf.conf /etc/chronograf/chronograf.conf
COPY supervisor.conf /etc/supervisor/conf.d/supervisord.conf
CMD ["/usr/bin/supervisord"]

View file

@ -0,0 +1,2 @@
Bind="0.0.0.0:10000"
LocalDatabase="/var/lib/chronograf/chronograf.db"

View file

@ -0,0 +1,10 @@
[meta]
dir = "/var/lib/influxdb/meta"
[data]
dir = "/var/lib/influxdb/data"
engine = "tsm1"
wal-dir = "/var/lib/influxdb/wal"
[admin]
enabled = true

View file

@ -0,0 +1,8 @@
[supervisord]
nodaemon=true
[program:influxdb]
command=/usr/bin/influxd
[program:chronograf]
command=/opt/chronograf/chronograf

View file

@ -0,0 +1,23 @@
FROM debian
ENV INFLUXDB_VERSION 1.0.0
ENV CHRONOGRAF_VERSION 1.0.0
RUN apt-get update && apt-get install -y wget && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
wget -q https://dl.influxdata.com/influxdb/releases/influxdb_${INFLUXDB_VERSION}_amd64.deb && \
wget -q https://dl.influxdata.com/chronograf/releases/chronograf_${CHRONOGRAF_VERSION}_amd64.deb && \
dpkg -i influxdb_${INFLUXDB_VERSION}_amd64.deb chronograf_${CHRONOGRAF_VERSION}_amd64.deb && \
rm -f influxdb_${INFLUXDB_VERSION}_amd64.deb chronograf_${CHRONOGRAF_VERSION}_amd64.deb
EXPOSE 8083 8086 10000
VOLUME /var/lib/influxdb
VOLUME /var/lib/chronograf
COPY influxdb.conf /etc/influxdb/influxdb.conf
COPY chronograf.conf /etc/chronograf/chronograf.conf
# start.sh should already be executable
COPY start.sh /usr/bin/start.sh
CMD ["start.sh"]

View file

@ -0,0 +1,2 @@
Bind="0.0.0.0:10000"
LocalDatabase="/var/lib/chronograf/chronograf.db"

View file

@ -0,0 +1,10 @@
[meta]
dir = "/var/lib/influxdb/meta"
[data]
dir = "/var/lib/influxdb/data"
engine = "tsm1"
wal-dir = "/var/lib/influxdb/wal"
[admin]
enabled = true

View file

@ -0,0 +1,9 @@
#!/bin/sh
influxd &
WAIT=$!
/opt/chronograf/chronograf &
WAIT="${WAIT} $!"
wait ${WAIT}

View file

@ -0,0 +1,24 @@
version: '2'
services:
nginx:
image: nginx
ports:
- "80:8080"
networks:
- ha
mysql:
image: mysql
volumes:
- mysql-data:/var/lib/mysql
networks:
- ha
volumes:
mysql-data:
driver: local
networks:
ha:
driver: bridge

View file

@ -0,0 +1,3 @@
[[outputs.influxdb]]
urls = ["http://influxdb:8086"] # required
database = "telegraf" # required

View file

@ -0,0 +1,11 @@
/var/log/telegraf/telegraf.log
{
rotate 6
daily
missingok
dateext
copytruncate
notifempty
compress
}

File diff suppressed because it is too large Load diff

Binary file not shown.

View file

@ -0,0 +1,208 @@
#! /usr/bin/env bash
# chkconfig: 2345 99 01
# description: Telegraf daemon
### BEGIN INIT INFO
# Provides: telegraf
# Required-Start: $all
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start telegraf at boot time
### END INIT INFO
# this init script supports three different variations:
# 1. New lsb that define start-stop-daemon
# 2. Old lsb that don't have start-stop-daemon but define, log, pidofproc and killproc
# 3. Centos installations without lsb-core installed
#
# In the third case we have to define our own functions which are very dumb
# and expect the args to be positioned correctly.
# Command-line options that can be set in /etc/default/telegraf. These will override
# any config file values.
TELEGRAF_OPTS=
USER=telegraf
GROUP=telegraf
if [ -r /lib/lsb/init-functions ]; then
source /lib/lsb/init-functions
fi
DEFAULT=/etc/default/telegraf
if [ -r $DEFAULT ]; then
source $DEFAULT
fi
if [ -z "$STDOUT" ]; then
STDOUT=/dev/null
fi
if [ ! -f "$STDOUT" ]; then
mkdir -p `dirname $STDOUT`
fi
if [ -z "$STDERR" ]; then
STDERR=/var/log/telegraf/telegraf.log
fi
if [ ! -f "$STDERR" ]; then
mkdir -p `dirname $STDERR`
fi
OPEN_FILE_LIMIT=65536
function pidofproc() {
if [ $# -ne 3 ]; then
echo "Expected three arguments, e.g. $0 -p pidfile daemon-name"
fi
if [ ! -f "$2" ]; then
return 1
fi
local pidfile=`cat $2`
if [ "x$pidfile" == "x" ]; then
return 1
fi
if ps --pid "$pidfile" | grep -q $(basename $3); then
return 0
fi
return 1
}
function killproc() {
if [ $# -ne 3 ]; then
echo "Expected three arguments, e.g. $0 -p pidfile signal"
fi
pid=`cat $2`
kill -s $3 $pid
}
function log_failure_msg() {
echo "$@" "[ FAILED ]"
}
function log_success_msg() {
echo "$@" "[ OK ]"
}
# Process name ( For display )
name=telegraf
# Daemon name, where is the actual executable
daemon=/usr/bin/telegraf
# pid file for the daemon
pidfile=/var/run/telegraf/telegraf.pid
piddir=`dirname $pidfile`
if [ ! -d "$piddir" ]; then
mkdir -p $piddir
chown $USER:$GROUP $piddir
fi
# Configuration file
config=/etc/telegraf/telegraf.conf
confdir=/etc/telegraf/telegraf.d
# If the daemon is not there, then exit.
[ -x $daemon ] || exit 5
case $1 in
start)
# Checked the PID file exists and check the actual status of process
if [ -e $pidfile ]; then
pidofproc -p $pidfile $daemon > /dev/null 2>&1 && status="0" || status="$?"
# If the status is SUCCESS then don't need to start again.
if [ "x$status" = "x0" ]; then
log_failure_msg "$name process is running"
exit 0 # Exit
fi
fi
# Bump the file limits, before launching the daemon. These will carry over to
# launched processes.
ulimit -n $OPEN_FILE_LIMIT
if [ $? -ne 0 ]; then
log_failure_msg "set open file limit to $OPEN_FILE_LIMIT"
fi
log_success_msg "Starting the process" "$name"
if which start-stop-daemon > /dev/null 2>&1; then
start-stop-daemon --chuid $USER:$GROUP --start --quiet --pidfile $pidfile --exec $daemon -- -pidfile $pidfile -config $config -config-directory $confdir $TELEGRAF_OPTS >>$STDOUT 2>>$STDERR &
else
su -s /bin/sh -c "nohup $daemon -pidfile $pidfile -config $config -config-directory $confdir $TELEGRAF_OPTS >>$STDOUT 2>>$STDERR &" $USER
fi
log_success_msg "$name process was started"
;;
stop)
# Stop the daemon.
if [ -e $pidfile ]; then
pidofproc -p $pidfile $daemon > /dev/null 2>&1 && status="0" || status="$?"
if [ "$status" = 0 ]; then
if killproc -p $pidfile SIGTERM && /bin/rm -rf $pidfile; then
log_success_msg "$name process was stopped"
else
log_failure_msg "$name failed to stop service"
fi
fi
else
log_failure_msg "$name process is not running"
fi
;;
reload)
# Reload the daemon.
if [ -e $pidfile ]; then
pidofproc -p $pidfile $daemon > /dev/null 2>&1 && status="0" || status="$?"
if [ "$status" = 0 ]; then
if killproc -p $pidfile SIGHUP; then
log_success_msg "$name process was reloaded"
else
log_failure_msg "$name failed to reload service"
fi
fi
else
log_failure_msg "$name process is not running"
fi
;;
restart)
# Restart the daemon.
$0 stop && sleep 2 && $0 start
;;
status)
# Check the status of the process.
if [ -e $pidfile ]; then
if pidofproc -p $pidfile $daemon > /dev/null; then
log_success_msg "$name Process is running"
exit 0
else
log_failure_msg "$name Process is not running"
exit 1
fi
else
log_failure_msg "$name Process is not running"
exit 3
fi
;;
version)
$daemon version
;;
*)
# For invalid arguments, print the usage message.
echo "Usage: $0 {start|stop|restart|status|version}"
exit 2
;;
esac

View file

@ -0,0 +1,17 @@
[Unit]
Description=The plugin-driven server agent for reporting metrics into InfluxDB
Documentation=https://github.com/influxdata/telegraf
After=network.target
[Service]
EnvironmentFile=-/etc/default/telegraf
User=telegraf
Environment='STDOUT=/var/log/telegraf/telegraf.log'
Environment='STDERR=/var/log/telegraf/telegraf.log'
ExecStart=/bin/sh -c "exec /usr/bin/telegraf -config /etc/telegraf/telegraf.conf -config-directory /etc/telegraf/telegraf.d ${TELEGRAF_OPTS} >>${STDOUT} 2>>${STDERR}"
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
KillMode=control-group
[Install]
WantedBy=multi-user.target

View file

@ -25,15 +25,15 @@ cela dépendra de votre avancée dans le projet) :
<div lang="en-US"> <div lang="en-US">
``` ```
login_x-TP2/influxdb/Dockerfile login_x-TP1_5/influxdb/Dockerfile
login_x-TP2/influxdb/influxdb.conf login_x-TP1_5/influxdb/influxdb.conf
login_x-TP2/chronograf login_x-TP1_5/chronograf
login_x-TP2/chronograf/Dockerfile login_x-TP1_5/chronograf/Dockerfile
login_x-TP2/chronograf/chronograf.conf login_x-TP1_5/chronograf/chronograf.conf
login_x-TP2/mymonitoring login_x-TP1_5/mymonitoring
login_x-TP2/mymonitoring/Dockerfile login_x-TP1_5/mymonitoring/Dockerfile
login_x-TP2/mymonitoring/chronograf.conf login_x-TP1_5/mymonitoring/chronograf.conf
login_x-TP2/mymonitoring/influxdb.conf login_x-TP1_5/mymonitoring/influxdb.conf
login_x-TP2/mymonitoring/supervisor.conf login_x-TP1_5/mymonitoring/supervisor.conf
``` ```
</div> </div>

View file

@ -83,9 +83,6 @@ cela. Mais plein de gens ont cette problématique et l'application `supervisor`
répond parfaitement à notre problématique ! répond parfaitement à notre problématique !
## `HEALTHCHECK`
## `supervisor` ## `supervisor`
Première étape : installer `supervisor`, le paquet se trouve dans les dépôts. Première étape : installer `supervisor`, le paquet se trouve dans les dépôts.