From 7916a300d5c1d6a891d20876868a8e4f31ca3869 Mon Sep 17 00:00:00 2001 From: Benedikt Heine Date: Fri, 6 Jan 2017 20:02:02 +0100 Subject: [PATCH] add icingaweb2 graphite --- Dockerfile | 7 +++++++ README.md | 1 + content/opt/run | 1 + content/opt/setup/graphite | 4 ++++ content/opt/setup/icingaweb2-graphite | 15 +++++++++++++++ 5 files changed, 28 insertions(+) create mode 100755 content/opt/setup/icingaweb2-graphite diff --git a/Dockerfile b/Dockerfile index 105a5b8..6d167c7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,9 +9,11 @@ ENV DEBIAN_FRONTEND noninteractive ENV ICINGA2_FEATURE_GRAPHITE false ENV ICINGA2_FEATURE_GRAPHITE_HOST graphite ENV ICINGA2_FEATURE_GRAPHITE_PORT 2003 +ENV ICINGA2_FEATURE_GRAPHITE_URL http://${ICINGA2_FEATURE_GRAPHITE_HOST} ARG GITREF_ICINGAWEB2=master ARG GITREF_DIRECTOR=master +ARG GITREF_MODGRAPHITE=master RUN apt-get -qq update \ && apt-get -qqy upgrade \ @@ -57,6 +59,11 @@ RUN wget -q --no-cookies -O - "https://github.com/Icinga/icingaweb2/archive/${GI && wget -q --no-cookies -O - "https://github.com/Icinga/icingaweb2-module-director/archive/${GITREF_DIRECTOR}.tar.gz" \ | tar xz --strip-components=1 --directory=/etc/icingaweb2/modules/director --exclude=.gitignore -f - \ && icingacli module enable director \ +# Icingaweb2 Graphite + && mkdir -p /etc/icingaweb2.dist/modules/graphite \ + && wget -q --no-cookies -O - "https://github.com/Icinga/icingaweb2-module-graphite/archive/${GITREF_ICINGAWEB2}.tar.gz" \ + | tar xz --strip-components=1 --directory=/etc/icingaweb2.dist/modules/graphite -f - icingaweb2-module-graphite-${GITREF_MODGRAPHITE}/ \ + && cp -r /etc/icingaweb2/modules/graphite/sample-config/icinga2/ /etc/icingaweb2/modules/graphite \ # Final fixes && mv /etc/icingaweb2/ /etc/icingaweb2.dist \ && mkdir /etc/icingaweb2 \ diff --git a/README.md b/README.md index 17aefe7..fb37657 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,7 @@ DEBIAN_SYS_MAINT_PASSWORD ICINGA2_FEATURE_GRAPHITE - false (default). Set to true or 1 to enable graphite writer ICINGA2_FEATURE_GRAPHITE_HOST - graphite (default). Set to link name, hostname, or IP address where Carbon daemon is running ICINGA2_FEATURE_GRAPHITE_PORT - 2003 (default). Carbon port +ICINGA2_FEATURE_GRAPHITE_URL - http://{ICINGA2_FEATURE_GRAPHITE_HOST} (default). Web-URL for Graphite DIRECTOR_KICKSTART - true (default). Set to false to disable director auto kickstart at container startup ICINGAWEB2_ADMIN_USER - Icingaweb2 Login User ICINGAWEB2_ADMIN_PASS - Icingaweb2 Login Password diff --git a/content/opt/run b/content/opt/run index e8af833..03e2dc9 100755 --- a/content/opt/run +++ b/content/opt/run @@ -22,6 +22,7 @@ fi /opt/setup/graphite /opt/setup/icingaweb2 /opt/setup/icingaweb2-director +/opt/setup/icingaweb2-graphite cat <<-END diff --git a/content/opt/setup/graphite b/content/opt/setup/graphite index 44b8550..0af4258 100755 --- a/content/opt/setup/graphite +++ b/content/opt/setup/graphite @@ -15,7 +15,11 @@ if [ "${ICINGA2_FEATURE_GRAPHITE}" == "true" ] || [ "${ICINGA2_FEATURE_GRAPHITE} object GraphiteWriter "graphite" { host = "$ICINGA2_FEATURE_GRAPHITE_HOST" port = "$ICINGA2_FEATURE_GRAPHITE_PORT" + enable_send_thresholds = true } END +else + # Actively disable graphite, to not hit any weird bugs + icinga2 feature disable graphite fi diff --git a/content/opt/setup/icingaweb2-graphite b/content/opt/setup/icingaweb2-graphite new file mode 100755 index 0000000..70f2a6b --- /dev/null +++ b/content/opt/setup/icingaweb2-graphite @@ -0,0 +1,15 @@ +#!/bin/bash + +# Graphite writer +if [ "${ICINGA2_FEATURE_GRAPHITE}" == "true" ] || [ "${ICINGA2_FEATURE_GRAPHITE}" == "1" ]; then + echo "=> Enabling Icingaweb2 graphite module" + + # icingaweb-graphite + icingacli module enable graphite + + ini /etc/icingaweb2/modules/graphite/config.ini set graphite web_url "${ICINGA2_FEATURE_GRAPHITE_URL}" + +else + # Actively disable graphite, to not hit any weird bugs + icingacli module disable graphite +fi