Skip to content

Commit

Permalink
add icingaweb2 graphite
Browse files Browse the repository at this point in the history
  • Loading branch information
bebehei committed Jan 6, 2017
1 parent ee4e300 commit 7916a30
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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 \
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions content/opt/run
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ fi
/opt/setup/graphite
/opt/setup/icingaweb2
/opt/setup/icingaweb2-director
/opt/setup/icingaweb2-graphite

cat <<-END
Expand Down
4 changes: 4 additions & 0 deletions content/opt/setup/graphite
Original file line number Diff line number Diff line change
Expand Up @@ -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
15 changes: 15 additions & 0 deletions content/opt/setup/icingaweb2-graphite
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 7916a30

Please sign in to comment.