setup full autodeployment for icingaweb with grafana

This commit is contained in:
2025-02-02 02:35:29 +01:00
parent 99858ab83d
commit 1e7e1f829c
5 changed files with 420 additions and 24 deletions

View File

@@ -20,20 +20,15 @@ If you run the setup without any environment vars the setup token will be printe
## 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 no (longer) use `.` rather `__` (2x `_`)
* 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`.
* As long as you don't need `.` in `Section`'s or `Key`'s you can use both spellings of docker compose environment
So will this:
```
ICINGAWEB2_CONF__global__config_backend=db
```
or
```
ICINGAWEB2_CONF__global__config_backend: db
```
create this:
```ini
@@ -52,7 +47,6 @@ ICINGAWEB2_AUTH | /etc/icingaweb2/authentication.ini | [Authentication](https://
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
--- | --- | --- | ---
@@ -60,10 +54,12 @@ ICINGAWEB2_ICINGADB_CONF | icingadb | /etc/icingaweb2/modules/icingadb/config.in
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_AUTH | grafana | /etc/icingaweb2/modules/grafana/grafana.ini | [Grafana Preparations](https://github.com/NETWAYS/icingaweb2-module-grafana/blob/main/doc/02-installation.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
--- | ---
@@ -117,22 +113,49 @@ services:
- ICINGAWEB2_ICINGADB_CONF__icingadb__resource=icingadb
- ICINGAWEB2_ICINGADB_REDIS__redis1__host=redis
- ICINGAWEB2_ICINGADB_REDIS__redis1__port=6379
- ICINGAWEB2_ICINGADB_API__icinga2__transport=api
- ICINGAWEB2_ICINGADB_API__icinga2__host=icinga2
- ICINGAWEB2_ICINGADB_API__icinga2__port=5665
- ICINGAWEB2_ICINGADB_API__icinga2__username=icingaweb
- ICINGAWEB2_ICINGADB_API__icinga2__password=icingaweb
- ICINGAWEB2_ICINGADB_CMD__icinga2__transport=api
- ICINGAWEB2_ICINGADB_CMD__icinga2__host=icinga2
- ICINGAWEB2_ICINGADB_CMD__icinga2__port=5665
- ICINGAWEB2_ICINGADB_CMD__icinga2__username=icingaweb
- ICINGAWEB2_ICINGADB_CMD__icinga2__password=icingaweb
- 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=
```
If you ask why the hell vars with `.` :
- Due to the dynamic translation of variables to ini files, some modules use this peculiarity.
- currently in the module `grafana` in file `grafana.ini`
- https://stackoverflow.com/questions/2821043/allowed-characters-in-linux-environment-variable-names
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 tested and i am not sure i will recommend this...
For now be save and use it only for inital setup.
For now be save and use it only for inital setup.
## 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/)