master
root 3 years ago
parent 3fa73d6758
commit 39eb9939ce
  1. 22
      collectd.env
  2. 13
      collectd/Dockerfile
  3. 43
      collectd/root/entrypoint.sh
  4. 38
      collectd/root/srv/collectd/templates/collectd.conf.template
  5. 4
      collectd/root/srv/collectd/templates/collectd.conf.template.base.part
  6. 6
      collectd/root/srv/collectd/templates/collectd.plugin.network.part
  7. 1
      collectd/root/srv/collectd/templates/collectd.plugin.python.end.part
  8. 11
      collectd/root/srv/collectd/templates/collectd.plugin.python.fritz.part
  9. 4
      collectd/root/srv/collectd/templates/collectd.plugin.python.start.part
  10. 18
      collectd/root/srv/collectd/templates/collectd.plugin.write_graphite.part
  11. BIN
      volumes/grafana/data/grafana.db
  12. 84
      volumes/grafana/logs/grafana.log

@ -1,7 +1,19 @@
TZ=Europe/Berlin
FRITZ_IP=192.168.1.1
FRITZ_USER=collectd
FRITZ_PASSWORD=ec2ruRlOhFqpDPw0
EP_HOST=influxdb
EP_PORT=25826
P_NETWORK_ENABLED=true
P_NETWORK_HOST=influxdb
P_NETWORK_PORT=25826
P_PYTHON_ENABLED=true
P_PYTHON_FRITZ_ENABLED=true
P_PYTHON_FRITZ_HOST=192.168.1.1
P_PYTHON_FRITZ_PORT=49000
P_PYTHON_FRITZ_USER=collectd
P_PYTHON_FRITZ_PASSWORD=ec2ruRlOhFqpDPw0
P_WGRAPHITE_ENABLED=false
P_WGRAPHITE_NODE=FritzBoxTest
P_WGRAPHITE_HOST=graphite
P_WGRAPHITE_PORT=2003
P_WGRAPHITE_PROTO=tcp

@ -1,8 +1,15 @@
FROM alpine:latest
RUN apk --no-cache add collectd collectd-python collectd-network gettext \
py3-pip libxslt-dev gcc musl-dev python3-dev tzdata && \
pip3 install --no-cache-dir fritzcollectd
RUN apk --no-cache add collectd collectd-python collectd-network tzdata \
py3-pip gettext && \
apk add --no-cache --virtual .build-deps \
git libxslt-dev gcc musl-dev python3-dev && \
git clone --depth 1 https://github.com/fetzerch/fritzcollectd.git && \
cd fritzcollectd && \
pip3 install --no-cache-dir . && \
apk del .build-deps && \
rm -rf .git/ && \
apk --no-cache add libxslt
COPY ./root /

@ -3,13 +3,42 @@
# Exit at first error
set -e
mkdir -p /srv/collectd/config
CONFIG_DIR=/srv/collectd/config
TEMPLATES_DIR="/srv/collectd/templates"
# Fill the varibles in funkwhale.template and put the result in default.conf
echo "Generating '/srv/collectd/config/collectd.conf'..."
envsubst < \
/srv/collectd/templates/collectd.conf.template > \
/srv/collectd/config/collectd.conf
mkdir -p "${CONFIG_DIR}"
echo "Generating '/srv/collectd/templates/collectd.conf.template'..."
cat "${TEMPLATES_DIR}/collectd.conf.template.base.part" > \
"${TEMPLATES_DIR}/collectd.conf.template"
if [ "${P_NETWORK_ENABLED}" = "true" ]; then
cat "${TEMPLATES_DIR}/collectd.plugin.network.part" >> \
"${TEMPLATES_DIR}/collectd.conf.template"
fi
if [ "${P_PYTHON_ENABLED}" = "true" ]; then
cat "${TEMPLATES_DIR}/collectd.plugin.python.start.part" >> \
"${TEMPLATES_DIR}/collectd.conf.template"
if [ "${P_PYTHON_FRITZ_ENABLED}" = "true" ]; then
cat "${TEMPLATES_DIR}/collectd.plugin.python.fritz.part" >> \
"${TEMPLATES_DIR}/collectd.conf.template"
fi
cat "${TEMPLATES_DIR}/collectd.plugin.python.end.part" >> \
"${TEMPLATES_DIR}/collectd.conf.template"
fi
if [ "${P_WGRAPHITE_ENABLED}" = "true" ]; then
cat "${TEMPLATES_DIR}/collectd.plugin.write_graphite.part" >> \
"${TEMPLATES_DIR}/collectd.conf.template"
fi
# Fill the varibles in collectd.conf.template and put the result in collectd.conf
echo "Generating '${CONFIG_DIR}/collectd.conf'..."
envsubst < /srv/collectd/templates/collectd.conf.template > \
"${CONFIG_DIR}/collectd.conf"
echo "Starting collectd..."
collectd -C /srv/collectd/config/collectd.conf -f
collectd -C "${CONFIG_DIR}/collectd.conf" -f

@ -2,41 +2,3 @@ FQDNLookup true
Interval 10
Timeout 2
ReadThreads 5
LoadPlugin python
LoadPlugin network
LoadPlugin "write_graphite"
<Plugin network>
Server "${EP_HOST}" "${EP_PORT}"
</Plugin>
<Plugin python>
Import "fritzcollectd"
<Module fritzcollectd>
Address "${FRITZ_IP}"
Port 49000
User "${FRITZ_USER}"
Password "${FRITZ_PASSWORD}"
Hostname "FritzBox"
Instance "1"
Verbose "False"
</Module>
</Plugin>
<Plugin "write_graphite">
<Node "fritz_prova">
Host "graphite"
Port "2003"
#Prefix "collectd."
#Postfix ""
#Protocol "udp"
#LogSendErrors false
EscapeCharacter "_"
SeparateInstances true
StoreRates false
AlwaysAppendDS false
#UseTags false
</Node>
</Plugin>

@ -0,0 +1,4 @@
FQDNLookup true
Interval 10
Timeout 2
ReadThreads 5

@ -0,0 +1,6 @@
LoadPlugin network
<Plugin network>
Server "${P_NETWORK_HOST}" "${P_NETWORK_PORT}"
</Plugin>

@ -0,0 +1,11 @@
Import "fritzcollectd"
<Module fritzcollectd>
Address "${P_PYTHON_FRITZ_HOST}"
Port "${P_PYTHON_FRITZ_PORT}"
User "${P_PYTHON_FRITZ_USER}"
Password "${P_PYTHON_FRITZ_PASSWORD}"
Hostname "FritzBox"
Instance "1"
Verbose "False"
</Module>

@ -0,0 +1,18 @@
LoadPlugin "write_graphite"
<Plugin "write_graphite">
<Node "${P_WGRAPHITE_NODE}">
Host "${P_WGRAPHITE_HOST}"
Port "${P_WGRAPHITE_PORT}"
#Prefix "collectd."
#Postfix ""
Protocol "${P_WGRAPHITE_PROTO}"
#LogSendErrors false
EscapeCharacter "_"
SeparateInstances true
StoreRates false
AlwaysAppendDS false
#UseTags false
</Node>
</Plugin>

Binary file not shown.

@ -259,3 +259,87 @@ t=2021-08-09T01:45:19+0200 lvl=warn msg="Request Origin is not authorized" logge
t=2021-08-09T01:45:19+0200 lvl=info msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=GET path=/api/live/ws status=403 remote_addr=192.168.2.13 time_ms=5 size=10 referer=
t=2021-08-09T01:46:19+0200 lvl=warn msg="Request Origin is not authorized" logger=live origin=http://grafana.server.lan appUrl=http://localhost:3000/ allowedOrigins=
t=2021-08-09T01:46:19+0200 lvl=info msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=GET path=/api/live/ws status=403 remote_addr=192.168.2.13 time_ms=3 size=10 referer=
t=2021-08-09T16:15:09+0200 lvl=info msg="Starting Grafana" logger=server version=8.1.1 commit=90c87a52f7 branch=HEAD compiled=2021-08-09T14:53:33+0200
t=2021-08-09T16:15:09+0200 lvl=info msg="Config loaded from" logger=settings file=/usr/share/grafana/conf/defaults.ini
t=2021-08-09T16:15:09+0200 lvl=info msg="Config loaded from" logger=settings file=/srv/grafana/config/grafana.ini
t=2021-08-09T16:15:09+0200 lvl=info msg="Config overridden from command line" logger=settings arg="default.paths.data=/srv/grafana/data"
t=2021-08-09T16:15:09+0200 lvl=info msg="Config overridden from command line" logger=settings arg="default.paths.logs=/srv/grafana/logs"
t=2021-08-09T16:15:09+0200 lvl=info msg="Config overridden from command line" logger=settings arg="default.paths.plugins=/srv/grafana/plugins"
t=2021-08-09T16:15:09+0200 lvl=info msg="Config overridden from command line" logger=settings arg="default.paths.provisioning=/srv/grafana/provisioning"
t=2021-08-09T16:15:09+0200 lvl=info msg="Config overridden from command line" logger=settings arg="default.log.mode=console"
t=2021-08-09T16:15:09+0200 lvl=info msg="Config overridden from Environment variable" logger=settings var="GF_PATHS_DATA=/srv/grafana/data"
t=2021-08-09T16:15:09+0200 lvl=info msg="Config overridden from Environment variable" logger=settings var="GF_PATHS_LOGS=/srv/grafana/logs"
t=2021-08-09T16:15:09+0200 lvl=info msg="Config overridden from Environment variable" logger=settings var="GF_PATHS_PLUGINS=/srv/grafana/plugins"
t=2021-08-09T16:15:09+0200 lvl=info msg="Config overridden from Environment variable" logger=settings var="GF_PATHS_PROVISIONING=/srv/grafana/provisioning"
t=2021-08-09T16:15:09+0200 lvl=info msg="Config overridden from Environment variable" logger=settings var="GF_ANALYTICS_REPORTING_ENABLED=false"
t=2021-08-09T16:15:09+0200 lvl=info msg="Config overridden from Environment variable" logger=settings var="GF_ANALYTICS_CHECK_FOR_UPDATES=false"
t=2021-08-09T16:15:09+0200 lvl=info msg="Config overridden from Environment variable" logger=settings var="GF_SECURITY_DISABLE_INITIAL_ADMIN_CREATION=false"
t=2021-08-09T16:15:09+0200 lvl=info msg="Config overridden from Environment variable" logger=settings var="GF_SECURITY_ADMIN_USER=admin"
t=2021-08-09T16:15:09+0200 lvl=info msg="Config overridden from Environment variable" logger=settings var="GF_SECURITY_ADMIN_PASSWORD=*********"
t=2021-08-09T16:15:09+0200 lvl=info msg="Config overridden from Environment variable" logger=settings var="GF_SECURITY_SECRET_KEY=*********"
t=2021-08-09T16:15:09+0200 lvl=info msg="Config overridden from Environment variable" logger=settings var="GF_SECURITY_DISABLE_GRAVATAR=true"
t=2021-08-09T16:15:09+0200 lvl=info msg="Config overridden from Environment variable" logger=settings var="GF_SECURITY_DISABLE_BRUTE_FORCE_LOGIN_PROTECTION=false"
t=2021-08-09T16:15:09+0200 lvl=info msg="Config overridden from Environment variable" logger=settings var="GF_SECURITY_COOKIE_SAMESITE=strict"
t=2021-08-09T16:15:09+0200 lvl=info msg="Config overridden from Environment variable" logger=settings var="GF_SECURITY_ALLOW_EMBEDDING=false"
t=2021-08-09T16:15:09+0200 lvl=info msg="Config overridden from Environment variable" logger=settings var="GF_DASHBOARDS_DEFAULT_HOME_DASHBOARD_PATH=/srv/grafana/public/home.json"
t=2021-08-09T16:15:09+0200 lvl=info msg="Config overridden from Environment variable" logger=settings var="GF_LOG_MODE=console file"
t=2021-08-09T16:15:09+0200 lvl=info msg="Config overridden from Environment variable" logger=settings var="GF_LOG_LEVEL=info"
t=2021-08-09T16:15:09+0200 lvl=info msg="Path Home" logger=settings path=/usr/share/grafana
t=2021-08-09T16:15:09+0200 lvl=info msg="Path Data" logger=settings path=/srv/grafana/data
t=2021-08-09T16:15:09+0200 lvl=info msg="Path Logs" logger=settings path=/srv/grafana/logs
t=2021-08-09T16:15:09+0200 lvl=info msg="Path Plugins" logger=settings path=/srv/grafana/plugins
t=2021-08-09T16:15:09+0200 lvl=info msg="Path Provisioning" logger=settings path=/srv/grafana/provisioning
t=2021-08-09T16:15:09+0200 lvl=info msg="App mode production" logger=settings
t=2021-08-09T16:15:09+0200 lvl=info msg="Connecting to DB" logger=sqlstore dbtype=sqlite3
t=2021-08-09T16:15:09+0200 lvl=info msg="Starting DB migrations" logger=migrator
t=2021-08-09T16:15:09+0200 lvl=info msg="migrations completed" logger=migrator performed=0 skipped=330 duration=19.826305ms
t=2021-08-09T16:15:09+0200 lvl=info msg="Starting plugin search" logger=plugins
t=2021-08-09T16:15:13+0200 lvl=info msg="Registering plugin" logger=plugins id=input
t=2021-08-09T16:15:13+0200 lvl=info msg="deleted datasource based on configuration" logger=provisioning.datasources name=Prometheus
t=2021-08-09T16:15:13+0200 lvl=info msg="inserting datasource from configuration " logger=provisioning.datasources name=Prometheus uid=
t=2021-08-09T16:15:13+0200 lvl=info msg="Live Push Gateway initialization" logger=live.push_http
t=2021-08-09T16:15:14+0200 lvl=info msg="HTTP Server Listen" logger=http.server address=[::]:3000 protocol=http subUrl= socket=
t=2021-08-09T16:16:53+0200 lvl=warn msg="Request Origin is not authorized" logger=live origin=http://grafana.server.lan appUrl=http://localhost:3000/ allowedOrigins=
t=2021-08-09T16:16:53+0200 lvl=info msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=GET path=/api/live/ws status=403 remote_addr=192.168.2.13 time_ms=215 size=10 referer=
t=2021-08-09T16:16:55+0200 lvl=warn msg="Request Origin is not authorized" logger=live origin=http://grafana.server.lan appUrl=http://localhost:3000/ allowedOrigins=
t=2021-08-09T16:16:55+0200 lvl=info msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=GET path=/api/live/ws status=403 remote_addr=192.168.2.13 time_ms=3 size=10 referer=
t=2021-08-09T16:16:57+0200 lvl=warn msg="Request Origin is not authorized" logger=live origin=http://grafana.server.lan appUrl=http://localhost:3000/ allowedOrigins=
t=2021-08-09T16:16:57+0200 lvl=info msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=GET path=/api/live/ws status=403 remote_addr=192.168.2.13 time_ms=3 size=10 referer=
t=2021-08-09T16:17:02+0200 lvl=warn msg="Request Origin is not authorized" logger=live origin=http://grafana.server.lan appUrl=http://localhost:3000/ allowedOrigins=
t=2021-08-09T16:17:02+0200 lvl=info msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=GET path=/api/live/ws status=403 remote_addr=192.168.2.13 time_ms=4 size=10 referer=
t=2021-08-09T16:17:10+0200 lvl=warn msg="Request Origin is not authorized" logger=live origin=http://grafana.server.lan appUrl=http://localhost:3000/ allowedOrigins=
t=2021-08-09T16:17:10+0200 lvl=info msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=GET path=/api/live/ws status=403 remote_addr=192.168.2.13 time_ms=3 size=10 referer=
t=2021-08-09T16:17:21+0200 lvl=warn msg="Request Origin is not authorized" logger=live origin=http://grafana.server.lan appUrl=http://localhost:3000/ allowedOrigins=
t=2021-08-09T16:17:21+0200 lvl=info msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=GET path=/api/live/ws status=403 remote_addr=192.168.2.13 time_ms=3 size=10 referer=
t=2021-08-09T16:17:35+0200 lvl=warn msg="Request Origin is not authorized" logger=live origin=http://grafana.server.lan appUrl=http://localhost:3000/ allowedOrigins=
t=2021-08-09T16:17:35+0200 lvl=info msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=GET path=/api/live/ws status=403 remote_addr=192.168.2.13 time_ms=5 size=10 referer=
t=2021-08-09T16:17:45+0200 lvl=warn msg="Request Origin is not authorized" logger=live origin=http://grafana.server.lan appUrl=http://localhost:3000/ allowedOrigins=
t=2021-08-09T16:17:45+0200 lvl=info msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=GET path=/api/live/ws status=403 remote_addr=192.168.2.13 time_ms=5 size=10 referer=
t=2021-08-09T16:18:03+0200 lvl=warn msg="Request Origin is not authorized" logger=live origin=http://grafana.server.lan appUrl=http://localhost:3000/ allowedOrigins=
t=2021-08-09T16:18:03+0200 lvl=info msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=GET path=/api/live/ws status=403 remote_addr=192.168.2.13 time_ms=11 size=10 referer=
t=2021-08-09T16:18:16+0200 lvl=warn msg="Request Origin is not authorized" logger=live origin=http://grafana.server.lan appUrl=http://localhost:3000/ allowedOrigins=
t=2021-08-09T16:18:17+0200 lvl=info msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=GET path=/api/live/ws status=403 remote_addr=192.168.2.13 time_ms=648 size=10 referer=
t=2021-08-09T16:18:34+0200 lvl=warn msg="Request Origin is not authorized" logger=live origin=http://grafana.server.lan appUrl=http://localhost:3000/ allowedOrigins=
t=2021-08-09T16:18:34+0200 lvl=info msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=GET path=/api/live/ws status=403 remote_addr=192.168.2.13 time_ms=4 size=10 referer=
t=2021-08-09T16:18:57+0200 lvl=warn msg="Request Origin is not authorized" logger=live origin=http://grafana.server.lan appUrl=http://localhost:3000/ allowedOrigins=
t=2021-08-09T16:18:57+0200 lvl=info msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=GET path=/api/live/ws status=403 remote_addr=192.168.2.13 time_ms=4 size=10 referer=
t=2021-08-09T16:19:30+0200 lvl=warn msg="Request Origin is not authorized" logger=live origin=http://grafana.server.lan appUrl=http://localhost:3000/ allowedOrigins=
t=2021-08-09T16:19:30+0200 lvl=info msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=GET path=/api/live/ws status=403 remote_addr=192.168.2.13 time_ms=3 size=10 referer=
t=2021-08-09T16:20:08+0200 lvl=eror msg="Data proxy error" logger=data-proxy-log userId=1 orgId=1 uname=admin path=/api/datasources/proxy/15/api/v1/query_range remote_addr=192.168.2.13 referer="http://grafana.server.lan/d/jZPRfaM7k/monitor-services?orgId=1&refresh=10s" error="http: proxy error: context canceled"
t=2021-08-09T16:20:08+0200 lvl=eror msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=POST path=/api/datasources/proxy/15/api/v1/query_range status=502 remote_addr=192.168.2.13 time_ms=604 size=0 referer="http://grafana.server.lan/d/jZPRfaM7k/monitor-services?orgId=1&refresh=10s"
t=2021-08-09T16:20:08+0200 lvl=eror msg="Data proxy error" logger=data-proxy-log userId=1 orgId=1 uname=admin path=/api/datasources/proxy/15/api/v1/query_range remote_addr=192.168.2.13 referer="http://grafana.server.lan/d/jZPRfaM7k/monitor-services?orgId=1&refresh=10s" error="http: proxy error: context canceled"
t=2021-08-09T16:20:08+0200 lvl=eror msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=POST path=/api/datasources/proxy/15/api/v1/query_range status=502 remote_addr=192.168.2.13 time_ms=728 size=0 referer="http://grafana.server.lan/d/jZPRfaM7k/monitor-services?orgId=1&refresh=10s"
t=2021-08-09T16:20:08+0200 lvl=eror msg="Data proxy error" logger=data-proxy-log userId=1 orgId=1 uname=admin path=/api/datasources/proxy/15/api/v1/query_range remote_addr=192.168.2.13 referer="http://grafana.server.lan/d/jZPRfaM7k/monitor-services?orgId=1&refresh=10s" error="http: proxy error: context canceled"
t=2021-08-09T16:20:08+0200 lvl=eror msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=POST path=/api/datasources/proxy/15/api/v1/query_range status=502 remote_addr=192.168.2.13 time_ms=810 size=0 referer="http://grafana.server.lan/d/jZPRfaM7k/monitor-services?orgId=1&refresh=10s"
t=2021-08-09T16:20:08+0200 lvl=eror msg="Data proxy error" logger=data-proxy-log userId=1 orgId=1 uname=admin path=/api/datasources/proxy/15/api/v1/query_range remote_addr=192.168.2.13 referer="http://grafana.server.lan/d/jZPRfaM7k/monitor-services?orgId=1&refresh=10s" error="http: proxy error: context canceled"
t=2021-08-09T16:20:08+0200 lvl=eror msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=POST path=/api/datasources/proxy/15/api/v1/query_range status=502 remote_addr=192.168.2.13 time_ms=1186 size=0 referer="http://grafana.server.lan/d/jZPRfaM7k/monitor-services?orgId=1&refresh=10s"
t=2021-08-09T16:20:20+0200 lvl=warn msg="Request Origin is not authorized" logger=live origin=http://grafana.server.lan appUrl=http://localhost:3000/ allowedOrigins=
t=2021-08-09T16:20:20+0200 lvl=info msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=GET path=/api/live/ws status=403 remote_addr=192.168.2.13 time_ms=4 size=10 referer=
t=2021-08-09T16:21:20+0200 lvl=warn msg="Request Origin is not authorized" logger=live origin=http://grafana.server.lan appUrl=http://localhost:3000/ allowedOrigins=
t=2021-08-09T16:21:20+0200 lvl=info msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=GET path=/api/live/ws status=403 remote_addr=192.168.2.13 time_ms=3 size=10 referer=
t=2021-08-09T16:22:20+0200 lvl=warn msg="Request Origin is not authorized" logger=live origin=http://grafana.server.lan appUrl=http://localhost:3000/ allowedOrigins=
t=2021-08-09T16:22:20+0200 lvl=info msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=GET path=/api/live/ws status=403 remote_addr=192.168.2.13 time_ms=4 size=10 referer=
t=2021-08-09T16:23:20+0200 lvl=warn msg="Request Origin is not authorized" logger=live origin=http://grafana.server.lan appUrl=http://localhost:3000/ allowedOrigins=
t=2021-08-09T16:23:20+0200 lvl=info msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=GET path=/api/live/ws status=403 remote_addr=192.168.2.13 time_ms=3 size=10 referer=
t=2021-08-09T16:24:20+0200 lvl=warn msg="Request Origin is not authorized" logger=live origin=http://grafana.server.lan appUrl=http://localhost:3000/ allowedOrigins=
t=2021-08-09T16:24:20+0200 lvl=info msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=GET path=/api/live/ws status=403 remote_addr=192.168.2.13 time_ms=3 size=10 referer=

Loading…
Cancel
Save