Monitoring with Icinga
Introduction
This chapter provides guidance on the setup of an Icinga server using SLES 15 SP1. For more information, see the Official Icinga documentation: http://docs.icinga.org/latest/en/.
Installation and Basic Configuration
Icinga packages are found in the SLE-Manager-Tools15-Updates x86_64
.
Icinga Installation Location
Do not install Icinga on the SUSE Manager server. Install Icinga on a stand-alone SUSE Linux Enterprise client. |
-
Register the new client with SUSE Manager and subscribe it to the SUSE Manager client and update channels. SLES 15 and later include these channels by default.
-
Install the required Icinga packages on the new client:
zypper in icinga icinga-idoutils-pgsql postgresql postgresql-server \ monitoring-plugins-all apache2
-
Edit the
/etc/icinga/objects/contacts.cfg
file and add the email address which you will use for reciving alerts.define contact { contact_name icingaadmin ; Short name of user use generic-contact ; Inherit default values alias Icinga Admin ; Full name of user email icinga@localhost ; <<*** CHANGE THIS TO YOUR EMAIL ADDRESS *** }
-
Enable postgres on boot and start the database:
systemctl enable postgresql.service systemctl start postgresql.service
-
Become the
postgres
system user:
sudo su - postgres
-
Start a SQL CLI:
psql
-
Create a new password for the administrative user
postgres
, and configure a newicinga
user:
ALTER USER postgres WITH PASSWORD '<newpassword>'; CREATE USER icinga; ALTER USER icinga WITH PASSWORD 'icinga'; CREATE DATABASE icinga; GRANT ALL ON DATABASE icinga TO icinga; \q
Exit the postgres
system user session:
exit
-
Adjust client authentication rights located in
/var/lib/pgsql/data/pg_hba.conf
to match the following:# TYPE DATABASE USER ADDRESS METHOD local icinga icinga trust local all postgres ident # "local" is for Unix domain socket connections only local all all trust # IPv4 local connections: host all all 127.0.0.1/32 trust # IPv6 local connections: host all all ::1/128 trust # Allow replication connections from localhost, by a user with the # replication privilege. #local replication postgres peer #host replication postgres 127.0.0.1/32 ident #host replication postgres ::1/128 ident
Placement of Authentication SettingsEnsure the local entries for icinga authentication settings are placed above all other local entries or you will get an error when configuring the database schema. The entries in
pg_hba.conf
are read from top to bottom. -
Reload the Postgres service:
systemctl reload postgresql.service
-
Configure the database schema with this command:
psql -U icinga -d icinga < /usr/share/doc/packages/icinga-idoutils-pgsql/pgsql/pgsql.sql
-
Edit the following lines in
/etc/icinga/ido2db.cfg
to switch from the default setting of mysql to postgres:vi /etc/icinga/ido2db.cfg db_servertype=pgsql db_port=5432
Open Firewall PortAllow port
80
through your firewall or you will not be able to access the Web UI. -
Create an icinga admin account for logging into the web interface:
htpasswd -c /etc/icinga/htpasswd.users icingaadmin
-
Enable and start all required services:
systemctl enable icinga.service systemctl start icinga.service systemctl enable ido2db.service systemctl start ido2db.service systemctl enable apache2.service systemctl start apache2.service
-
Log in to the Web UI at: http://<client-hostname>/icinga.
This concludes setup and initial configuration of Icinga.
Additional Resources
For more information, see Icinga’s official documentation located at http://docs.icinga.org/latest/en.
For some excellent time saving configuration tips and tricks not covered in this guide, see the following section located within the official documentation: http://docs.icinga.org/latest/en/objecttricks.html