added loki, prometheus, promtail, statist

This commit is contained in:
2021-03-14 20:57:44 +01:00
parent 89b7fd0747
commit 1d8d30a8ab
18 changed files with 509 additions and 0 deletions

7
loki/Dockerfile Normal file
View File

@@ -0,0 +1,7 @@
FROM centos:7
RUN yum update -y && yum install -y unzip && yum clean all
RUN curl -O -L "https://github.com/grafana/loki/releases/download/v2.1.0/loki-linux-amd64.zip" && unzip loki-linux-amd64.zip -d /loki && rm loki-linux-amd64.zip && cd /loki && chmod a+x "loki-linux-amd64"
COPY config.yaml /loki
COPY docker-entrypoint.sh /
RUN chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]

37
loki/config.yaml Normal file
View File

@@ -0,0 +1,37 @@
auth_enabled: false
server:
http_listen_port: 3100
ingester:
lifecycler:
address: 127.0.0.1
ring:
kvstore:
store: inmemory
replication_factor: 1
final_sleep: 0s
chunk_idle_period: 5m
chunk_retain_period: 30s
schema_config:
configs:
- from: 2020-05-15
store: boltdb
object_store: filesystem
schema: v11
index:
prefix: index_
period: 168h
storage_config:
boltdb:
directory: /tmp/loki/index
filesystem:
directory: /tmp/loki/chunks
limits_config:
enforce_metric_name: false
reject_old_samples: true
reject_old_samples_max_age: 168h

32
loki/docker-entrypoint.sh Normal file
View File

@@ -0,0 +1,32 @@
#!/bin/bash
if [[ (! -z "${LOKI_DAEMON_USER}" ) && ( "${LOKI_DAEMON_USER}" != "root" ) ]]; then
useradd -r -s /bin/false $LOKI_DAEMON_USER
if [[ ! -z "${LOKI_DAEMON_USER_UID}" ]]; then
usermod -u $LOKI_DAEMON_USER_UID $LOKI_DAEMON_USER
fi
if [[ ! -z "${LOKI_DAEMON_USER_GID}" ]]; then
groupmod -g $LOKI_DAEMON_USER_GID $LOKI_DAEMON_USER
fi
fi
if [ ! -d "/lokidata" ]; then
mkdir -p /lokidata
fi
echo "Chowning Data"
if [[ ! -z "${LOKI_DAEMON_USER}" ]]; then
chown -R $(id -u ${LOKI_DAEMON_USER}):$(id -g ${LOKI_DAEMON_USER}) /loki
chown -R $(id -u ${LOKI_DAEMON_USER}):$(id -g ${LOKI_DAEMON_USER}) /lokidata
else
chown -R $(id -u):$(id -g) /loki
chown -R $(id -u):$(id -g) /lokidata
fi
if [[ ! -z "${LOKI_DAEMON_USER}" ]]; then
runuser -u ${LOKI_DAEMON_USER} -- /loki/loki-linux-amd64 -config.file=/loki/config.yaml
else
/loki/loki-linux-amd64 -config.file=/loki/config.yaml
fi