Icinga Master und Agents
Icinga Docs: https://icinga.com/docs/icinga-2/latest/doc/02-installation/01-Debian/#install-icinga-2-on-debian
Debian Repository
xxxxxxxxxxapt
updateapt -y install apt-transport-https wget gnupgwget -O - https://packages.icinga.com/icinga.key | gpg --dearmor -o /usr/share/keyrings/icinga-archive-keyring.gpgDIST=$(awk -F"[)(]+" '/VERSION=/ {print $2}' /etc/os-release); \ echo "deb [signed-by=/usr/share/keyrings/icinga-archive-keyring.gpg] https://packages.icinga.com/debian icinga-${DIST} main" > \ /etc/apt/sources.list.d/${DIST}-icinga.list echo "deb-src [signed-by=/usr/share/keyrings/icinga-archive-keyring.gpg] https://packages.icinga.com/debian icinga-${DIST} main" >> \ /etc/apt/sources.list.d/${DIST}-icinga.listapt updateInstall Icinga 2
xxxxxxxxxxapt
install icinga2Once repository is updated, install Icinga2 and Icinga web 2 using the following command:
xxxxxxxxxxapt-get install icinga2 icingaweb2 icinga2-ido-mysql -yDuring the installation, you will be asked a series of question to setup the application. Answer each question as shown below:
xxxxxxxxxxEnable Icinga 2's ido-mysql feature? YESConfigure database for icinga2-ido-mysql with dbconfig-common? NONext, you will need to enable the ido-mysql and command feature in Icinga 2. You can do this using the following command:
xxxxxxxxxxicinga2 feature enable ido-mysqlicinga2 feature enable commandFinally, restart the Icinga2 service and enable it to start on boot time with the following command:
xxxxxxxxxxsystemctl restart icinga2systemctl enable icinga2Set up Check Plugins
xxxxxxxxxxapt
install monitoring-pluginsSet up Icinga 2 API
xxxxxxxxxxicinga2
api setupRestart Icinga 2 for these changes to take effect.
xxxxxxxxxxsystemctl
restart icinga2Set up Icinga DB
Setting up Icinga 2’s Icinga DB feature is only required for Icinga 2 master nodes or single-node setups.
Set up Redis Server
Tip:
Although the Redis server can run anywhere in an Icinga environment, we recommend to install it where the corresponding Icinga 2 node is running to keep latency between the components low.
Install Icinga DB Redis Package
xxxxxxxxxxapt
install icingadb-redisRun Icinga DB Redis
The icingadb-redis package automatically installs the necessary systemd unit files to run Icinga DB Redis. Please run the following command to enable and start its service:
xxxxxxxxxxsystemctl
enable --now icingadb-redisEnable Remote Redis Connections ¶
By default, icingadb-redis only listens on 127.0.0.1. If Icinga Web or Icinga 2 is running on another node, remote access to the Redis server must be allowed. This requires the following directives to be set in the /etc/icingadb-redis/icingadb-redis.conf configuration file:
- Set
protected-modetono, i.e.protected-mode no - Set
bindto the desired binding interface or bind all interfaces, e.g.bind 0.0.0.0
Warning:
By default, Redis has no authentication preventing others from accessing it. When opening Redis to an external interface, make sure to set a password, set up appropriate firewall rules, or configure TLS with certificate authentication on Redis and its consumers, i.e. Icinga 2, Icinga DB and Icinga Web.
Restart Icinga DB Redis for these changes to take effect:
xxxxxxxxxxsystemctl
restart icingadb-redisEnable Icinga DB Feature
To enable the icingadb feature use the following command:
xxxxxxxxxxicinga2
feature enable icingadbRestart Icinga 2 for these changes to take effect:
xxxxxxxxxxsystemctl
restart icinga2Install Icinga DB Daemon
After installing Icinga 2, setting up a Redis server and enabling the icingadb feature, the Icinga DB daemon that synchronizes monitoring data between the Redis server and a database is now set up.
Tip:
Although the Icinga DB daemon can run anywhere in an Icinga environment, we recommend to install it where the corresponding Icinga 2 node and Redis server is running to keep latency between the components low.
The Icinga DB daemon package is also included in the Icinga repository, and since it is already set up, you have completed the instructions here and can proceed to install the Icinga DB daemon on Debian, which will also guide you through the setup of the database and Icinga DB Web.
Backup
Ensure to include the following in your backups:
- Configuration files in
/etc/icinga2 - Certificate files in
/var/lib/icinga2/ca(Master CA key pair) and/var/lib/icinga2/certs(node certificates) - Runtime files in
/var/lib/icinga2
Installing Icinga DB Package
xxxxxxxxxxapt
install icingadbInstall mariadb-server
xxxxxxxxxxapt
install mariadb-serverSetting up the Database
Setting up a MySQL or MariaDB Database
Set up a MySQL database for Icinga DB:
change the placeholder "CHANGEME"
xxxxxxxxxx#
mysql -u root -pCREATE DATABASE icingadb;CREATE USER 'icingadb'@'localhost' IDENTIFIED BY 'CHANGEME';GRANT ALL ON icingadb.* TO 'icingadb'@'localhost';After creating the database, import the Icinga DB schema using the following command:
xxxxxxxxxxmysql
-u root -p icingadb </usr/share/icingadb/schema/mysql/schema.sqlConfiguring Icinga DB
Icinga DB installs its configuration file to /etc/icingadb/config.yml, pre-populating most of the settings for a local setup. Before running Icinga DB, adjust the Redis® and database credentials and, if necessary, the connection configuration. The configuration file explains general settings. All available settings can be found under Configuration.
Running Icinga DB
The icingadb package automatically installs the necessary systemd unit files to run Icinga DB. Please run the following command to enable and start its service:
xxxxxxxxxxsystemctl
enable --now icingadbInstalling Icinga DB Web
With Icinga 2, Redis®, Icinga DB and the database fully set up, it is now time to install Icinga DB Web, which connects to both Redis® and the database to display and work with the monitoring data.
The Icinga DB Web package is also included in the Icinga repository, and since it is already set up, you have completed the instructions here and can proceed to installing Icinga DB Web on Debian, which will also guide you through the setup of the Icinga Web PHP framework, which is required to run the Icinga DB web module.
Installing the Package
Use your distribution’s package manager to install the icingadb-web package as follows:
xxxxxxxxxxapt
install icingadb-webThis concludes the installation. Now proceed with the configuration.
Configuration
If Icinga Web has been installed but not yet set up, please visit Icinga Web and follow the web-based setup wizard.
http://icingaweb_fqdn/icingaweb2/setup
Icingaweb2 Web-Wizard
Start:
Database Configuration
Connection configuration for the database to which Icinga DB synchronizes monitoring data.
-
Create a new resource for the Icinga DB database via the
Configuration → Application → Resourcesmenu. -
Configure the resource you just created as the database connection for the Icinga DB Web module using the
Configuration → Modules → icingadb → Databasemenu.
Redis® Configuration
Connection configuration for the Redis® server where Icinga 2 writes check results. This data is used to display the latest state information in Icinga DB Web.
- Configure the connection to the Redis® server through the
Configuration → Modules → icingadb → Redismenu.