Initial Commit

This commit is contained in:
Mateusz Trojak
2016-09-13 06:11:12 -04:00
commit f3199a57a1
16 changed files with 3933 additions and 0 deletions
File diff suppressed because it is too large Load Diff
+18
View File
@@ -0,0 +1,18 @@
FROM grafana/grafana:latest
MAINTAINER Mateusz Trojak <mateusz.trojak@gmail.com>
LABEL version="1.0"
LABEL description="Grafana Image with added system variables"
RUN apt-get -q update &&\
DEBIAN_FRONTEND="noninteractive" apt-get -q upgrade -y -o Dpkg::Options::="--force-confnew" --no-install-recommends &&\
DEBIAN_FRONTEND="noninteractive" apt-get -q install -y -o Dpkg::Options::="--force-confnew" --no-install-recommends curl &&\
apt-get -q autoremove &&\
apt-get -q clean -y && rm -rf /var/lib/apt/lists/* && rm -f /var/cache/apt/*.bin
RUN rm -f /run.sh
ADD run.sh /run.sh
RUN chmod +x /run.sh
RUN mkdir /opt/grafana
ADD ["*.json", "/opt/grafana/"]
CMD ["/run.sh"]
+85
View File
@@ -0,0 +1,85 @@
#!/bin/bash -e
: "${GF_PATHS_DATA:=/var/lib/grafana}"
: "${GF_PATHS_LOGS:=/var/log/grafana}"
: "${GF_PATHS_PLUGINS:=/var/lib/grafana/plugins}"
chown -R grafana:grafana "$GF_PATHS_DATA" "$GF_PATHS_LOGS"
chown -R grafana:grafana /etc/grafana
if [ ! -z ${GF_INSTALL_PLUGINS} ]; then
OLDIFS=$IFS
IFS=','
for plugin in ${GF_INSTALL_PLUGINS}; do
grafana-cli plugins install ${plugin}
done
IFS=$OLDIFS
fi
exec gosu grafana /usr/sbin/grafana-server \
--homepath=/usr/share/grafana \
--config=/etc/grafana/grafana.ini \
cfg:default.paths.data="$GF_PATHS_DATA" \
cfg:default.paths.logs="$GF_PATHS_LOGS" \
cfg:default.paths.plugins="$GF_PATHS_PLUGINS" &
sleep 5
###############################################################
# Creating Default Data Source
# Set new Data Source name
INFLUXDB_DATA_SOURCE="Docker InfluxDB"
INFLUXDB_DATA_SOURCE_WEB=`echo ${INFLUXDB_DATA_SOURCE} | sed 's/ /%20/g'`
# Set information about grafana host
GRAFANA_URL=`hostname -i`
GRAFANA_PORT="3000"
GRAFANA_USER="admin"
GRAFANA_PASSWORD="admin"
# Check $INFLUXDB_DATA_SOURCE status
INFLUXDB_DATA_SOURCE_STATUS=`curl -s -L -i \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-X GET http://${GRAFANA_USER}:${GRAFANA_PASSWORD}@${GRAFANA_URL}:${GRAFANA_PORT}/api/datasources/name/${INFLUXDB_DATA_SOURCE_WEB} | head -1 | awk '{print $2}'`
curl -s -L -i \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-X GET http://${GRAFANA_USER}:${GRAFANA_PASSWORD}@${GRAFANA_URL}:${GRAFANA_PORT}/api/datasources/name/${INFLUXDB_DATA_SOURCE_WEB} >>$GF_PATHS_LOGS/grafana.log 2>>$GF_PATHS_LOGS/grafana.log
echo "http://${GRAFANA_USER}:${GRAFANA_PASSWORD}@${GRAFANA_URL}:${GRAFANA_PORT}/api/datasources/name/${INFLUXDB_DATA_SOURCE_WEB}" >> $GF_PATHS_LOGS/grafana.log
echo "INFLUXDB_DATA_SOURCE_STATUS: "$INFLUXDB_DATA_SOURCE_STATUS >> $GF_PATHS_LOGS/grafana.log
echo "GRAFANA_URL: "$GRAFANA_URL >> $GF_PATHS_LOGS/grafana.log
echo "GRAFANA_PORT: "$GRAFANA_PORT >> $GF_PATHS_LOGS/grafana.log
echo "GRAFANA_USER: "$GRAFANA_USER >> $GF_PATHS_LOGS/grafana.log
echo "GRAFANA_PASSWORD: "$GRAFANA_PASSWORD >> $GF_PATHS_LOGS/grafana.log
# Check if $INFLUXDB_DATA_SOURCE exists
if [ ${INFLUXDB_DATA_SOURCE_STATUS} != 200 ]
then
# If not exists, create one
echo "Data Source: '"${INFLUXDB_DATA_SOURCE}"' not found in Grafana configuration"
echo "Creating Data Source: '"$INFLUXDB_DATA_SOURCE}"'"
curl -L -i \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-X POST -d '{
"name":"'"${INFLUXDB_DATA_SOURCE}"'",
"type":"influxdb",
"url":"http://influxdb:8086",
"access":"proxy",
"basicAuth":false,
"database":"telegraf",
"user":"grafana",
"password":"grafana"}
' \
http://${GRAFANA_USER}:${GRAFANA_PASSWORD}@${GRAFANA_URL}:${GRAFANA_PORT}/api/datasources
else
#Continue if it doesn't exists
echo "Data Source '"${INFLUXDB_DATA_SOURCE}"' already exists."
fi
tail -f $GF_PATHS_LOGS/grafana.log/grafana.log
+12
View File
@@ -0,0 +1,12 @@
FROM influxdb:latest
MAINTAINER Mateusz Trojak <mateusz.trojak@gmail.com>
LABEL version="1.0"
LABEL description="InfluxDB Image with added system variables"
ADD influxdb.template.conf /influxdb.template.conf
ADD run.sh /run.sh
RUN chmod +x /run.sh
CMD ["/run.sh"]
+122
View File
@@ -0,0 +1,122 @@
reporting-disabled = false
bind-address = ":8088"
[meta]
dir = "/var/lib/influxdb/meta"
retention-autocreate = true
logging-enabled = true
[data]
dir = "/var/lib/influxdb/data"
engine = "tsm1"
wal-dir = "/var/lib/influxdb/wal"
wal-logging-enabled = true
query-log-enabled = true
cache-max-memory-size = 524288000
cache-snapshot-memory-size = 26214400
cache-snapshot-write-cold-duration = "1h0m0s"
compact-full-write-cold-duration = "24h0m0s"
max-points-per-block = 0
max-series-per-database = 1000000
trace-logging-enabled = false
[coordinator]
write-timeout = "10s"
max-concurrent-queries = 0
query-timeout = "0"
log-queries-after = "0"
max-select-point = 0
max-select-series = 0
max-select-buckets = 0
[retention]
enabled = true
check-interval = "30m0s"
[shard-precreation]
enabled = true
check-interval = "10m0s"
advance-period = "30m0s"
[admin]
enabled = true
bind-address = ":8083"
https-enabled = false
https-certificate = "/etc/ssl/influxdb.pem"
[monitor]
store-enabled = true
store-database = "_internal"
store-interval = "10s"
[subscriber]
enabled = true
http-timeout = "30s"
[http]
enabled = true
bind-address = ":8086"
auth-enabled = false
log-enabled = true
write-tracing = false
https-enabled = false
https-certificate = "/etc/ssl/influxdb.pem"
https-private-key = ""
max-row-limit = 10000
max-connection-limit = 0
shared-secret = ""
realm = "InfluxDB"
[[graphite]]
enabled = false
bind-address = ":2003"
database = "graphite"
retention-policy = ""
protocol = "tcp"
batch-size = 5000
batch-pending = 10
batch-timeout = "1s"
consistency-level = "one"
separator = "."
udp-read-buffer = 0
[[collectd]]
enabled = false
bind-address = ":25826"
database = "collectd"
retention-policy = ""
batch-size = 5000
batch-pending = 10
batch-timeout = "10s"
read-buffer = 0
typesdb = "/usr/share/collectd/types.db"
[[opentsdb]]
enabled = false
bind-address = ":4242"
database = "opentsdb"
retention-policy = ""
consistency-level = "one"
tls-enabled = false
certificate = "/etc/ssl/influxdb.pem"
batch-size = 1000
batch-pending = 5
batch-timeout = "1s"
log-point-errors = true
[[udp]]
enabled = false
bind-address = ":8089"
database = "udp"
retention-policy = ""
batch-size = 5000
batch-pending = 10
read-buffer = 0
batch-timeout = "1s"
precision = ""
[continuous_queries]
log-enabled = true
enabled = true
run-interval = "1s"
+32
View File
@@ -0,0 +1,32 @@
#!/bin/bash
set -m
CONFIG_TEMPLATE="/influxdb.template.conf"
CONFIG_FILE="/etc/influxdb/influxdb.conf"
INFLUX_HOST="localhost"
INFLUX_API_PORT="8086"
[ "${INLFUX_ADMIN_USER}" = "" ] &&
INLFUX_ADMIN_USER="grafana"
[ "${INFLUX_ADMIN_PASS}" = "" ] &&
INFLUX_ADMIN_PASS="grafana"
[ "${INFLUX_DATABASE}" = "" ] &&
JENKINS_BIN="telegraf"
mv -v $CONFIG_FILE $CONFIG_FILE".orig"
mv -v $CONFIG_TEMPLATE $CONFIG_FILE
exec influxd -config=$CONFIG_FILE 1>>/var/log/influxdb/influxdb.log 2>&1 &
sleep 5
USER_EXISTS=`influx -host=${INFLUX_HOST} -port=${INFLUX_API_PORT} -execute="SHOW USERS" | awk '{print $1}' | grep "${INLFUX_ADMIN_USER}" | wc -l`
if [ -n ${USER_EXISTS} ]
then
influx -host=${INFLUX_HOST} -port=${INFLUX_API_PORT} -execute="CREATE USER ${INLFUX_ADMIN_USER} WITH PASSWORD '${INFLUX_ADMIN_PASS}' WITH ALL PRIVILEGES"
influx -host=${INFLUX_HOST} -port=${INFLUX_API_PORT} -username=${INLFUX_ADMIN_USER} -password="${INFLUX_ADMIN_PASS}" -execute="create database ${INFLUX_DATABASE}"
influx -host=${INFLUX_HOST} -port=${INFLUX_API_PORT} -username=${INLFUX_ADMIN_USER} -password="${INFLUX_ADMIN_PASS}" -execute="grant all PRIVILEGES on ${INFLUX_DATABASE} to ${INLFUX_ADMIN_USER}"
fi
tail -f /var/log/influxdb/influxdb.log
+64
View File
@@ -0,0 +1,64 @@
grafana:
image: grafana-test
ports:
- ${grafana_port}:3000
links:
- influxdb:influxdb
environment:
GF_INSTALL_PLUGINS: abhisant-druid-datasource
GF_SECURITY_ADMIN_USER: admin
GF_SECURITY_ADMIN_PASSWORD: admin
GF_SECURITY_SECRET_KEY: grafana
GF_USERS_ALLOW_SIGN_UP: 'true'
GF_USERS_ALLOW_ORG_CREATE: 'true'
GF_AUTH_ANONYMOUS_ENABLED: 'true'
GF_AUTH_ANONYMOUS_ORG_NAME: grafana
GF_DASHBOARDS_JSON_ENABLED: 'true'
GF_DASHBOARDS_JSON_PATH: /opt/grafana
http_proxy: ${http_proxy}
https_proxy: ${https_proxy}
labels:
io.rancher.sidekicks: grafana-data
volumes_from:
- grafana-data
grafana-data:
image: busybox
tty: true
volumes:
- /var/lib/grafana
- /var/log/grafana
- /var/lib/grafana/plugins
influxdb:
image: influxdb-test
ports:
- ${influx_ui}:8083
- ${influx_db}:8086
environment:
INFLUX_DATABASE: "telegraf"
INLFUX_ADMIN_USER: "grafana"
INFLUX_ADMIN_PASS: "grafana"
volumes_from:
- influxdb-data
influxdb-data:
image: busybox
tty: true
volumes:
- /var/lib/influxdb
telegraf:
image: telegraf-test
links:
- influxdb:influxdb
environment:
HOST_NAME: "telegraf"
INFLUXDB_HOST: "influxdb"
INFLUXDB_PORT: "8086"
DATABASE: "telegraf"
tty: true
volumes:
- /var/run/docker.sock:/var/run/docker.sock
privileged: true
+44
View File
@@ -0,0 +1,44 @@
.catalog:
name: "TIG Stack"
version: "v0.0.1"
description: |
(Experimental) Telegraf, InfluxDB, Grafana
uuid: tig-0
minimum_rancher_version: v0.51.0
questions:
- variable: grafana_port
description: "Port to access Grafana"
label: "Grafana UI Port"
required: true
default: "3012"
type: "int"
- variable: plugins
description: "Coma separated list of Grafana Plugins to be installed plugins."
label: "List of Grafana Plugins plugins"
required: true
default: "abhisant-druid-datasource,alexanderzobnin-zabbix-app,bosun-app,bosun-datasource,crate-datasource,fastweb-openfalcon-datasource,fetzerch-sunandmoon-datasource,grafana-clock-panel,grafana-example-app,grafana-influxdb-08-datasource,grafana-kairosdb-datasource,grafana-piechart-panel,grafana-simple-json-datasource,grafana-worldmap-panel,kentik-app,mtanda-heatmap-epoch-panel,mtanda-histogram-panel,ns1-app,opennms-datasource,percona-percona-app,praj-ams-datasource,raintank-snap-app,raintank-worldping-app,sileht-gnocchi-datasource,sraoss-sunburst-panel,stagemonitor-elasticsearch-app,udoprog-heroic-datasource,voxter-app"
type: "string"
- variable: influx_ui
description: "Port to access InfluxDB UI"
label: "InfluxDB UI"
required: true
default: "8083"
type: "string"
- variable: influx_db
description: "Port to access InfluxDB DB"
label: "InfluxDB DB"
required: true
default: "8086"
type: "string"
- variable: http_proxy
description: "In case you are at corporate network, setup http_proxy variable"
label: "http_proxy"
required: false
default: ""
type: "string"
- variable: https_proxy
description: "In case you are at corporate network, setup https_proxy variable"
label: "https_proxy"
required: false
default: ""
type: "string"
+3
View File
@@ -0,0 +1,3 @@
## What is inside TIG Stack?
* Telegraf, InfluxDB, Grafana
Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

+5
View File
@@ -0,0 +1,5 @@
name: TIG Stack
description: |
(Experimental) Telegraf, InfluxDB, Grafana for docker monitoring.
version: v0.0.1
category: Monitoring
+62
View File
@@ -0,0 +1,62 @@
grafana:
image: grafana-test
ports:
- 3012:3000
links:
- influxdb:influxdb
environment:
GF_INSTALL_PLUGINS: abhisant-druid-datasource
GF_SECURITY_ADMIN_USER: admin
GF_SECURITY_ADMIN_PASSWORD: admin
GF_SECURITY_SECRET_KEY: grafana
GF_USERS_ALLOW_SIGN_UP: 'true'
GF_USERS_ALLOW_ORG_CREATE: 'true'
GF_AUTH_ANONYMOUS_ENABLED: 'true'
GF_AUTH_ANONYMOUS_ORG_NAME: grafana
GF_DASHBOARDS_JSON_ENABLED: 'true'
GF_DASHBOARDS_JSON_PATH: /opt/grafana
labels:
io.rancher.sidekicks: grafana-data
volumes_from:
- grafana-data
grafana-data:
image: busybox
tty: true
volumes:
- /var/lib/grafana
- /var/log/grafana
- /var/lib/grafana/plugins
influxdb:
image: influxdb-test
ports:
- 8183:8083
- 8186:8086
environment:
INFLUX_DATABASE: "telegraf"
INLFUX_ADMIN_USER: "grafana"
INFLUX_ADMIN_PASS: "grafana"
volumes_from:
- influxdb-data
influxdb-data:
image: busybox
tty: true
volumes:
- /var/lib/influxdb
telegraf:
image: telegraf-test
links:
- influxdb:influxdb
environment:
HOST_NAME: "telegraf"
INFLUXDB_HOST: "influxdb"
INFLUXDB_PORT: "8086"
DATABASE: "telegraf"
tty: true
volumes:
- /var/run/docker.sock:/var/run/docker.sock
privileged: true
+30
View File
@@ -0,0 +1,30 @@
log:
name: "Grafana"
version: "3.0.2-rancher1"
description: |
(Experimental) Grafana: Beautiful metric & analytic dashboards
questions:
- variable: http_port
description: "http port to access Grafana"
label: "Http Port"
required: true
default: "3000"
type: "int"
- variable: plugins
description: "Coma separated list of Grafana Plugins to be installed plugins."
label: "List of Grafana Plugins plugins"
required: true
default: "abhisant-druid-datasource,alexanderzobnin-zabbix-app,bosun-app,bosun-datasource,crate-datasource,fastweb-openfalcon-datasource,fetzerch-sunandmoon-datasource,grafana-clock-panel,grafana-example-app,grafana-influxdb-08-datasource,grafana-kairosdb-datasource,grafana-piechart-panel,grafana-simple-json-datasource,grafana-worldmap-panel,kentik-app,mtanda-heatmap-epoch-panel,mtanda-histogram-panel,ns1-app,opennms-datasource,percona-percona-app,praj-ams-datasource,raintank-snap-app,raintank-worldping-app,sileht-gnocchi-datasource,sraoss-sunburst-panel,stagemonitor-elasticsearch-app,udoprog-heroic-datasource,voxter-app"
type: "string"
- variable: http_proxy
description: "In case you are at corporate network, setup http_proxy variable"
label: "http_proxy"
required: false
default: ""
type: "string"
- variable: https_proxy
description: "In case you are at corporate network, setup https_proxy variable"
label: "https_proxy"
required: false
default: ""
type: "string"
+12
View File
@@ -0,0 +1,12 @@
FROM telegraf:latest
MAINTAINER Mateusz Trojak <mateusz.trojak@gmail.com>
LABEL version="1.0"
LABEL description="Telegraf Image with added system variables"
ADD telegraf.template.conf /telegraf.template.conf
ADD run.sh /run.sh
RUN chmod +x /*.sh
CMD ["/run.sh"]
+15
View File
@@ -0,0 +1,15 @@
#!/bin/bash
set -m
CONFIG_TEMPLATE="/telegraf.template.conf"
CONFIG_FILE="/etc/telegraf/telegraf.conf"
sed -e "s/\${HOST_NAME}/$HOST_NAME/" \
-e "s!\${INFLUXDB_HOST}!$INFLUXDB_HOST!" \
-e "s/\${INFLUXDB_PORT}/$INFLUXDB_PORT/" \
-e "s/\${DATABASE}/$DATABASE/" \
$CONFIG_TEMPLATE > $CONFIG_FILE
echo "=> Starting Telegraf ..."
exec telegraf -config /etc/telegraf/telegraf.conf
File diff suppressed because it is too large Load Diff