# Docker IcingaWeb2 [![Build Status](https://git.ao-it.net/docker/icingaweb2/actions/workflows/docker-build.yml/badge.svg?branch=main&event=push)](https://git.ao-it.net/docker/icingaweb2/actions?workflow=docker-build.yml&actor=0&status=0) If you need a full stack: * [AO-IT: icinga-stack](https://git.ao-it.net/docker/icinga-stack) * [AO-IT: icinga2](https://git.ao-it.net/docker/icinga2) Or a additional satellite: * [AO-IT: icinga-satellite](https://git.ao-it.net/docker/icinga-satellite) ## usage If you have a functional icinga2 instance only without icingaweb2: ```bash git clone https://git.ao-it.net/docker/icingaweb2 cd icingaweb2 cp env.sample .env # must edit: GRAFANA_HOST with local IP or FQDN nano .env # edit your env docker compose up -d ``` Hints: * If you run the setup without any environment vars the setup token will be printet in docker log! * If you deploy IcingaDB ENV but it can't be reach, icingaweb looks like broken but it isn't * You can remove the environment var `ICINGAWEB2_CONF_ONCE` whan will changes in `compose.yml` environment deploy every time if the container starts. * You can use this for future config changes, but this isn't good tested and i am not sure i will recommend this... ## understand environment For the configuration (primarily the initial setup) I use a similar method as: https://hub.docker.com/r/icinga/icingaweb2 * In my case a prefix like `ICINGAWEB2_CONF` refers a configuration file. * As a separator I not (longer) use `.` rather `__` (2x `_`) * After the first `__` it follows the `Section` from this ini file. * After the second `__` it follows the `Key` from this `Section` before. * And after the `=` is comes the `value`. So will this: ``` ICINGAWEB2_CONF__global__config_backend=db ``` create this: ```ini [global] config_backend = db ``` --- ### vars icingaweb2 prefix | file | ref --- | --- | --- ICINGAWEB2_CONF | /etc/icingaweb2/config.ini | [General Configuration](https://icinga.com/docs/icinga-web/latest/doc/03-Configuration/#configuration-general) ICINGAWEB2_RESOURCES | /etc/icingaweb2/resources.ini | [Resources](https://icinga.com/docs/icinga-web/latest/doc/04-Resources/#resources) ICINGAWEB2_AUTH | /etc/icingaweb2/authentication.ini | [Authentication](https://icinga.com/docs/icinga-web/latest/doc/05-Authentication/#authentication) ICINGAWEB2_GROUPS | /etc/icingaweb2/groups.ini | [Groups](https://icinga.com/docs/icinga-web/latest/doc/05-Authentication/#groups) ICINGAWEB2_ROLES | /etc/icingaweb2/roles.ini | [Roles](https://icinga.com/docs/icinga-web/latest/doc/06-Security/#roles) ### vars modules prefix | module | file | ref --- | --- | --- | --- ICINGAWEB2_ICINGADB_CONF | icingadb | /etc/icingaweb2/modules/icingadb/config.ini | [General Configuration](https://icinga.com/docs/icinga-db-web/latest/doc/03-Configuration/#general-configuration) ICINGAWEB2_ICINGADB_REDIS | icingadb | /etc/icingaweb2/modules/icingadb/redis.ini | [Redis® Configuration](https://icinga.com/docs/icinga-db-web/latest/doc/03-Configuration/#redis-configuration) ICINGAWEB2_ICINGADB_API | icingadb | /etc/icingaweb2/modules/icingadb/commandtransports.ini | [Command Transport Configuration](https://icinga.com/docs/icinga-db-web/latest/doc/03-Configuration/#command-transport-configuration) ICINGAWEB2_GRAFANA_CONF | grafana | /etc/icingaweb2/modules/grafana/config.ini | [General Configuration](https://github.com/NETWAYS/icingaweb2-module-grafana/blob/main/doc/03-module-configuration.md) ICINGAWEB2_GRAFANA_GRAPH | grafana | /etc/icingaweb2/modules/grafana/graphs.ini | [Graph Configuration](https://github.com/NETWAYS/icingaweb2-module-grafana/blob/main/doc/04-graph-configuration.md) --- ### external vars See sources below ### static vars var | description --- | --- 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 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 icinga2. Vars for the container have the `2` ## example See [compose.yml](compose.yml). This is for environment priview (minimal setup) ```yaml services: icingaweb2: image: git.ao-it.net/docker/icingaweb2 environment: - ICINGAWEB2_CONF_ONCE=true - ICINGAWEB2_CONF__logging__log=php - ICINGAWEB2_CONF__logging__level=ERROR - ICINGAWEB2_CONF__logging__application=icingaweb2 - ICINGAWEB2_CONF__global__config_backend=db - ICINGAWEB2_CONF__global__config_resource=${ICINGAWEB_DB_RESOURCE_NAME:-icingaweb_db} - ICINGAWEB2_RESOURCES__${ICINGAWEB_DB_RESOURCE_NAME:-icingaweb_db}__type=db - ICINGAWEB2_RESOURCES__${ICINGAWEB_DB_RESOURCE_NAME:-icingaweb_db}__db=mysql - ICINGAWEB2_RESOURCES__${ICINGAWEB_DB_RESOURCE_NAME:-icingaweb_db}__host=${ICINGAWEB_DB_HOST:-db_icingaweb} - ICINGAWEB2_RESOURCES__${ICINGAWEB_DB_RESOURCE_NAME:-icingaweb_db}__dbname=${ICINGAWEB_DB:-icingaweb} - ICINGAWEB2_RESOURCES__${ICINGAWEB_DB_RESOURCE_NAME:-icingaweb_db}__username=${ICINGAWEB_DB_USER:-icingaweb} - ICINGAWEB2_RESOURCES__${ICINGAWEB_DB_RESOURCE_NAME:-icingaweb_db}__password=${ICINGAWEB_DB_PASS:-icingaweb} - ICINGAWEB2_RESOURCES__${ICINGAWEB_DB_RESOURCE_NAME:-icingaweb_db}__charset=utf8mb4 - ICINGAWEB2_AUTH__icingaweb2__backend=db - ICINGAWEB2_AUTH__icingaweb2__resource=${ICINGAWEB_DB_RESOURCE_NAME:-icingaweb_db} - ICINGAWEB2_GROUPS__icingaweb2__backend=db - ICINGAWEB2_GROUPS__icingaweb2__resource=${ICINGAWEB_DB_RESOURCE_NAME:-icingaweb_db} - ICINGAWEB2_ROLES__${ICINGAWEB_DEFAULT_ADMIN_ROLE:-Administrators}__groups=${ICINGAWEB_DEFAULT_ADMIN_ROLE:-Administrators} - ICINGAWEB2_ROLES__${ICINGAWEB_DEFAULT_ADMIN_ROLE:-Administrators}__permissions="*" - ICINGAWEB2_ROLES__${ICINGAWEB_DEFAULT_ADMIN_ROLE:-Administrators}__users=${ICINGAWEB_DEFAULT_ADMIN_USER:-icingaadmin} - ICINGAWEB2_DB_RESOURCE_NAME=${ICINGAWEB_DB_RESOURCE_NAME:-icingaweb_db} - ICINGAWEB2_DEFAULT_ADMIN_USER=${ICINGAWEB_DEFAULT_ADMIN_USER:-icingaadmin} - ICINGAWEB2_DEFAULT_ADMIN_PASS=${ICINGAWEB_DEFAULT_ADMIN_PASS:-icingaadmin} - ICINGAWEB2_GRAFANA_CONF__grafana__host=grafana - ICINGAWEB2_GRAFANA_CONF__grafana__defaultdashboard= - ICINGAWEB2_GRAFANA_CONF__grafana__defaultdashboarduid= - ICINGAWEB2_GRAFANA_CONF__grafana__defaultdashboardpanelid=1 - ICINGAWEB2_GRAFANA_CONF__grafana__defaultorgid=1 - ICINGAWEB2_GRAFANA_CONF__grafana__timerange=12h - ICINGAWEB2_GRAFANA_GRAPH__check_command__name= - ICINGAWEB2_GRAFANA_GRAPH__check_command__dashboard= - ICINGAWEB2_GRAFANA_GRAPH__check_command__dashboarduid= - ICINGAWEB2_GRAFANA_GRAPH__check_command__panelId= ``` ## Sources ### Icingaweb2 * [Install Icinga Web 2](https://icinga.com/docs/icinga-web/latest/doc/02-Installation/01-Debian/) * [Installing Icinga DB Web](https://icinga.com/docs/icinga-db-web/latest/doc/02-Installation/Debian/#installing-icinga-db-web-package) * [Feature: InfluxdbWriter ](https://icinga.com/docs/icinga-2/latest/doc/14-features/#influxdb-writer) * [Object Type: InfluxdbWriter ](https://icinga.com/docs/icinga-2/latest/doc/09-object-types/#influxdbwriter) * [Grafana Integration](https://icinga.com/docs/icinga-for-windows/latest/doc/110-Installation/40-Grafana-Integration/) ### Grafana * [Run Grafana Docker image](https://grafana.com/docs/grafana/latest/setup-grafana/installation/docker/) * [Override configuration with environment variable](https://grafana.com/docs/grafana/latest/setup-grafana/configure-grafana/#override-configuration-with-environment-variables) * [Provision Grafana](https://grafana.com/docs/grafana/latest/administration/provisioning/) * [Dashboard JSON model](https://grafana.com/docs/grafana/latest/dashboards/build-dashboards/view-dashboard-json-model/) * [Original JSON: icinga2-default.json](https://grafana.com/docs/grafana/latest/dashboards/build-dashboards/view-dashboard-json-model/) * [Tutorial: Provision dashboards and data sources](https://grafana.com/tutorials/provision-dashboards-and-data-sources/) * [Anonymous authentication](https://grafana.com/docs/grafana/latest/setup-grafana/configure-security/configure-authentication/anonymous-auth/) * [Docker Hub: grafana/grafana-oos](https://hub.docker.com/r/grafana/grafana-oss) * [Docker Hub: grafana/grafana](https://hub.docker.com/r/grafana/grafana) * [Image Rendering](https://github.com/grafana/grafana-image-renderer?tab=readme-ov-file#remote-rendering-service-installation) (if you dont want grafana direct accessable, but have many cons) * [Docker Hub: grafana/grafana-image-renderer](https://hub.docker.com/r/grafana/grafana-image-renderer) * [Grafana Plugin: grafana-image-renderer](https://grafana.com/grafana/plugins/grafana-image-renderer/)