### Example URL for Module Image
Source: https://icinga.com/docs/icinga-web/latest/modules/doc/doc/03-Module-Documentation
An example of the URL structure for accessing a specific image file.
```text
icingaweb2/doc/module/example-module/image/img/example.png
```
--------------------------------
### Install Icinga Web 2 Packages
Source: https://icinga.com/docs/icinga-web/latest/doc/02-Installation/06-Amazon-Linux
Install the main Icinga Web 2 package and the command-line interface tool. If SELinux is enabled, also install the SELinux support package.
```bash
yum install icingaweb2 icingacli
```
--------------------------------
### Enable RHEL 8 Repositories and Install EPEL
Source: https://icinga.com/docs/icinga-web/latest/doc/02-Installation/04-RHEL
For RHEL 8, enable the 'optional' and 'codeready-builder' repositories, then install the EPEL release package.
```bash
ARCH=$( /bin/arch )
subscription-manager repos --enable rhel-8-server-optional-rpms
subscription-manager repos --enable "codeready-builder-for-rhel-8-${ARCH}-rpms"
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
```
--------------------------------
### Install Icinga Web 2 and CLI
Source: https://icinga.com/docs/icinga-web/latest/doc/02-Installation/01-Debian
Installs the main Icinga Web 2 package and the `icingacli` command-line tool, which is required for further configuration steps.
```bash
apt-get install icingaweb2 icingacli
```
--------------------------------
### Show Icinga Web 2 Setup Token
Source: https://icinga.com/docs/icinga-web/latest/doc/02-Installation/06-Amazon-Linux
Display the currently active setup token if you have forgotten it.
```bash
icingacli setup token show
```
--------------------------------
### Install Module from Tarball
Source: https://icinga.com/docs/icinga-web/latest/doc/08-Modules
Installs a module by downloading a tarball from a URL, extracting it to the modules path, and then enabling it via the CLI. Ensure the web-server has read permissions for the module files.
```bash
MODULE_NAME="map"
MODULE_VERSION="v1.1.0"
MODULE_AUTHOR="nbuchwitz"
MODULES_PATH="/usr/share/icingaweb2/modules"
MODULE_PATH="${MODULES_PATH}/${MODULE_NAME}"
RELEASES="https://github.com/${MODULE_AUTHOR}/icingaweb2-module-${MODULE_NAME}/archive"
mkdir "$MODULE_PATH" \
&& wget -q $RELEASES/${MODULE_VERSION}.tar.gz -O - \
| tar xfz - -C "$MODULE_PATH" --strip-components 1
icyngacli module enable "${MODULE_NAME}"
```
--------------------------------
### Install Icinga Web 2 Packages
Source: https://icinga.com/docs/icinga-web/latest/doc/02-Installation/05-SLES
Installs the main Icinga Web 2 package and the icingacli utility, which is needed for further configuration steps.
```bash
zypper install icingaweb2 icingacli
```
--------------------------------
### Install Icinga Web 2 and CLI on RHEL 8
Source: https://icinga.com/docs/icinga-web/latest/doc/02-Installation/04-RHEL
Install the main Icinga Web 2 package and the icingacli utility using dnf.
```bash
dnf install icingaweb2 icingacli
```
--------------------------------
### Install Module from Git Repository
Source: https://icinga.com/docs/icinga-web/latest/doc/08-Modules
Installs a module by cloning a Git repository to the modules path and then enabling it via the CLI. Ensure the module version specified is a valid branch or tag.
```bash
MODULE_NAME="map"
MODULE_VERSION="v1.1.0"
MODULE_AUTHOR="nbuchwitz"
REPO="https://github.com/${MODULE_AUTHOR}/icingaweb2-module-${MODULE_NAME}"
MODULES_PATH="/usr/share/icingaweb2/modules"
git clone ${REPO} "${MODULES_PATH}/${MODULE_NAME}" --branch "${MODULE_VERSION}"
icyngacli module enable "${MODULE_NAME}"
```
--------------------------------
### Show Existing Setup Token for Icinga Web 2
Source: https://icinga.com/docs/icinga-web/latest/doc/02-Installation/05-SLES
Retrieves and displays the currently active setup token for Icinga Web 2, useful if the token was lost or needs to be re-entered.
```bash
icingacli setup token show
```
--------------------------------
### Install Apache and PHP Dependencies (RHEL/CentOS/Fedora)
Source: https://icinga.com/docs/icinga-web/latest/doc/02-Installation/07-From-Source
Install Apache web server and necessary PHP modules for Icinga Web 2 on RHEL-based systems.
```bash
yum install httpd mysql-server
yum install php php-gd php-intl
```
--------------------------------
### Generate Icinga Web 2 Setup Token
Source: https://icinga.com/docs/icinga-web/latest/doc/02-Installation/06-Amazon-Linux
Create a setup token required for the initial web-based configuration of Icinga Web 2.
```bash
icingacli setup token create
```
--------------------------------
### Install Icinga Web 2 and CLI on Ubuntu
Source: https://icinga.com/docs/icinga-web/latest/doc/02-Installation/02-Ubuntu
Installs the Icinga Web 2 package along with the necessary Apache PHP module and the Icinga command-line interface.
```bash
apt-get install icingaweb2 libapache2-mod-php icingacli
```
--------------------------------
### Automate Icinga Web 2 Installation: Create Configuration Directory
Source: https://icinga.com/docs/icinga-web/latest/doc/20-Advanced-Topics
Create the Icinga Web 2 configuration directory with appropriate ownership and permissions using icingacli.
```bash
icingacli setup config directory
```
--------------------------------
### Create Setup Token for Icinga Web 2
Source: https://icinga.com/docs/icinga-web/latest/doc/02-Installation/05-SLES
Generates a security token required for accessing the Icinga Web 2 setup wizard in your browser.
```bash
icingacli setup token create
```
--------------------------------
### Enable RHEL 7 Repositories and Install EPEL
Source: https://icinga.com/docs/icinga-web/latest/doc/02-Installation/04-RHEL
For RHEL 7, enable the 'optional' and 'rhscl' repositories to ensure newer PHP versions are available, then install the EPEL release package.
```bash
subscription-manager repos --enable rhel-7-server-optional-rpms
subscription-manager repos --enable rhel-server-rhscl-7-rpms
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
```
--------------------------------
### Automate Icinga Web 2 Installation: Enable Icinga 2 Features
Source: https://icinga.com/docs/icinga-web/latest/doc/20-Advanced-Topics
Enable the 'ido-mysql' and 'api' features for Icinga 2 using the icinga2 CLI.
```bash
icinga2 feature enable ido-mysql
```
```bash
icinga2 feature enable api
```
--------------------------------
### Configure Database Groups
Source: https://icinga.com/docs/icinga-web/latest/doc/05-Authentication
Example configuration for database-based group management. The 'resource' must be a valid database resource defined in resources.ini.
```ini
# vim /etc/icingaweb2/groups.ini
[icingaweb2]
backend = "db"
resource = "icingaweb_db"
```
--------------------------------
### Enable Module via CLI
Source: https://icinga.com/docs/icinga-web/latest/doc/08-Modules
Use the icingacli to enable a module. Ensure the module is installed in one of the configured module paths.
```bash
icingacli module enable map
```
--------------------------------
### Configure Active Directory Groups
Source: https://icinga.com/docs/icinga-web/latest/doc/05-Authentication
Example configuration for Active Directory groups using the 'msldap' backend. Ensure the 'resource' points to a defined LDAP resource.
```ini
# vim /etc/icingaweb2/groups.ini
[active directory]
backend = "msldap"
resource = "auth_ad"
group_class = "group"
user_class = "user"
user_name_attribute = "userPrincipalName"
```
--------------------------------
### Database Resource Configuration (Unix Socket - PostgreSQL)
Source: https://icinga.com/docs/icinga-web/latest/doc/04-Resources
Example of a database resource configuration using a Unix domain socket for PostgreSQL. For PostgreSQL sockets, 'host' should be the path to the socket directory.
```ini
[icingaweb-pgsql-socket]
type = db
db = pgsql
host = /var/run/postgresql
port = 5432
username = icingaweb
password = icingaweb
dbname = icingaweb
```
--------------------------------
### Configure Default Domain for Authentication
Source: https://icinga.com/docs/icinga-web/latest/doc/05-Authentication
Example of setting a default domain in config.ini. This allows users to omit the domain suffix when logging in if they belong to the default domain.
```ini
# vim /etc/icingaweb2/config.ini
[authentication]
default_domain = "icinga.com"
```
--------------------------------
### Database Resource Configuration (Unix Socket - MySQL)
Source: https://icinga.com/docs/icinga-web/latest/doc/04-Resources
Example of a database resource configuration using a Unix domain socket for MySQL. When using sockets, 'host' should be set to 'localhost'.
```ini
[icingaweb-mysql-socket]
type = db
db = mysql
host = localhost
username = icingaweb
password = icingaweb
dbname = icingaweb
```
--------------------------------
### Database Resource Configuration (TCP)
Source: https://icinga.com/docs/icinga-web/latest/doc/04-Resources
Example of a database resource configuration using TCP/IP connection for MySQL. Ensure the host, port, username, password, and database name are correctly set.
```ini
[icingaweb-mysql-tcp]
type = db
db = mysql
host = 127.0.0.1
port = 3306
username = icingaweb
password = icingaweb
dbname = icingaweb
```
--------------------------------
### List SELinux Modules
Source: https://icinga.com/docs/icinga-web/latest/doc/90-SELinux
Use this command to list installed SELinux modules related to Icinga2, Icingaweb2, Nagios, or Apache. This helps identify relevant policies.
```bash
semodule -l | grep -e icinga2 -e icingaweb2 -e nagios -e apache
```
--------------------------------
### Define a Role in roles.ini
Source: https://icinga.com/docs/icinga-web/latest/doc/06-Security
Example of a role definition in the `roles.ini` configuration file. This role grants specific permissions and applies a restriction to monitoring objects.
```ini
[winadmin]
users = "jdoe, janedoe"
groups = "admin"
permissions = "config/*, module/monitoring, monitoring/commands/schedule-check"
refusals = "config/authentication"
monitoring/filter/objects = "host_name=*win*"
```
--------------------------------
### Automate Icinga Web 2 Installation: Generate Webserver Config
Source: https://icinga.com/docs/icinga-web/latest/doc/20-Advanced-Topics
Generate Apache or Nginx configuration for Icinga Web 2 using the icingacli tool. The output is printed to stdout.
```bash
icingacli setup config webserver apache
```
--------------------------------
### Configure Active Directory Groups with User Backend
Source: https://icinga.com/docs/icinga-web/latest/doc/05-Authentication
Example for Active Directory groups referencing a specific group resource and a separate user backend resource. Nested group search is enabled.
```ini
# vim /etc/icingaweb2/groups.ini
[ad_groups_company]
backend = "msldap"
resource = "ad_company"
user_backend = "ad_users_company"
nested_group_search = "1"
base_dn = "ou=Icinga,ou=Groups,dc=company,dc=com"
```
--------------------------------
### Enable PHP 8.0 on Amazon Linux 2
Source: https://icinga.com/docs/icinga-web/latest/doc/02-Installation/06-Amazon-Linux
Install and enable the amazon-linux-extras repository to meet Icinga Web 2 requirements, specifically enabling PHP 8.0.
```bash
yum install -y amazon-linux-extras
amazon-linux-extras enable php8.0
```
--------------------------------
### Apache Configuration for Kiosk Mode
Source: https://icinga.com/docs/icinga-web/latest/doc/20-Advanced-Topics
Configure Apache to automatically start in kiosk mode by setting the REMOTE_USER environment variable based on the client's IP address. Replace X.X.X.X with the actual IP.
```apache
# Apache 2.4
SetEnvIf Remote_Addr "X.X.X.X" REMOTE_USER=kiosk
Require all granted
```
--------------------------------
### Configure LDAP Domain-Aware Authentication
Source: https://icinga.com/docs/icinga-web/latest/doc/05-Authentication
Example for configuring an LDAP backend with domain awareness. Users will need to log in using their full domain-qualified username.
```ini
# vim /etc/icingaweb2/authentication.ini
[auth_icinga]
backend = ldap
resource = icinga_ldap
user_class = inetOrgPerson
user_name_attribute = uid
filter = "memberOf=cn=icinga_users,cn=groups,cn=accounts,dc=icinga,dc=com"
domain = "icinga.com"
[auth_example]
backend = msldap
resource = example_ad
domain = EXAMPLE
```
--------------------------------
### Insert Icinga Admin User with Hash (Manual Setup)
Source: https://icinga.com/docs/icinga-web/latest/doc/20-Advanced-Topics
After setting up the database, insert the 'icingaadmin' user with a generated password hash. This step is part of the manual Icinga Web 2 database setup.
```sql
mysql -p icingaweb2
INSERT INTO icingaweb_user (name, active, password_hash) VALUES ('icingaadmin', 1, '$1$EzxLOFDr$giVx3bGhVm4lDUAw6srGX1');
quit
```
--------------------------------
### Create Icinga Web 2 Database and User
Source: https://icinga.com/docs/icinga-web/latest/doc/20-Advanced-Topics
Manually create the 'icingaweb2' database and grant necessary privileges to a new user for MySQL/MariaDB. This is part of the manual setup process if not using the setup wizard.
```sql
sudo mysql -p
CREATE DATABASE icingaweb2;
GRANT CREATE, SELECT, INSERT, UPDATE, DELETE, DROP, ALTER, CREATE VIEW, INDEX, EXECUTE ON icingaweb2.* TO 'icingaweb2'@'localhost' IDENTIFIED BY 'icingaweb2';
quit
mysql -p icingaweb2 < /usr/share/icingaweb2/schema/mysql.schema.sql
```
--------------------------------
### Automate Icinga Web 2 Installation: Create Admin User
Source: https://icinga.com/docs/icinga-web/latest/doc/20-Advanced-Topics
Insert an administrator user into the icingaweb2 database with a hashed password. The hash is generated using PHP.
```bash
INSERT INTO icingaweb_user (name, active, password_hash) VALUES ('admin', 1, '')", where "" is the output of "php -r 'echo password_hash("yourtopsecretpassword", PASSWORD_DEFAULT);'"
```
--------------------------------
### Get File SELinux Context
Source: https://icinga.com/docs/icinga-web/latest/doc/90-SELinux
Display the SELinux security context of a specific file. This is useful when diagnosing file access problems.
```bash
ls -lZ /path/to/file
```
--------------------------------
### Basic Filter Expression Example
Source: https://icinga.com/docs/icinga-web/latest/doc/06-Security
A regular filter query for services that are problems and not handled.
```text
AND-- service_problem = 1
|
+--- service_handled = 0
```
--------------------------------
### Apply Specific MySQL Upgrade Script
Source: https://icinga.com/docs/icinga-web/latest/doc/80-Upgrading
Example of applying a specific MySQL upgrade script for version 2.5.0. This command targets the 'icinga' database and applies the specified SQL file.
```bash
# mysql -u root -p icinga < /usr/share/doc/icingaweb2/schema/mysql-upgrades/2.5.0.sql
```
--------------------------------
### Add Icinga Package Repository for CentOS
Source: https://icinga.com/docs/icinga-web/latest/doc/02-Installation/03-CentOS
Download the Icinga release repository configuration file. This is necessary for installing Icinga Web 2 and other Icinga packages.
```bash
wget https://packages.icinga.com/centos/ICINGA-release.repo -O /etc/yum.repos.d/ICINGA-release.repo
```
--------------------------------
### Restart Apache Web Server
Source: https://icinga.com/docs/icinga-web/latest/doc/05-Authentication
Apply web server configuration changes by restarting the web server service. This example shows restarting `httpd` on CentOS 7.
```bash
systemctl restart httpd
```
--------------------------------
### ConfigFormEventsHook Example
Source: https://icinga.com/docs/icinga-web/latest/doc/60-Hooks
Implement the ConfigFormEventsHook to intercept and modify configuration form handling. Use appliesTo() to specify which forms the hook should affect, isValid() to perform custom validation, and onSuccess() to execute logic after successful storage.
```php
namespace Icinga\Module\Acme\ProvidedHook;
use Icinga\Application\Hook\ConfigFormEventsHook;
use Icinga\Forms\ConfigForm;
use Icinga\Forms\Security\RoleForm;
class ConfigFormEvents extends ConfigFormEventsHook
{
public function appliesTo(ConfigForm $form)
{
return $form instanceof RoleForm;
}
public function onSuccess(ConfigForm $form)
{
$this->updateMyModuleConfig();
}
protected function updateMyModuleConfig()
{
// ...
}
}
```
--------------------------------
### Create Icinga Web 2 Database and User in MariaDB
Source: https://icinga.com/docs/icinga-web/latest/doc/02-Installation/01-Debian
SQL commands to create a dedicated database and a user with all privileges for Icinga Web 2. This is a prerequisite for the web setup wizard when using a local database.
```sql
MariaDB [mysql]> CREATE DATABASE icingaweb2;
MariaDB [mysql]> GRANT ALL ON icingaweb2.* TO icingaweb2@localhost IDENTIFIED BY 'CHANGEME';
```
--------------------------------
### Enable SCL Repository for Newer PHP
Source: https://icinga.com/docs/icinga-web/latest/doc/02-Installation/03-CentOS
Enable the Software Collections (SCL) repository to install a newer PHP version required by Icinga Web 2, as the default CentOS repositories may not have a recent enough version.
```bash
yum install centos-release-scl
```
--------------------------------
### Create Default User via Puppet Exec
Source: https://icinga.com/docs/icinga-web/latest/doc/20-Advanced-Topics
Example of creating a default user in Icinga Web 2 using a Puppet exec resource to run a MySQL command. Note that the '$' character needs to be escaped with a leading backslash in Puppet manifests.
```puppet
exec { 'create default user':
command => "mysql -h '${db_host}' -P '${db_port}' -u '${db_username}' -p'${db_password}' '${db_name}' -Ns -e 'INSERT INTO icingaweb_user (name, active, password_hash) VALUES \"icingaadmin\", 1, \"$2y$10$QnXfBjl1RE6TqJcY85ZKJuP9AvAV3ont9QihMTFQ/D/vHmAWaz.lG\"'",
refreshonly => true,
}
```
--------------------------------
### Add Icinga Package Repository on Debian
Source: https://icinga.com/docs/icinga-web/latest/doc/02-Installation/01-Debian
Updates package lists, installs necessary tools, downloads and installs the Icinga archive keyring, and adds the Icinga repository to APT sources. This ensures you can install the latest Icinga packages.
```bash
apt-get update
apt-get -y install apt-transport-https wget
wget -O icinga-archive-keyring.deb "https://packages.icinga.com/icinga-archive-keyring_latest+debian$(\
. /etc/os-release; echo "$VERSION_ID"
).deb"
apt-get install ./icinga-archive-keyring.deb
DIST=$(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.list
apt-get update
```
--------------------------------
### Configure Database Authentication Backend
Source: https://icinga.com/docs/icinga-web/latest/doc/05-Authentication
Set up database authentication by specifying `backend = db` and the `resource` name for your database connection in `resources.ini`. This allows authentication against MariaDB, MySQL, or PostgreSQL.
```ini
# vim /etc/icingaweb2/authentication.ini
[auth_db]
backend = db
resource = icingaweb-mysql
```
--------------------------------
### Save Apache Configuration and Enable (Debian Jessie)
Source: https://icinga.com/docs/icinga-web/latest/doc/02-Installation/07-From-Source
Redirect the generated Apache configuration to a file and enable the configuration for Apache on Debian Jessie.
```bash
./bin/icingacli setup config webserver apache --document-root /usr/share/icingaweb2/public > /etc/apache2/conf-available/icingaweb2.conf
a2enconf icingaweb2
```
--------------------------------
### Install EPEL Release on CentOS 7
Source: https://icinga.com/docs/icinga-web/latest/doc/02-Installation/03-CentOS
Install the Extra Packages for Enterprise Linux (EPEL) repository, which provides dependencies required by Icinga packages on CentOS 7.
```bash
yum install epel-release
```
--------------------------------
### Move Icinga Web 2 to Target Directory
Source: https://icinga.com/docs/icinga-web/latest/doc/02-Installation/07-From-Source
Move the extracted Icinga Web 2 source code to its final installation directory.
```bash
mv icingaweb2 /usr/share/icingaweb2
```
--------------------------------
### Translate Strings in Controller
Source: https://icinga.com/docs/icinga-web/latest/modules/translation/doc/03-Translation
Use the translate() method within your controller to get localized strings. The output depends on the configured default language.
```php
view->title = $this->translate('Hello World');
}
}
```
--------------------------------
### List Available PostgreSQL Upgrade Scripts
Source: https://icinga.com/docs/icinga-web/latest/doc/80-Upgrading
List the available PostgreSQL upgrade scripts in the specified directory to determine which version(s) need to be applied.
```bash
$ ls /usr/share/doc/icingaweb2/schema/pgsql-upgrades/
2.0.0beta3-2.0.0rc1.sql 2.5.0.sql
```
--------------------------------
### Configure LDAP Authentication Backend
Source: https://icinga.com/docs/icinga-web/latest/doc/05-Authentication
Set up an LDAP authentication backend by specifying `backend = ldap` and the `resource` name defined in `resources.ini`. Optional parameters include `user_class`, `user_name_attribute`, and a custom `filter`.
```ini
# vim /etc/icingaweb2/authentication.ini
[auth_ldap]
backend = ldap
resource = my_ldap
user_class = inetOrgPerson
user_name_attribute = uid
filter = "memberOf=cn=icinga_users,cn=groups,cn=accounts,dc=icinga,dc=org"
```
--------------------------------
### Create Icinga Web 2 Configuration Directory
Source: https://icinga.com/docs/icinga-web/latest/doc/02-Installation/07-From-Source
Use `icingacli` to create the default configuration directory for Icinga Web 2.
```bash
./bin/icingacli setup config directory
```
--------------------------------
### Configure Debug Logging to File
Source: https://icinga.com/docs/icinga-web/latest/doc/03-Configuration
Set up detailed debug logging to a file. Specify the 'log' type as 'file', set the 'level' to 'DEBUG', and provide the 'file' path for log storage.
```ini
[logging]
log = "file"
level = "DEBUG"
file = "/usr/share/icingaweb2/log/icingaweb2.log"
```
--------------------------------
### Configure Global Application Settings
Source: https://icinga.com/docs/icinga-web/latest/doc/03-Configuration
Set global application options like stack trace visibility, module paths, and the configuration resource. Ensure 'config_resource' is defined to specify where user preferences are stored.
```ini
[global]
show_stacktraces = "0"
config_resource = "icingaweb_db"
module_path = "/usr/share/icingaweb2/modules"
```
--------------------------------
### Configure Active Directory Authentication Backend
Source: https://icinga.com/docs/icinga-web/latest/doc/05-Authentication
Configure Active Directory authentication by setting `backend = msldap` and referencing the appropriate `resource` from `resources.ini`. Optional parameters like `user_class` and `user_name_attribute` can be specified.
```ini
# vim /etc/icingaweb2/authentication.ini
[auth_ad]
backend = msldap
resource = my_ad
```
--------------------------------
### Configure Nginx for Icinga Web 2
Source: https://icinga.com/docs/icinga-web/latest/doc/02-Installation/06-Amazon-Linux
Generate a sample Nginx configuration for Icinga Web 2. Save the output to a new file in your web server's configuration directory.
```bash
icingacli setup config webserver nginx --document-root /usr/share/icingaweb2/public
```
--------------------------------
### Add Icinga Package Repository for Ubuntu
Source: https://icinga.com/docs/icinga-web/latest/doc/02-Installation/02-Ubuntu
Adds the Icinga package repository to your Ubuntu system's package management configuration. This ensures you can install the latest Icinga packages.
```bash
apt-get update
apt-get -y install apt-transport-https wget
wget -O icinga-archive-keyring.deb "https://packages.icinga.com/icinga-archive-keyring_latest+ubuntu$(
. /etc/os-release; echo "$VERSION_ID"
).deb"
apt-get install ./icinga-archive-keyring.deb
. /etc/os-release; if [ ! -z ${UBUNTU_CODENAME+x} ]; then DIST="${UBUNTU_CODENAME}"; else DIST="$(lsb_release -c| awk '{print $2}')"; fi; \
echo "deb [signed-by=/usr/share/keyrings/icinga-archive-keyring.gpg] https://packages.icinga.com/ubuntu 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/ubuntu icinga-${DIST} main" >> \
/etc/apt/sources.list.d/${DIST}-icinga.list
apt-get update
```
--------------------------------
### Create Icinga Web 2 System Group (RHEL/Fedora/CentOS/SLES/OpenSUSE)
Source: https://icinga.com/docs/icinga-web/latest/doc/02-Installation/07-From-Source
Create a system group named 'icingaweb2' for managing permissions for Icinga Web 2.
```bash
groupadd -r icingaweb2
```
--------------------------------
### Save Apache Configuration (SUSE)
Source: https://icinga.com/docs/icinga-web/latest/doc/02-Installation/07-From-Source
Redirect the generated Apache configuration to a file in the web server's configuration directory for SUSE.
```bash
./bin/icingacli setup config webserver apache --document-root /usr/share/icingaweb2/public > /etc/apache2/conf.d/icingaweb2.conf
```
--------------------------------
### Enable Doc Module via CLI
Source: https://icinga.com/docs/icinga-web/latest/modules/doc/doc/02-Installation
Use this command to enable the Doc module from the command line interface.
```bash
icingacli module enable doc
```
--------------------------------
### Create Basic Auth User with htpasswd
Source: https://icinga.com/docs/icinga-web/latest/doc/05-Authentication
Generate basic authentication credentials for web server authentication using the `htpasswd` utility. The `-c` flag creates a new file, while omitting it appends to an existing file.
```bash
sudo htpasswd -c /etc/icingaweb2/.http-users icingaadmin
```
--------------------------------
### Save Apache Configuration (Alpine Linux)
Source: https://icinga.com/docs/icinga-web/latest/doc/02-Installation/07-From-Source
Redirect the generated Apache configuration to a file in the web server's configuration directory for Alpine Linux.
```bash
icingacli setup config webserver apache --document-root /usr/share/webapps/icingaweb2/public > /etc/apache2/conf.d/icingaweb2.conf
```
--------------------------------
### Add Icinga Package Repository for RHEL
Source: https://icinga.com/docs/icinga-web/latest/doc/02-Installation/04-RHEL
Download the Icinga release repository file. Ensure you replace placeholders with your subscription credentials.
```bash
wget https://packages.icinga.com/subscription/rhel/ICINGA-release.repo -O /etc/yum.repos.d/ICINGA-release.repo
```
--------------------------------
### Configure Monitoring Module Backends
Source: https://icinga.com/docs/icinga-web/latest/doc/20-Advanced-Topics
Reference the Icinga 2 DB IDO resource for the monitoring module in backends.ini.
```ini
vim /etc/icingaweb2/modules/monitoring/backends.ini
[icinga2]
type = "ido"
resource = "icinga2"
```
--------------------------------
### Manage PHP-FPM Services for Icinga Web 2.8.x Upgrade
Source: https://icinga.com/docs/icinga-web/latest/doc/80-Upgrading
Stop the old PHP-FPM service and start the new one when upgrading to Icinga Web 2 version 2.8.x on RHEL/CentOS 7 with PHP 7.3.
```bash
systemctl stop rh-php71-php-fpm.service
```
```bash
systemctl start rh-php73-php-fpm.service
```
--------------------------------
### Create Icinga Web 2 System Group (Debian/Ubuntu)
Source: https://icinga.com/docs/icinga-web/latest/doc/02-Installation/07-From-Source
Create a system group named 'icingaweb2' for managing permissions for Icinga Web 2 on Debian/Ubuntu systems.
```bash
addgroup --system icingaweb2
```
--------------------------------
### Add Web Server User to Icinga Web 2 Group and Restart (Debian/Ubuntu)
Source: https://icinga.com/docs/icinga-web/latest/doc/02-Installation/07-From-Source
Add the web server user ('www-data') to the 'icingaweb2' group and restart the Apache2 service.
```bash
usermod -a -G icingaweb2 www-data
service apache2 restart
```
--------------------------------
### List Process SELinux Contexts
Source: https://icinga.com/docs/icinga-web/latest/doc/90-SELinux
View the SELinux security contexts of running httpd processes. This helps in diagnosing access issues related to the web server.
```bash
ps -eZ | grep httpd
```
--------------------------------
### Add Apache User to Icinga Web 2 Group and Restart (SLES/OpenSUSE)
Source: https://icinga.com/docs/icinga-web/latest/doc/02-Installation/07-From-Source
Add the web server user ('wwwrun') to the 'icingaweb2' group and restart the Apache2 service.
```bash
usermod -A icingaweb2 wwwrun
service apache2 restart
```
--------------------------------
### Module Image Directory Structure
Source: https://icinga.com/docs/icinga-web/latest/modules/doc/doc/03-Module-Documentation
Images should be placed in the 'doc' directory within your module's root. The 'img' subdirectory is optional but recommended for organization.
```text
/path/to/icingaweb2/modules/example-module/doc/img/example.png
```
--------------------------------
### Generate Apache Web Server Configuration
Source: https://icinga.com/docs/icinga-web/latest/doc/02-Installation/07-From-Source
Use `icingacli` to generate Apache web server configuration for Icinga Web 2, specifying the document root.
```bash
./bin/icingacli setup config webserver apache --document-root /usr/share/icingaweb2/public
```
--------------------------------
### Generate Nginx Configuration for Icinga Web 2
Source: https://icinga.com/docs/icinga-web/latest/doc/02-Installation/05-SLES
Generates a sample Nginx configuration file for serving Icinga Web 2. Save the output to a new file in your Nginx configuration directory.
```bash
icingacli setup config webserver nginx --document-root /usr/share/icingaweb2/public
```
--------------------------------
### Configure Icinga Web 2 Database Resources
Source: https://icinga.com/docs/icinga-web/latest/doc/20-Advanced-Topics
Define database connection details for Icinga Web 2 and Icinga 2 IDO in resources.ini. Supports MySQL.
```ini
vim /etc/icingaweb2/resources.ini
[icingaweb2]
type = "db"
db = "mysql"
host = "localhost"
port = "3306"
dbname = "icingaweb2"
username = "icingaweb2"
password = "icingaweb2"
[icinga2]
type = "db"
db = "mysql"
host = "localhost"
port = "3306"
dbname = "icinga"
username = "icinga"
password = "icinga"
```
--------------------------------
### Add Web Server User to Icinga Web 2 Group and Restart (Alpine Linux)
Source: https://icinga.com/docs/icinga-web/latest/doc/02-Installation/07-From-Source
Add the Apache web server user to the 'icingaweb2' group and restart the Apache2 service.
```bash
gpasswd -a apache icingaweb2
rc-service apache2 restart
```
--------------------------------
### Configure Preferences Database Storage
Source: https://icinga.com/docs/icinga-web/latest/doc/07-Preferences
Define the database resource for preferences storage in the global config.ini file. This section must be added to enable database-backed preference management.
```ini
[global]
config_resource = "icingaweb_db"
```
--------------------------------
### Configure LDAP Resource
Source: https://icinga.com/docs/icinga-web/latest/doc/04-Resources
Defines an LDAP resource named '[ad]'. Ensure 'root_dn' and 'bind_dn' are correctly set for your directory structure and 'bind_pw' is the corresponding password.
```ini
[ad]
type = ldap
hostname = localhost
port = 389
root_dn = "ou=people,dc=icinga,dc=org"
bind_dn = "cn=admin,ou=people,dc=icinga,dc=org"
bind_pw = admin
```
--------------------------------
### Enable Strict Content Security Policy
Source: https://icinga.com/docs/icinga-web/latest/doc/03-Configuration
Configure security settings to enforce a strict Content Security Policy (CSP). Set 'use_strict_csp' to '1' to enable this feature.
```ini
[security]
use_strict_csp = "1"
```
--------------------------------
### Configure Icinga Web 2 Authentication
Source: https://icinga.com/docs/icinga-web/latest/doc/20-Advanced-Topics
Set up authentication backend, typically database-based, in authentication.ini.
```ini
vim /etc/icingaweb2/authentication.ini
[icingaweb2]
backend = "db"
resource = "icingaweb2"
```
--------------------------------
### Icinga Web 2 Configuration Directory Structure
Source: https://icinga.com/docs/icinga-web/latest/doc/20-Advanced-Topics
Illustrates the typical directory structure for Icinga Web 2 configuration files.
```text
/etc/icingaweb2/
/etc/icingaweb2/authentication.ini
/etc/icingaweb2/modules
/etc/icingaweb2/modules/monitoring
/etc/icingaweb2/modules/monitoring/config.ini
/etc/icingaweb2/modules/monitoring/instances.ini
/etc/icingaweb2/modules/monitoring/backends.ini
/etc/icingaweb2/roles.ini
/etc/icingaweb2/config.ini
/etc/icingaweb2/enabledModules
/etc/icingaweb2/enabledModules/monitoring
/etc/icingaweb2/enabledModules/doc
/etc/icingaweb2/resources.ini
```
--------------------------------
### Add Icinga Package Repository for Amazon Linux
Source: https://icinga.com/docs/icinga-web/latest/doc/02-Installation/06-Amazon-Linux
Download the Icinga release repository file. Ensure you replace username and password with your credentials.
```bash
wget https://packages.icinga.com/subscription/amazon/ICINGA-release.repo -O /etc/yum.repos.d/ICINGA-release.repo
```
--------------------------------
### Configure Apache for Basic Authentication
Source: https://icinga.com/docs/icinga-web/latest/doc/05-Authentication
Set up Apache to use Basic Authentication by specifying `AuthType`, `AuthName`, `AuthUserFile`, and `Require valid-user` within the `` directive of your `icingaweb2.conf`.
```apache
AuthType Basic
AuthName "Icinga Web 2"
AuthUserFile /etc/icingaweb2/.http-users
Require valid-user
```
--------------------------------
### Configure Icinga Web 2 General Settings
Source: https://icinga.com/docs/icinga-web/latest/doc/20-Advanced-Topics
Set general application settings, including logging and preferences, in config.ini.
```ini
vim /etc/icingaweb2/config.ini
[logging]
log = "syslog"
level = "ERROR"
application = "icingaweb2"
[preferences]
type = "db"
resource = "icingaweb2"
```
--------------------------------
### Generate Nginx Web Server Configuration
Source: https://icinga.com/docs/icinga-web/latest/doc/02-Installation/07-From-Source
Use `icingacli` to generate Nginx web server configuration for Icinga Web 2, specifying the document root.
```bash
./bin/icingacli setup config webserver nginx --document-root /usr/share/icingaweb2/public
```
--------------------------------
### Migrate Dashboard Configuration
Source: https://icinga.com/docs/icinga-web/latest/doc/80-Upgrading
Use this CLI command to assist with updating dashboard.ini files when upgrading to Icinga Web 2 version 2.7.x, especially for non-English languages.
```bash
icingacli migrate dashboard sections --verbose
```
--------------------------------
### Add Apache User to Icinga Web 2 Group and Restart (RHEL/CentOS)
Source: https://icinga.com/docs/icinga-web/latest/doc/02-Installation/07-From-Source
Add the Apache web server user to the 'icingaweb2' group and restart the HTTPD service.
```bash
usermod -a -G icingaweb2 apache
service httpd restart
```
--------------------------------
### Ordering Documentation Chapters
Source: https://icinga.com/docs/icinga-web/latest/modules/doc/doc/03-Module-Documentation
Prefix Markdown documentation file names with numbers to ensure they are ordered correctly in the table of contents. This uses natural sorting for human-readable ordering.
```text
01-About.md
02-Installation.md
03-Configuration.md
```