add grafana module
All checks were successful
build container icingaweb2 / build (push) Successful in 4m2s

This commit is contained in:
2025-02-01 14:59:43 +01:00
parent 4656400214
commit ea28005bc9
4 changed files with 29 additions and 6 deletions

View File

@@ -35,6 +35,17 @@ RUN ["bash", "-exo", "pipefail", "-c", "\
apt clean all ; \
rm -vrf /var/lib/apt/lists/* "]
## install module grafana
ARG MODULE_VERSION="3.0.0"
ARG ICINGAWEB_MODULEPATH="/usr/share/icingaweb2/modules"
ARG REPO_URL="https://github.com/NETWAYS/icingaweb2-module-grafana"
ARG TARGET_DIR="${ICINGAWEB_MODULEPATH}/grafana"
ARG URL="${REPO_URL}/archive/v${MODULE_VERSION}.tar.gz"
RUN ["bash", "-exo", "pipefail", "-c", "\
install -d -m 0755 ${TARGET_DIR} ; \
wget -q -O - $URL | tar xfz - -C ${TARGET_DIR} --strip-components 1 ; \
"]
## create persistend data store
RUN ["bash", "-exo", "pipefail", "-c", "\
mkdir -p /data ; \

View File

@@ -15,6 +15,7 @@ docker compose up -d
For a full deployment see: [comming soon ...]()
If you run the setup without any environment vars the setup token will be printet in docker log!
## understand environment
For the configuration (primarily the initial setup) I use a similar method as: https://hub.docker.com/r/icinga/icingaweb2
@@ -66,16 +67,16 @@ ICINGAWEB2_GRAFANA_GRAPH | grafana | /etc/icingaweb2/modules/grafana/graphs.ini
### static vars
var | description
--- | ---
ICINGAWEB2_CONF_ONCE | if true: all configuration setups (above) run only on fist setup.
ICINGAWEB2_DB_RESOURCE_NAME | needed for setup scrip to know witch database is used for users
ICINGAWEB2_DEFAULT_ADMIN_USER | default admin username
ICINGAWEB2_CONF_ONCE | if var exists: all configuration setups (above) run only on fist setup.
ICINGAWEB2_DB_RESOURCE_NAME | needed for setup script to know witch database is used for users
ICINGAWEB2_DEFAULT_ADMIN_USER | default admin username addidional this var is primary identifier to run auto config
ICINGAWEB2_DEFAULT_ADMIN_PASS | default admin password
### easy setup
If you use the example, than you kan setup the `env.sample`.
If you use the example, than you can setup the `env.sample`.
All required variables are included and insert the values in the correct places.
Hint: in this file all vars dont have the `2` behind icingaweb2 or icinga.
Hint: in this file all vars dont have the `2` behind icingaweb2 or icinga2.
Vars for the container have the `2`
## example

View File

@@ -133,6 +133,15 @@ def main():
### commandtransports.ini : https://icinga.com/docs/icinga-db-web/latest/doc/03-Configuration/#command-transport-configuration
IniFile(ICINGADB_WEB_CONFDIR + 'commandtransports.ini', 'ICINGAWEB2_ICINGADB_API__')
## icingaweb2 modul: grafana
ICINGAWEB_GRAFANA_DIR = ICINGAWEB_CONFDIR + 'modules/grafana/'
### config.ini : https://github.com/NETWAYS/icingaweb2-module-grafana/blob/main/doc/03-module-configuration.md
IniFile(ICINGADB_WEB_CONFDIR + 'config.ini', 'ICINGAWEB2_GRAFANA_CONF__')
### grafana.ini : https://github.com/NETWAYS/icingaweb2-module-grafana/blob/main/doc/02-installation.md
IniFile(ICINGADB_WEB_CONFDIR + 'grafana.ini', 'ICINGAWEB2_GRAFANA_AUTH__')
### graphs.ini : https://github.com/NETWAYS/icingaweb2-module-grafana/blob/main/doc/04-graph-configuration.md
IniFile(ICINGADB_WEB_CONFDIR + 'graph.ini', 'ICINGAWEB2_GRAFANA_GRAPH__')
## run db init
InitDB()

View File

@@ -21,7 +21,9 @@ if [ -z "$(ls -A /data)" ]; then
## enable modules
icingacli module enable icingadb
mkdir -p /etc/icingaweb2/modules/icingadb/
icingacli module enable grafana
mkdir -p /etc/icingaweb2/modules/grafana/
else
## print setup token because no auto deployment will run
icingacli setup token create;