2017-07-12 20:46:12 +02:00
# Getting Started <a id="getting-started"></a>
2014-05-04 11:25:12 +02:00
2017-07-12 20:46:12 +02:00
This tutorial is a step-by-step introduction to installing [Icinga 2 ](02-getting-started.md#setting-up-icinga2 )
and [Icinga Web 2 ](02-getting-started.md#setting-up-icingaweb2 ).
2015-09-25 11:32:34 +02:00
It assumes that you are familiar with the operating system you're using to install Icinga 2.
2014-05-23 01:01:06 +02:00
2017-11-07 16:07:30 +01:00
In case you are upgrading an existing setup, please ensure to
follow the [upgrade documentation ](16-upgrading-icinga-2.md#upgrading-icinga-2 ).
2017-07-12 20:46:12 +02:00
## Setting up Icinga 2 <a id="setting-up-icinga2"></a>
2014-05-04 11:25:12 +02:00
2017-05-30 13:38:19 +02:00
First off you have to install Icinga 2. The preferred way of doing this
2014-07-21 20:22:48 +02:00
is to use the official package repositories depending on which operating system
and distribution you are running.
2014-05-04 11:25:12 +02:00
2019-03-19 12:08:19 +01:00
Official repositories ([support matrix](https://icinga.com/support/details/)):
2014-07-21 20:22:48 +02:00
Distribution | Repository
2014-05-04 11:25:12 +02:00
------------------------|---------------------------
2017-06-19 17:06:20 +02:00
Debian | [Icinga Repository ](https://packages.icinga.com/debian/ )
Ubuntu | [Icinga Repository ](https://packages.icinga.com/ubuntu/ )
2019-03-19 12:08:19 +01:00
Raspbian | [Icinga Repository ](https://packages.icinga.com/raspbian/ )
2017-04-06 22:03:48 +02:00
RHEL/CentOS | [Icinga Repository ](https://packages.icinga.com/epel/ )
2017-06-19 17:06:20 +02:00
openSUSE | [Icinga Repository ](https://packages.icinga.com/openSUSE/ )
2017-04-06 22:03:48 +02:00
SLES | [Icinga Repository ](https://packages.icinga.com/SUSE/ )
2019-03-19 12:08:19 +01:00
Community repositories:
Distribution | Repository
------------------------|---------------------------
2017-04-06 22:03:48 +02:00
Gentoo | [Upstream ](https://packages.gentoo.org/package/net-analyzer/icinga2 )
FreeBSD | [Upstream ](https://www.freshports.org/net-mgmt/icinga2 )
2017-02-07 13:49:22 +01:00
OpenBSD | [Upstream ](http://ports.su/net/icinga/core2,-main )
2014-07-21 20:22:48 +02:00
ArchLinux | [Upstream ](https://aur.archlinux.org/packages/icinga2 )
2017-08-10 15:29:22 +02:00
Alpine Linux | [Upstream ](https://pkgs.alpinelinux.org/package/edge/community/x86_64/icinga2 )
2014-05-04 11:25:12 +02:00
Packages for distributions other than the ones listed above may also be
2014-07-21 20:22:48 +02:00
available. Please contact your distribution packagers.
2014-05-04 11:25:12 +02:00
2017-07-12 20:46:12 +02:00
### Package Repositories <a id="package-repositories"></a>
2014-08-27 16:30:35 +02:00
You need to add the Icinga repository to your package management configuration.
2018-04-25 14:29:41 +02:00
The following commands must be executed with `root` permissions unless noted otherwise.
2014-08-27 16:30:35 +02:00
2019-03-19 12:08:19 +01:00
#### Debian/Ubuntu/Raspbian Repositories <a id="package-repositories-debian-ubuntu-raspbian"></a>
2017-01-10 15:54:22 +01:00
Debian:
2014-09-04 17:02:30 +02:00
2018-04-25 14:29:41 +02:00
```
apt-get -y install apt-transport-https
wget -O - https://packages.icinga.com/icinga.key | apt-key add -
2019-03-19 12:08:19 +01:00
DIST=$(awk -F"[)(]+" '/VERSION=/ {print $2}' /etc/os-release); \
echo "deb https://packages.icinga.com/debian icinga-${DIST} main" > \
/etc/apt/sources.list.d/${DIST}-icinga.list
echo "deb-src https://packages.icinga.com/debian icinga-${DIST} main" >> \
/etc/apt/sources.list.d/${DIST}-icinga.list
2018-04-25 14:29:41 +02:00
apt-get update
```
2014-08-27 16:30:35 +02:00
2017-01-10 15:54:22 +01:00
Ubuntu:
2014-09-04 17:02:30 +02:00
2018-04-25 14:29:41 +02:00
```
apt-get -y install apt-transport-https
wget -O - https://packages.icinga.com/icinga.key | apt-key add -
2014-08-27 16:30:35 +02:00
2019-03-19 12:08:19 +01:00
. /etc/os-release; if [ ! -z ${UBUNTU_CODENAME+x} ]; then DIST="${UBUNTU_CODENAME}"; else DIST="$(lsb_release -c| awk '{print $2}')"; fi; \
echo "deb https://packages.icinga.com/ubuntu icinga-${DIST} main" > \
/etc/apt/sources.list.d/${DIST}-icinga.list
echo "deb-src https://packages.icinga.com/ubuntu icinga-${DIST} main" >> \
/etc/apt/sources.list.d/${DIST}-icinga.list
2014-09-04 17:02:30 +02:00
2019-03-19 12:08:19 +01:00
apt-get update
2018-04-25 14:29:41 +02:00
```
2016-03-23 11:16:38 +01:00
2019-03-19 12:08:19 +01:00
Raspbian:
2016-03-23 11:16:38 +01:00
2018-04-25 14:29:41 +02:00
```
2019-03-19 12:08:19 +01:00
apt-get -y install apt-transport-https
2016-03-23 11:16:38 +01:00
2019-03-19 12:08:19 +01:00
wget -O - https://packages.icinga.com/icinga.key | apt-key add -
2016-03-23 11:16:38 +01:00
2019-03-19 12:08:19 +01:00
DIST=$(awk -F"[)(]+" '/VERSION=/ {print $2}' /etc/os-release); \
echo "deb https://packages.icinga.com/raspbian icinga-${DIST} main" > \
/etc/apt/sources.list.d/icinga.list
echo "deb-src https://packages.icinga.com/raspbian icinga-${DIST} main" >> \
/etc/apt/sources.list.d/icinga.list
2016-03-23 11:16:38 +01:00
2019-03-19 12:08:19 +01:00
apt-get update
2018-04-25 14:29:41 +02:00
```
2015-02-03 13:23:50 +01:00
2019-03-19 12:08:19 +01:00
#### RHEL/CentOS/Fedora Repositories <a id="package-repositories-rhel-centos-fedora"></a>
2015-02-03 13:23:50 +01:00
2019-03-19 12:08:19 +01:00
RHEL/CentOS 7:
2014-09-04 17:02:30 +02:00
2018-04-25 14:29:41 +02:00
```
2019-03-19 12:08:19 +01:00
yum install https://packages.icinga.com/epel/icinga-rpm-release-7-latest.noarch.rpm
2018-04-25 14:29:41 +02:00
```
2014-08-27 16:30:35 +02:00
2019-03-19 12:08:19 +01:00
RHEL/CentOS 6:
2014-09-04 17:02:30 +02:00
2018-04-25 14:29:41 +02:00
```
2019-03-19 12:08:19 +01:00
yum install https://packages.icinga.com/epel/icinga-rpm-release-6-latest.noarch.rpm
2018-04-25 14:29:41 +02:00
```
2016-08-20 14:51:05 +02:00
2019-03-19 12:08:19 +01:00
Fedora 29:
2017-08-10 15:29:22 +02:00
2018-04-25 14:29:41 +02:00
```
2019-03-19 12:08:19 +01:00
dnf install https://packages.icinga.com/fedora/icinga-rpm-release-29-latest.noarch.rpm
2018-04-25 14:29:41 +02:00
```
2017-08-10 15:29:22 +02:00
2017-07-12 20:46:12 +02:00
#### RHEL/CentOS EPEL Repository <a id="package-repositories-rhel-epel"></a>
2016-08-20 14:51:05 +02:00
The packages for RHEL/CentOS depend on other packages which are distributed
2017-04-06 22:03:48 +02:00
as part of the [EPEL repository ](https://fedoraproject.org/wiki/EPEL ).
2016-08-20 14:51:05 +02:00
2017-05-30 13:38:19 +02:00
CentOS 7/6:
2016-08-20 14:51:05 +02:00
2018-04-25 14:29:41 +02:00
```
yum install epel-release
```
2016-08-20 14:51:05 +02:00
2017-10-30 17:02:42 +01:00
If you are using RHEL you need to enable the `optional` repository and then install
2017-04-06 22:03:48 +02:00
the [EPEL rpm package ](https://fedoraproject.org/wiki/EPEL#How_can_I_use_these_extra_packages.3F ).
2016-08-20 14:51:05 +02:00
2018-04-25 14:29:41 +02:00
```
subscription-manager repos --enable rhel-7-server-optional-rpms
# or
subscription-manager repos --enable rhel-6-server-optional-rpms
```
2019-03-19 12:08:19 +01:00
#### SLES/OpenSUSE Repositories <a id="package-repositories-sles-opensuse"></a>
SLES 15/12:
```
rpm --import https://packages.icinga.com/icinga.key
zypper ar https://packages.icinga.com/SUSE/ICINGA-release.repo
zypper ref
```
SLES 11:
```
rpm --import https://packages.icinga.com/icinga.key
zypper ar https://packages.icinga.com/SUSE/ICINGA-release-11.repo
zypper ref
```
openSUSE:
```
rpm --import https://packages.icinga.com/icinga.key
zypper ar https://packages.icinga.com/openSUSE/ICINGA-release.repo
zypper ref
```
2017-07-12 20:46:12 +02:00
#### SLES Security Repository <a id="package-repositories-sles-security"></a>
2016-08-20 14:51:05 +02:00
The packages for SLES 11 depend on the `openssl1` package which is distributed
as part of the [SLES 11 Security Module ](https://www.suse.com/communities/conversations/introducing-the-suse-linux-enterprise-11-security-module/ ).
2017-07-12 20:46:12 +02:00
#### SLES 12 SDK <a id="package-sles-sdk"></a>
2017-01-09 16:37:59 +01:00
2017-06-18 12:36:07 +02:00
Icinga 2 requires the `libboost_chrono1_54_0` package from the `SLES 12 SDK` repository. Refer to the SUSE Enterprise
2017-01-09 16:37:59 +01:00
Linux documentation for further information.
2019-03-19 12:08:19 +01:00
#### Alpine Linux Repositories <a id="package-repositories-alpine"></a>
Alpine Linux:
```
echo "http://dl-cdn.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories
echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories
apk update
```
2017-08-10 15:29:22 +02:00
2017-10-30 17:02:42 +01:00
The example provided assumes that you are running Alpine edge, which is the -dev branch and is a rolling release.
2017-08-10 15:29:22 +02:00
If you are using a stable version please "pin" the edge repository on the latest Icinga 2 package version.
In order to correctly manage your repository, please follow
[these instructions ](https://wiki.alpinelinux.org/wiki/Alpine_Linux_package_management )
2017-07-12 20:46:12 +02:00
### Installing Icinga 2 <a id="installing-icinga2"></a>
2014-05-04 11:25:12 +02:00
You can install Icinga 2 by using your distribution's package manager
2018-04-25 14:29:41 +02:00
to install the `icinga2` package. The following commands must be executed
with `root` permissions unless noted otherwise.
2014-05-04 11:25:12 +02:00
2014-08-27 16:30:35 +02:00
Debian/Ubuntu:
2014-09-04 17:02:30 +02:00
2018-04-25 14:29:41 +02:00
```
apt-get install icinga2
```
2014-08-27 16:30:35 +02:00
2019-03-19 12:08:19 +01:00
RHEL/CentOS 7 and Fedora:
2014-09-04 17:02:30 +02:00
2018-04-25 14:29:41 +02:00
```
yum install icinga2
2019-03-19 12:08:19 +01:00
systemctl enable icinga2
systemctl start icinga2
2018-04-25 14:29:41 +02:00
```
2014-08-27 16:30:35 +02:00
2019-03-19 12:08:19 +01:00
RHEL/CentOS 6:
2014-05-04 11:25:12 +02:00
2018-04-25 14:29:41 +02:00
```
yum install icinga2
2019-03-19 12:08:19 +01:00
chkconfig icinga2 on
service icinga2 start
2018-04-25 14:29:41 +02:00
```
2014-08-27 16:30:35 +02:00
2015-01-26 14:40:27 +01:00
SLES/openSUSE:
2018-04-25 14:29:41 +02:00
```
zypper install icinga2
```
2015-01-26 14:40:27 +01:00
2015-10-05 13:49:49 +02:00
FreeBSD:
2018-04-25 14:29:41 +02:00
```
pkg install icinga2
```
2017-08-10 15:29:22 +02:00
Alpine Linux:
2018-04-25 14:29:41 +02:00
```
apk add icinga2
```
2017-08-10 15:29:22 +02:00
2017-07-12 20:46:12 +02:00
### Enabled Features during Installation <a id="installation-enabled-features"></a>
2014-05-29 15:34:01 +02:00
The default installation will enable three features required for a basic
Icinga 2 installation:
* `checker` for executing checks
* `notification` for sending notifications
2014-11-02 21:46:02 +01:00
* `mainlog` for writing the `icinga2.log` file
2014-05-29 15:34:01 +02:00
2015-02-06 15:08:51 +01:00
You can verify that by calling `icinga2 feature list`
2016-08-13 15:59:06 +02:00
[CLI command ](11-cli-commands.md#cli-command-feature ) to see which features are
2015-02-06 15:08:51 +01:00
enabled and disabled.
2014-05-29 15:34:01 +02:00
2018-04-25 14:29:41 +02:00
```
# icinga2 feature list
Disabled features: api command compatlog debuglog gelf graphite icingastatus ido-mysql ido-pgsql influxdb livestatus opentsdb perfdata statusdata syslog
Enabled features: checker mainlog notification
```
2014-11-02 21:46:02 +01:00
2017-07-12 20:46:12 +02:00
### Installation Paths <a id="installation-paths"></a>
2014-05-04 11:25:12 +02:00
By default Icinga 2 uses the following files and directories:
2016-12-12 11:34:21 +01:00
Path | Description
----------------------------------------------|------------------------------------
/etc/icinga2 | Contains Icinga 2 configuration files.
2019-02-26 14:46:22 +01:00
/usr/lib/systemd/system/icinga2.service | The Icinga 2 systemd service file on systems using systemd.
/etc/systemd/system/icinga2.service.d/limits.conf | On distributions with systemd >227, additional service limits are required.
2017-10-30 17:02:42 +01:00
/etc/init.d/icinga2 | The Icinga 2 init script on systems using SysVinit or OpenRC.
2016-12-12 11:34:21 +01:00
/usr/sbin/icinga2 | Shell wrapper for the Icinga 2 binary.
/usr/lib\*/icinga2 | Libraries and the Icinga 2 binary (use `find /usr -type f -name icinga2` to locate the binary path).
/usr/share/doc/icinga2 | Documentation files that come with Icinga 2.
/usr/share/icinga2/include | The Icinga Template Library and plugin command configuration.
2017-10-16 15:32:57 +02:00
/var/lib/icinga2 | Icinga 2 state file, cluster log, master CA, node certificates and configuration files (cluster, api).
2016-12-12 11:34:21 +01:00
/var/run/icinga2 | PID file.
/var/run/icinga2/cmd | Command pipe and Livestatus socket.
2017-10-30 17:02:42 +01:00
/var/cache/icinga2 | status.dat/objects.cache, icinga2.debug files.
2016-12-12 11:34:21 +01:00
/var/spool/icinga2 | Used for performance data spool files.
/var/log/icinga2 | Log file location and compat/ directory for the CompatLogger feature.
2014-05-04 11:25:12 +02:00
2015-10-05 13:49:49 +02:00
FreeBSD uses slightly different paths:
By default Icinga 2 uses the following files and directories:
Path | Description
------------------------------------|------------------------------------
/usr/local/etc/icinga2 | Contains Icinga 2 configuration files.
/usr/local/etc/rc.d/icinga2 | The Icinga 2 init script.
2016-12-12 11:34:21 +01:00
/usr/local/sbin/icinga2 | Shell wrapper for the Icinga 2 binary.
/usr/local/lib/icinga2 | Libraries and the Icinga 2 binary.
2015-10-05 13:49:49 +02:00
/usr/local/share/doc/icinga2 | Documentation files that come with Icinga 2.
/usr/local/share/icinga2/include | The Icinga Template Library and plugin command configuration.
2017-10-16 15:32:57 +02:00
/var/lib/icinga2 | Icinga 2 state file, cluster log, master CA, node certificates and configuration files (cluster, api).
2015-10-05 13:49:49 +02:00
/var/run/icinga2 | PID file.
/var/run/icinga2/cmd | Command pipe and Livestatus socket.
2017-10-30 17:02:42 +01:00
/var/cache/icinga2 | status.dat/objects.cache, icinga2.debug files.
2015-10-05 13:49:49 +02:00
/var/spool/icinga2 | Used for performance data spool files.
/var/log/icinga2 | Log file location and compat/ directory for the CompatLogger feature.
2017-07-12 20:46:12 +02:00
## Setting up Check Plugins <a id="setting-up-check-plugins"></a>
2014-08-27 16:30:35 +02:00
Without plugins Icinga 2 does not know how to check external services. The
[Monitoring Plugins Project ](https://www.monitoring-plugins.org/ ) provides
an extensive set of plugins which can be used with Icinga 2 to check whether
services are working properly.
2017-07-12 20:46:12 +02:00
These plugins are required to make the [example configuration ](04-configuring-icinga-2.md#configuring-icinga2-overview )
2016-06-28 17:48:08 +02:00
work out-of-the-box.
2014-08-27 16:30:35 +02:00
For your convenience here is a list of package names for some of the more
popular operating systems/distributions:
2015-12-09 15:33:31 +01:00
OS/Distribution | Package Name | Repository | Installation Path
-----------------------|--------------------|---------------------------|----------------------------
2017-04-06 22:03:48 +02:00
RHEL/CentOS | nagios-plugins-all | [EPEL ](https://fedoraproject.org/wiki/EPEL ) | /usr/lib/nagios/plugins or /usr/lib64/nagios/plugins
2015-12-09 15:33:31 +01:00
SLES/OpenSUSE | monitoring-plugins | [server:monitoring ](https://build.opensuse.org/project/repositories/server:monitoring ) | /usr/lib/nagios/plugins
2017-06-01 18:47:00 +02:00
Debian/Ubuntu | monitoring-plugins | - | /usr/lib/nagios/plugins
2015-12-09 15:33:31 +01:00
FreeBSD | monitoring-plugins | - | /usr/local/libexec/nagios
2017-08-10 15:29:22 +02:00
Alpine Linux | monitoring-plugins | - | /usr/lib/monitoring-plugins
2019-03-19 12:08:19 +01:00
macOS | monitoring-plugins | [MacPorts ](https://www.macports.org ), [Homebrew ](https://brew.sh ) | /opt/local/libexec or /usr/local/sbin
2014-08-27 16:30:35 +02:00
2015-12-18 14:33:55 +01:00
The recommended way of installing these standard plugins is to use your
distribution's package manager.
Debian/Ubuntu:
2018-04-25 14:29:41 +02:00
```
apt-get install monitoring-plugins
```
2015-12-18 14:33:55 +01:00
RHEL/CentOS:
2018-04-25 14:29:41 +02:00
```
yum install nagios-plugins-all
```
2015-12-18 14:33:55 +01:00
The packages for RHEL/CentOS depend on other packages which are distributed
2019-03-26 09:46:36 +01:00
as part of the [EPEL repository ](02-getting-started.md#package-repositories-rhel-epel ).
2015-12-18 14:33:55 +01:00
Fedora:
2018-04-25 14:29:41 +02:00
```
dnf install nagios-plugins-all
```
2015-12-18 14:33:55 +01:00
SLES/openSUSE:
2018-04-25 14:29:41 +02:00
```
zypper install monitoring-plugins
```
2015-12-18 14:33:55 +01:00
The packages for SLES/OpenSUSE depend on other packages which are distributed
as part of the [server:monitoring repository ](https://build.opensuse.org/project/repositories/server:monitoring ).
Please make sure to enable this repository beforehand.
FreeBSD:
2018-04-25 14:29:41 +02:00
```
pkg install monitoring-plugins
```
2015-12-18 14:33:55 +01:00
2017-08-10 15:29:22 +02:00
Alpine Linux:
2018-04-25 14:29:41 +02:00
```
apk add monitoring-plugins
```
2017-08-10 15:29:22 +02:00
Note: For Alpine you don't need to explicitly add the `monitoring-plugins` package since it is a dependency of
`icinga2` and is pulled automatically.
2014-08-27 16:30:35 +02:00
Depending on which directory your plugins are installed into you may need to
2017-07-12 20:46:12 +02:00
update the global `PluginDir` constant in your [Icinga 2 configuration ](04-configuring-icinga-2.md#constants-conf ).
2015-01-26 14:40:27 +01:00
This constant is used by the check command definitions contained in the Icinga Template Library
2015-01-23 14:15:57 +01:00
to determine where to find the plugin binaries.
2014-08-27 16:30:35 +02:00
2015-12-18 14:33:55 +01:00
> **Note**
>
2017-07-12 20:46:12 +02:00
> Please refer to the [service monitoring](05-service-monitoring.md#service-monitoring-plugins) chapter for details about how to integrate
2015-12-18 14:33:55 +01:00
> additional check plugins into your Icinga 2 setup.
2014-08-27 16:30:35 +02:00
2017-07-12 20:46:12 +02:00
## Running Icinga 2 <a id="running-icinga2"></a>
2015-01-26 14:40:27 +01:00
2017-09-23 15:16:00 +02:00
### Systemd Service <a id="systemd-service"></a>
2015-01-26 14:40:27 +01:00
2019-02-26 14:46:22 +01:00
Some distributions (e.g. Fedora, openSUSE and RHEL/CentOS 7) use systemd. The
Icinga 2 packages automatically install the necessary systemd unit files.
2015-01-26 14:40:27 +01:00
2019-02-26 14:46:22 +01:00
The Icinga 2 systemd service can be (re-)started, reloaded, stopped and also
2015-02-06 15:08:51 +01:00
queried for its current status.
2015-01-26 14:40:27 +01:00
2018-04-25 14:29:41 +02:00
```
# systemctl status icinga2
icinga2.service - Icinga host/service/network monitoring system
Loaded: loaded (/usr/lib/systemd/system/icinga2.service; disabled)
Active: active (running) since Mi 2014-07-23 13:39:38 CEST; 15s ago
Process: 21692 ExecStart=/usr/sbin/icinga2 -c ${ICINGA2_CONFIG_FILE} -d -e ${ICINGA2_ERROR_LOG} -u ${ICINGA2_USER} -g ${ICINGA2_GROUP} (code=exited, status=0/SUCCESS)
Process: 21674 ExecStartPre=/usr/sbin/icinga2-prepare-dirs /etc/sysconfig/icinga2 (code=exited, status=0/SUCCESS)
Main PID: 21727 (icinga2)
CGroup: /system.slice/icinga2.service
21727 /usr/sbin/icinga2 -c /etc/icinga2/icinga2.conf -d -e /var/log/icinga2/error.log -u icinga -g icinga --no-stack-rlimit
Jul 23 13:39:38 nbmif icinga2[21692]: [2014-07-23 13:39:38 +0200] information/ConfigItem: Checked 309 Service(s).
Jul 23 13:39:38 nbmif icinga2[21692]: [2014-07-23 13:39:38 +0200] information/ConfigItem: Checked 1 User(s).
Jul 23 13:39:38 nbmif icinga2[21692]: [2014-07-23 13:39:38 +0200] information/ConfigItem: Checked 15 Notification(s).
Jul 23 13:39:38 nbmif icinga2[21692]: [2014-07-23 13:39:38 +0200] information/ConfigItem: Checked 4 ScheduledDowntime(s).
Jul 23 13:39:38 nbmif icinga2[21692]: [2014-07-23 13:39:38 +0200] information/ConfigItem: Checked 1 UserGroup(s).
Jul 23 13:39:38 nbmif icinga2[21692]: [2014-07-23 13:39:38 +0200] information/ConfigItem: Checked 1 IcingaApplication(s).
Jul 23 13:39:38 nbmif icinga2[21692]: [2014-07-23 13:39:38 +0200] information/ConfigItem: Checked 8 Dependency(s).
Jul 23 13:39:38 nbmif systemd[1]: Started Icinga host/service/network monitoring system.
```
2015-01-26 14:40:27 +01:00
The `systemctl` command supports the following actions:
Command | Description
--------------------|------------------------
start | The `start` action starts the Icinga 2 daemon.
stop | The `stop` action stops the Icinga 2 daemon.
restart | The `restart` action is a shortcut for running the `stop` action followed by `start` .
reload | The `reload` action sends the `HUP` signal to Icinga 2 which causes it to restart. Unlike the `restart` action `reload` does not wait until Icinga 2 has restarted.
status | The `status` action checks if Icinga 2 is running.
enable | The `enable` action enables the service being started at system boot time (similar to `chkconfig` )
Examples:
2018-04-25 14:29:41 +02:00
```
# systemctl enable icinga2
2015-01-26 14:40:27 +01:00
2018-04-25 14:29:41 +02:00
# systemctl restart icinga2
Job for icinga2.service failed. See 'systemctl status icinga2.service' and 'journalctl -xn' for details.
```
2015-01-26 14:40:27 +01:00
2015-02-06 15:08:51 +01:00
If you're stuck with configuration errors, you can manually invoke the
2016-08-13 15:59:06 +02:00
[configuration validation ](11-cli-commands.md#config-validation ).
2015-01-26 14:40:27 +01:00
2018-04-25 14:29:41 +02:00
> **Tip**
>
2019-02-26 14:46:22 +01:00
> If you are running into fork errors with systemd enabled distributions,
2018-04-25 14:29:41 +02:00
> please check the [troubleshooting chapter](15-troubleshooting.md#check-fork-errors).
2017-11-15 01:03:15 +01:00
2018-04-25 14:29:41 +02:00
### Init Script <a id="init-script"></a>
2017-11-15 01:03:15 +01:00
2018-04-25 14:29:41 +02:00
Icinga 2's init script is installed in `/etc/init.d/icinga2` (`/usr/local/etc/rc.d/icinga2` on FreeBSD) by default:
2018-01-17 13:52:23 +01:00
2018-04-25 14:29:41 +02:00
```
# /etc/init.d/icinga2
Usage: /etc/init.d/icinga2 {start|stop|restart|reload|checkconfig|status}
```
2018-01-17 13:52:23 +01:00
2018-04-25 14:29:41 +02:00
The init script supports the following actions:
2018-01-17 13:52:23 +01:00
2018-04-25 14:29:41 +02:00
Command | Description
--------------------|------------------------
start | The `start` action starts the Icinga 2 daemon.
stop | The `stop` action stops the Icinga 2 daemon.
restart | The `restart` action is a shortcut for running the `stop` action followed by `start` .
reload | The `reload` action sends the `HUP` signal to Icinga 2 which causes it to restart. Unlike the `restart` action `reload` does not wait until Icinga 2 has restarted.
checkconfig | The `checkconfig` action checks if the `/etc/icinga2/icinga2.conf` configuration file contains any errors.
status | The `status` action checks if Icinga 2 is running.
By default, the Icinga 2 daemon is running as `icinga` user and group
using the init script. Using Debian packages the user and group are set to
`nagios` for historical reasons.
2017-11-15 01:03:15 +01:00
2017-09-23 15:16:00 +02:00
2017-09-29 10:41:01 +02:00
### FreeBSD <a id="running-icinga2-freebsd"></a>
2015-10-05 13:49:49 +02:00
On FreeBSD you need to enable icinga2 in your rc.conf
2018-04-25 14:29:41 +02:00
```
# sysrc icinga2_enable=yes
2015-03-07 15:52:56 +01:00
2018-04-25 14:29:41 +02:00
# service icinga2 restart
```
2017-09-29 10:41:01 +02:00
### SELinux <a id="running-icinga2-selinux"></a>
SELinux is a mandatory access control (MAC) system on Linux which adds
a fine-grained permission system for access to all system resources such
as files, devices, networks and inter-process communication.
Icinga 2 provides its own SELinux policy. `icinga2-selinux` is a policy package
for Red Hat Enterprise Linux 7 and derivatives. The package runs the targeted policy
which confines Icinga 2 including enabled features and running commands.
RHEL/CentOS 7:
```
yum install icinga2-selinux
```
Fedora:
```
dnf install icinga2-selinux
```
Read more about SELinux in [this chapter ](22-selinux.md#selinux ).
2017-07-12 20:46:12 +02:00
## Configuration Syntax Highlighting <a id="configuration-syntax-highlighting"></a>
2015-03-07 15:52:56 +01:00
2018-04-25 14:29:41 +02:00
Icinga 2 provides configuration examples for syntax highlighting using the `vim` and `nano` editors.
2016-04-15 18:09:09 +02:00
The RHEL and SUSE package `icinga2-common` installs these files into `/usr/share/doc/icinga2-common-[x.x.x]/syntax`
(where `[x.x.x]` is the version number, e.g. `2.4.3` or `2.4.4` ). Sources provide these files in `tools/syntax` .
On Debian systems the `icinga2-common` package provides only the Nano configuration file (`/usr/share/nano/icinga2.nanorc`);
to obtain the Vim configuration, please install the extra package `vim-icinga2` . The files are located in `/usr/share/vim/addons` .
2015-03-07 15:52:56 +01:00
2017-07-12 20:46:12 +02:00
### Configuration Syntax Highlighting using Vim <a id="configuration-syntax-highlighting-vim"></a>
2015-03-07 15:52:56 +01:00
2016-06-17 14:16:17 +02:00
Install the package `vim-icinga2` with your distribution's package manager.
2015-03-07 15:52:56 +01:00
2015-04-28 19:14:05 +02:00
Debian/Ubuntu:
2018-04-25 14:29:41 +02:00
```
apt-get install vim-icinga2 vim-addon-manager
vim-addon-manager -w install icinga2
Info: installing removed addon 'icinga2' to /var/lib/vim/addons
```
2016-04-15 18:09:09 +02:00
2015-04-28 19:14:05 +02:00
RHEL/CentOS/Fedora:
2016-04-15 18:09:09 +02:00
2018-04-25 14:29:41 +02:00
```
yum install vim-icinga2
```
2015-04-28 19:14:05 +02:00
SLES/openSUSE:
2016-04-15 18:09:09 +02:00
2018-04-25 14:29:41 +02:00
```
zypper install vim-icinga2
```
2015-03-07 15:52:56 +01:00
2017-08-10 15:29:22 +02:00
Alpine Linux:
2018-04-25 14:29:41 +02:00
```
apk add icinga2-vim
```
2016-06-17 14:16:17 +02:00
Ensure that syntax highlighting is enabled e.g. by editing the user's `vimrc`
configuration file:
2018-04-25 14:29:41 +02:00
```
# vim ~/.vimrc
syntax on
```
2016-06-17 14:16:17 +02:00
2015-03-07 15:52:56 +01:00
Test it:
2018-04-25 14:29:41 +02:00
```
# vim /etc/icinga2/conf.d/templates.conf
```
2015-03-07 15:52:56 +01:00
2016-04-15 18:09:09 +02:00
![Vim with syntax highlighting ](images/getting-started/vim-syntax.png "Vim with Icinga 2 syntax highlighting" )
2017-07-12 20:46:12 +02:00
### Configuration Syntax Highlighting using Nano <a id="configuration-syntax-highlighting-nano"></a>
2015-03-07 15:52:56 +01:00
2016-06-17 14:16:17 +02:00
Install the package `nano-icinga2` with your distribution's package manager.
Debian/Ubuntu:
2015-04-28 19:14:05 +02:00
2016-06-17 14:16:17 +02:00
**Note:** The syntax files are installed with the `icinga2-common` package already.
2015-04-28 19:14:05 +02:00
RHEL/CentOS/Fedora:
2018-04-25 14:29:41 +02:00
```
yum install nano-icinga2
```
2015-04-28 19:14:05 +02:00
SLES/openSUSE:
2018-04-25 14:29:41 +02:00
```
zypper install nano-icinga2
```
2015-04-28 19:14:05 +02:00
2016-06-17 14:16:17 +02:00
Copy the `/etc/nanorc` sample file to your home directory.
2015-03-07 15:52:56 +01:00
2018-04-25 14:29:41 +02:00
```
$ cp /etc/nanorc ~/.nanorc
```
2016-06-17 14:16:17 +02:00
Include the `icinga2.nanorc` file.
2018-04-25 14:29:41 +02:00
```
$ vim ~/.nanorc
2015-03-07 15:52:56 +01:00
2018-04-25 14:29:41 +02:00
## Icinga 2
include "/usr/share/nano/icinga2.nanorc"
```
2015-03-07 15:52:56 +01:00
Test it:
2018-04-25 14:29:41 +02:00
```
$ nano /etc/icinga2/conf.d/templates.conf
```
2015-03-07 15:52:56 +01:00
2016-04-15 18:09:09 +02:00
![Nano with syntax highlighting ](images/getting-started/nano-syntax.png "Nano with Icinga 2 syntax highlighting" )
2015-03-07 15:52:56 +01:00
2017-07-12 20:46:12 +02:00
## Setting up Icinga Web 2 <a id="setting-up-icingaweb2"></a>
2015-01-26 14:40:27 +01:00
2018-04-25 14:29:41 +02:00
Icinga 2 can be used with Icinga Web 2 and a variety of modules.
2015-10-28 21:07:12 +01:00
This chapter explains how to set up Icinga Web 2.
2014-05-04 11:25:12 +02:00
2018-04-25 14:29:41 +02:00
The DB IDO (Database Icinga Data Output) feature for Icinga 2 take care of
exporting all configuration and status information into a database.
2014-08-27 16:30:35 +02:00
2017-07-12 20:46:12 +02:00
Please choose whether to install [MySQL ](02-getting-started.md#configuring-db-ido-mysql ) or
[PostgreSQL ](02-getting-started.md#configuring-db-ido-postgresql ).
2017-05-31 13:59:16 +02:00
2017-07-12 20:46:12 +02:00
### Configuring DB IDO MySQL <a id="configuring-db-ido-mysql"></a>
2014-05-04 11:25:12 +02:00
2017-07-12 20:46:12 +02:00
#### Installing MySQL database server <a id="installing-database-mysql-server"></a>
2014-05-04 11:25:12 +02:00
2014-08-27 16:30:35 +02:00
Debian/Ubuntu:
2014-09-04 17:02:30 +02:00
2018-04-25 14:29:41 +02:00
```
apt-get install mysql-server mysql-client
2014-09-04 17:02:30 +02:00
2018-04-25 14:29:41 +02:00
mysql_secure_installation
```
2014-05-04 11:25:12 +02:00
2015-01-23 14:15:57 +01:00
RHEL/CentOS 7 and Fedora:
2014-09-04 17:02:30 +02:00
2018-04-25 14:29:41 +02:00
```
yum install mariadb-server mariadb
systemctl enable mariadb
systemctl start mariadb
mysql_secure_installation
```
2014-08-27 16:30:35 +02:00
SUSE:
2014-09-04 17:02:30 +02:00
2018-04-25 14:29:41 +02:00
```
zypper install mysql mysql-client
chkconfig mysqld on
service mysqld start
```
2014-05-04 11:25:12 +02:00
2015-10-05 13:49:49 +02:00
FreeBSD:
2018-04-25 14:29:41 +02:00
```
pkg install mysql56-server
sysrc mysql_enable=yes
service mysql-server restart
mysql_secure_installation
```
2015-10-05 13:49:49 +02:00
2017-08-10 15:29:22 +02:00
Alpine Linux:
2018-04-25 14:29:41 +02:00
```
apk add mariadb
rc-service mariadb setup
rc-update add mariadb default
rc-service mariadb start
```
2017-08-10 15:29:22 +02:00
2017-07-12 20:46:12 +02:00
#### Installing the IDO modules for MySQL <a id="installing-database-mysql-modules"></a>
2014-05-04 11:25:12 +02:00
2015-01-23 14:15:57 +01:00
The next step is to install the `icinga2-ido-mysql` package using your
2014-09-15 17:00:00 +02:00
distribution's package manager.
Debian/Ubuntu:
2018-04-25 14:29:41 +02:00
```
apt-get install icinga2-ido-mysql
```
2014-09-15 17:00:00 +02:00
RHEL/CentOS:
2018-04-25 14:29:41 +02:00
```
yum install icinga2-ido-mysql
```
2014-09-15 17:00:00 +02:00
SUSE:
2018-04-25 14:29:41 +02:00
```
zypper install icinga2-ido-mysql
```
2014-09-15 17:00:00 +02:00
2015-10-05 13:49:49 +02:00
FreeBSD:
On FreeBSD the IDO modules for MySQL are included with the icinga2 package
2018-04-25 14:29:41 +02:00
and located at `/usr/local/share/icinga2-ido-mysql/schema/mysql.sql` .
2014-09-15 17:00:00 +02:00
2017-08-10 15:29:22 +02:00
Alpine Linux:
On Alpine Linux the IDO modules for MySQL are included with the `icinga2` package
2018-04-25 14:29:41 +02:00
and located at `/usr/share/icinga2-ido-mysql/schema/mysql.sql` .
2017-08-10 15:29:22 +02:00
2014-08-27 16:30:35 +02:00
> **Note**
2014-05-04 11:25:12 +02:00
>
2015-01-25 16:07:43 +01:00
> The Debian/Ubuntu packages provide a database configuration wizard by
> default. You can skip the automated setup and install/upgrade the
2018-04-25 14:29:41 +02:00
> database manually if you prefer.
2014-05-04 11:25:12 +02:00
2017-07-12 20:46:12 +02:00
#### Setting up the MySQL database <a id="setting-up-mysql-db"></a>
2014-05-04 11:25:12 +02:00
2014-09-15 17:00:00 +02:00
Set up a MySQL database for Icinga 2:
2014-05-04 11:25:12 +02:00
2018-04-25 14:29:41 +02:00
```
# mysql -u root -p
2014-05-04 11:25:12 +02:00
2018-04-25 14:29:41 +02:00
CREATE DATABASE icinga;
GRANT SELECT, INSERT, UPDATE, DELETE, DROP, CREATE VIEW, INDEX, EXECUTE ON icinga.* TO 'icinga'@'localhost' IDENTIFIED BY 'icinga';
quit
```
2016-04-15 18:09:09 +02:00
![setting up the database on CentOS 7 ](images/getting-started/mariadb-centos7.png "Setting up the database on CentOS 7" )
2014-05-04 11:25:12 +02:00
After creating the database you can import the Icinga 2 IDO schema using the
2018-04-25 14:29:41 +02:00
following command. Enter the root password into the prompt when asked.
2014-05-04 11:25:12 +02:00
2018-04-25 14:29:41 +02:00
```
mysql -u root -p icinga < /usr/share/icinga2-ido-mysql/schema/mysql.sql
```
2014-08-27 16:30:35 +02:00
2017-07-12 20:46:12 +02:00
#### Enabling the IDO MySQL module <a id="enabling-ido-mysql"></a>
2014-05-04 11:25:12 +02:00
The package provides a new configuration file that is installed in
2018-04-25 14:29:41 +02:00
`/etc/icinga2/features-available/ido-mysql.conf` . You can update
the database credentials in this file.
2015-01-25 16:07:43 +01:00
All available attributes are explained in the
2017-07-12 20:46:12 +02:00
[IdoMysqlConnection object ](09-object-types.md#objecttype-idomysqlconnection )
2015-02-06 15:08:51 +01:00
chapter.
2014-05-04 11:25:12 +02:00
2015-02-06 15:08:51 +01:00
You can enable the `ido-mysql` feature configuration file using
`icinga2 feature enable` :
2014-05-04 11:25:12 +02:00
2018-04-25 14:29:41 +02:00
```
# icinga2 feature enable ido-mysql
Module 'ido-mysql' was enabled.
Make sure to restart Icinga 2 for these changes to take effect.
```
2014-05-04 11:25:12 +02:00
2018-04-25 14:29:41 +02:00
Restart Icinga 2.
2015-10-05 13:49:49 +02:00
2018-04-25 14:29:41 +02:00
```
systemctl restart icinga2
```
2015-10-05 13:49:49 +02:00
2017-08-10 15:29:22 +02:00
Alpine Linux:
2018-04-25 14:29:41 +02:00
```
rc-service icinga2 restart
```
2017-05-31 13:59:16 +02:00
2017-07-12 20:46:12 +02:00
Continue with the [webserver setup ](02-getting-started.md#icinga2-user-interface-webserver ).
2017-05-31 13:59:16 +02:00
2017-07-12 20:46:12 +02:00
### Configuring DB IDO PostgreSQL <a id="configuring-db-ido-postgresql"></a>
2014-05-04 11:25:12 +02:00
2017-07-12 20:46:12 +02:00
#### Installing PostgreSQL database server <a id="installing-database-postgresql-server"></a>
2015-01-23 14:15:57 +01:00
Debian/Ubuntu:
2018-04-25 14:29:41 +02:00
```
apt-get install postgresql
```
2015-01-23 14:15:57 +01:00
RHEL/CentOS 7:
2018-04-25 14:29:41 +02:00
```
yum install postgresql-server postgresql
postgresql-setup initdb
systemctl enable postgresql
systemctl start postgresql
```
2015-01-23 14:15:57 +01:00
SUSE:
2018-04-25 14:29:41 +02:00
```
zypper install postgresql postgresql-server
chkconfig postgresql on
service postgresql initdb
service postgresql start
```
2015-01-23 14:15:57 +01:00
2015-10-05 13:49:49 +02:00
FreeBSD:
2018-04-25 14:29:41 +02:00
```
pkg install postgresql93-server
sysrc postgresql_enable=yes
service postgresql initdb
service postgresql start
```
2015-10-05 13:49:49 +02:00
2017-08-10 15:29:22 +02:00
Alpine Linux:
2018-04-25 14:29:41 +02:00
```
apk add postgresql
rc-update add postgresql default
rc-service postgresql setup
rc-service postgresql start
```
2017-08-10 15:29:22 +02:00
2017-07-12 20:46:12 +02:00
#### Installing the IDO modules for PostgreSQL <a id="installing-database-postgresql-modules"></a>
2015-01-23 14:15:57 +01:00
The next step is to install the `icinga2-ido-pgsql` package using your
2014-09-15 17:00:00 +02:00
distribution's package manager.
Debian/Ubuntu:
2018-04-25 14:29:41 +02:00
```
apt-get install icinga2-ido-pgsql
```
2014-09-15 17:00:00 +02:00
RHEL/CentOS:
2018-04-25 14:29:41 +02:00
```
yum install icinga2-ido-pgsql
```
2014-09-15 17:00:00 +02:00
SUSE:
2018-04-25 14:29:41 +02:00
```
zypper install icinga2-ido-pgsql
```
2014-09-15 17:00:00 +02:00
2015-10-05 13:49:49 +02:00
FreeBSD:
On FreeBSD the IDO modules for PostgreSQL are included with the icinga2 package
2018-04-25 14:29:41 +02:00
and located at `/usr/local/share/icinga2-ido-pgsql/schema/pgsql.sql` .
2015-10-05 13:49:49 +02:00
2017-08-10 15:29:22 +02:00
Alpine Linux:
On Alpine Linux the IDO modules for PostgreSQL are included with the `icinga2` package
2018-04-25 14:29:41 +02:00
and located at `/usr/share/icinga2-ido-pgsql/schema/pgsql.sql` .
2017-08-10 15:29:22 +02:00
2014-08-27 16:30:35 +02:00
> **Note**
>
> Upstream Debian packages provide a database configuration wizard by default.
> You can skip the automated setup and install/upgrade the database manually
> if you prefer that.
2014-05-04 11:25:12 +02:00
#### Setting up the PostgreSQL database
2014-09-15 17:00:00 +02:00
Set up a PostgreSQL database for Icinga 2:
2014-05-04 11:25:12 +02:00
2018-04-25 14:29:41 +02:00
```
cd /tmp
sudo -u postgres psql -c "CREATE ROLE icinga WITH LOGIN PASSWORD 'icinga'"
sudo -u postgres createdb -O icinga -E UTF8 icinga
```
2014-05-04 11:25:12 +02:00
2014-05-29 15:14:44 +02:00
> **Note**
>
2018-04-19 17:46:32 +02:00
> It is assumed here that your locale is set to utf-8, you may run into problems otherwise.
2014-05-29 15:14:44 +02:00
2018-04-25 14:29:41 +02:00
Locate your `pg_hba.conf` configuration file (Debian: `/etc/postgresql/*/main/pg_hba.conf` ,
RHEL/SUSE: `/var/lib/pgsql/data/pg_hba.conf` ), add the icinga user with `md5`
as authentication method and restart the postgresql server.
2014-05-04 11:25:12 +02:00
2018-04-25 14:29:41 +02:00
```
# icinga
local icinga icinga md5
host icinga icinga 127.0.0.1/32 md5
host icinga icinga ::1/128 md5
# "local" is for Unix domain socket connections only
local all all ident
# IPv4 local connections:
host all all 127.0.0.1/32 ident
# IPv6 local connections:
host all all ::1/128 ident
```
2014-05-04 11:25:12 +02:00
2018-04-25 14:29:41 +02:00
```
systemctl restart postgresql
```
2014-05-04 11:25:12 +02:00
2018-04-25 14:29:41 +02:00
After creating the database and permissions you need to import the IDO database
2015-02-06 15:08:51 +01:00
schema using the following command:
2014-05-04 11:25:12 +02:00
2018-04-25 14:29:41 +02:00
```
export PGPASSWORD=icinga
psql -U icinga -d icinga < /usr/share/icinga2-ido-pgsql/schema/pgsql.sql
```
2014-05-04 11:25:12 +02:00
2016-04-15 18:09:09 +02:00
![importing the Icinga 2 IDO schema ](images/getting-started/postgr-import-ido.png "Importing the Icinga 2 IDO schema on Debian Jessie" )
2014-05-04 11:25:12 +02:00
2017-07-12 20:46:12 +02:00
#### Enabling the IDO PostgreSQL module <a id="enabling-ido-postgresql"></a>
2014-05-04 11:25:12 +02:00
The package provides a new configuration file that is installed in
2018-04-25 14:29:41 +02:00
`/etc/icinga2/features-available/ido-pgsql.conf` . You can update
2015-01-25 16:07:43 +01:00
the database credentials in this file.
All available attributes are explained in the
2017-07-12 20:46:12 +02:00
[IdoPgsqlConnection object ](09-object-types.md#objecttype-idopgsqlconnection )
2015-02-06 15:08:51 +01:00
chapter.
2014-05-04 11:25:12 +02:00
2015-02-06 15:08:51 +01:00
You can enable the `ido-pgsql` feature configuration file using
`icinga2 feature enable` :
2014-05-04 11:25:12 +02:00
2018-04-25 14:29:41 +02:00
```
# icinga2 feature enable ido-pgsql
Module 'ido-pgsql' was enabled.
Make sure to restart Icinga 2 for these changes to take effect.
```
2017-06-19 17:06:20 +02:00
2018-04-25 14:29:41 +02:00
Restart Icinga 2.
2014-09-04 17:02:30 +02:00
2018-04-25 14:29:41 +02:00
```
systemctl restart icinga2
```
2014-05-04 11:25:12 +02:00
2017-08-10 15:29:22 +02:00
Alpine Linux:
2018-04-25 14:29:41 +02:00
```
rc-service icinga2 restart
```
2017-08-10 15:29:22 +02:00
2017-07-12 20:46:12 +02:00
Continue with the [webserver setup ](02-getting-started.md#icinga2-user-interface-webserver ).
2017-05-31 13:59:16 +02:00
2017-07-12 20:46:12 +02:00
### Webserver <a id="icinga2-user-interface-webserver"></a>
2015-01-26 14:40:27 +01:00
2018-04-25 14:29:41 +02:00
The preferred way of installing Icinga Web 2 is to use Apache as webserver
in combination with PHP-FPM. If you prefer Nginx, please refer to the Icinga Web 2
documentation.
2015-01-26 14:40:27 +01:00
Debian/Ubuntu:
2018-04-25 14:29:41 +02:00
```
apt-get install apache2
```
2015-01-26 14:40:27 +01:00
2018-04-25 14:29:41 +02:00
RHEL/CentOS 7, Fedora:
2015-01-26 14:40:27 +01:00
2018-04-25 14:29:41 +02:00
```
yum install httpd
systemctl enable httpd
systemctl start httpd
```
2015-01-26 14:40:27 +01:00
SUSE:
2018-04-25 14:29:41 +02:00
```
zypper install apache2
chkconfig on
service apache2 start
```
2015-01-26 14:40:27 +01:00
2018-04-25 14:29:41 +02:00
FreeBSD (Nginx, but you could also use the `apache24` package):
2015-10-05 13:49:49 +02:00
2018-04-25 14:29:41 +02:00
```
pkg install nginx php56-gettext php56-ldap php56-openssl php56-mysql php56-pdo_mysql php56-pgsql php56-pdo_pgsql php56-sockets php56-gd pecl-imagick pecl-intl
sysrc php_fpm_enable=yes
sysrc nginx_enable=yes
sed -i '' "s/listen\ =\ 127.0.0.1:9000/listen\ =\ \/var\/run\/php5-fpm.sock/" /usr/local/etc/php-fpm.conf
sed -i '' "s/;listen.owner/listen.owner/" /usr/local/etc/php-fpm.conf
sed -i '' "s/;listen.group/listen.group/" /usr/local/etc/php-fpm.conf
sed -i '' "s/;listen.mode/listen.mode/" /usr/local/etc/php-fpm.conf
service php-fpm start
service nginx start
```
2015-10-05 13:49:49 +02:00
2017-08-10 15:29:22 +02:00
Alpine Linux:
2018-04-25 14:29:41 +02:00
```
apk add apache2 php7-apache2
sed -i -e "s/^#LoadModule rewrite_module/LoadModule rewrite_module/" /etc/apache2/httpd.conf
rc-update add apache2 default
rc-service apache2 start
```
2017-08-10 15:29:22 +02:00
2017-07-12 20:46:12 +02:00
### Firewall Rules <a id="icinga2-user-interface-firewall-rules"></a>
2015-01-26 14:40:27 +01:00
2018-04-25 14:29:41 +02:00
Enable port 80 (http). Best practice is to only enable port 443 (https) and use TLS certificates.
firewall-cmd:
2015-01-26 14:40:27 +01:00
2018-04-25 14:29:41 +02:00
```
firewall-cmd --add-service=http
firewall-cmd --permanent --add-service=http
```
2015-01-26 14:40:27 +01:00
2018-04-25 14:29:41 +02:00
iptables:
2015-01-26 14:40:27 +01:00
2018-04-25 14:29:41 +02:00
```
iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
service iptables save
```
2015-01-26 14:40:27 +01:00
2015-10-05 13:49:49 +02:00
FreeBSD:
Please consult the [FreeBSD Handbook ](https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/firewalls.html ) how to configure one of FreeBSD's firewalls.
2015-01-26 14:40:27 +01:00
2017-07-12 20:46:12 +02:00
### Setting Up Icinga 2 REST API <a id="setting-up-rest-api"></a>
2017-05-31 13:59:16 +02:00
Icinga Web 2 and other web interfaces require the [REST API ](12-icinga2-api.md#icinga2-api-setup )
to send actions (reschedule check, etc.) and query object details.
2014-08-27 19:20:49 +02:00
2017-05-31 13:59:16 +02:00
You can run the CLI command `icinga2 api setup` to enable the
`api` [feature ](11-cli-commands.md#enable-features ) and set up
certificates as well as a new API user `root` with an auto-generated password in the
`/etc/icinga2/conf.d/api-users.conf` configuration file:
2014-08-27 19:20:49 +02:00
2018-04-25 14:29:41 +02:00
```
icinga2 api setup
```
2014-08-27 19:20:49 +02:00
2017-05-31 13:59:16 +02:00
Edit the `api-users.conf` file and add a new ApiUser object. Specify the [permissions ](12-icinga2-api.md#icinga2-api-permissions )
attribute with minimal permissions required by Icinga Web 2.
2014-08-27 19:20:49 +02:00
2018-04-25 14:29:41 +02:00
```
vim /etc/icinga2/conf.d/api-users.conf
2014-09-04 17:02:30 +02:00
2018-04-25 14:29:41 +02:00
object ApiUser "icingaweb2" {
password = "Wijsn8Z9eRs5E25d"
permissions = [ "status/query", "actions/*", "objects/modify/*", "objects/query/*" ]
}
```
2014-08-27 19:20:49 +02:00
2018-04-25 14:29:41 +02:00
Restart Icinga 2 to activate the configuration.
2015-10-05 13:49:49 +02:00
2018-04-25 14:29:41 +02:00
```
systemctl restart icinga2
```
2015-10-05 13:49:49 +02:00
2017-08-10 15:29:22 +02:00
Alpine Linux:
2018-04-25 14:29:41 +02:00
```
rc-service icinga2 restart
```
2017-08-10 15:29:22 +02:00
2017-07-12 20:46:12 +02:00
### Installing Icinga Web 2 <a id="installing-icingaweb2"></a>
2015-01-23 14:15:57 +01:00
2018-10-18 09:50:53 +02:00
Please consult the [installation documentation ](https://icinga.com/docs/icingaweb2/latest/doc/02-Installation/ )
2015-02-06 15:08:51 +01:00
for further instructions on how to install Icinga Web 2.
2015-01-23 14:15:57 +01:00
2018-10-18 09:50:53 +02:00
The Icinga 2 API can be defined as [command transport ](https://icinga.com/docs/icingaweb2/latest/modules/monitoring/doc/05-Command-Transports/ )
2017-05-31 13:59:16 +02:00
in Icinga Web 2 >= 2.4.
2015-01-23 14:15:57 +01:00
2017-07-12 20:46:12 +02:00
## Addons <a id="install-addons"></a>
2015-01-23 14:15:57 +01:00
2015-02-06 15:08:51 +01:00
A number of additional features are available in the form of addons. A list of
popular addons is available in the
2016-08-13 15:59:06 +02:00
[Addons and Plugins ](13-addons.md#addons ) chapter.
2017-07-12 20:46:12 +02:00
## Backup <a id="install-backup"></a>
2016-08-13 15:59:06 +02:00
Ensure to include the following in your backups:
* Configuration files in `/etc/icinga2`
2017-10-16 15:32:57 +02:00
* Certificate files in `/var/lib/icinga2/ca` (Master CA key pair) and `/var/lib/icinga2/certs` (node certificates)
* Runtime files in `/var/lib/icinga2`
2016-08-13 15:59:06 +02:00
* Optional: IDO database backup
2018-04-25 14:29:41 +02:00
## Backup: Database <a id="install-backup-database"></a>
MySQL/MariaDB:
* [Documentation ](https://mariadb.com/kb/en/library/backup-and-restore-overview/ )
PostgreSQL:
* [Documentation ](https://www.postgresql.org/docs/9.3/static/backup.html )