Icinga is an open-source computer and network monitoring system that originally started as a fork of Nagios in 2009.
CSCF is working to migrate from Nagios to Icinga due to the extended feature set including (but not limited to) the RESTful API and "service-level" monitoring that is more applicable to the University of Waterloo's Computer Science network.
While most of the documentation on this page is mostly for internal use, others may benefit from it.
Icinga in our case is a collection of services and applications that are used in conjunction to create the Icinga Stack.
The Icinga2 service is the core of the stack. It runs as a systemd service under the name "icinga2".
It does not have a GUI and can only be directly interacted with via the icingacli command tool.
The Icinga2 service is what reads the written configuration files for hosts, services, commands.etc and schedules/runs checks on hosts/services. Based upon the output of a check, a result script is run that could do anything from sending an email/slack message to automatically trying to fix the issue over SSH.
The Icinga2 service writes its current status (i.e a cache) to the local MySQL instance using IDO2DB. Other services such as NagVis and IcingaWeb2 do not read from the Icinga2 service directly but instead read from the database.
IcingaWeb2 is a web-based frontend.
It consists of multiple components to monitor and generate configuration files for the Icinga2 service.
IcingaWeb2 reads the current status and events from the local MySQL database. The Director module is used to generate and manage configuration files for monitoring hosts and services. Commands (such as scheduling downtime) are sent to the Icinga2 service directly via the REST API.
IDO2DB (Icinga Data Out to Database) is used by the Icinga2 service to write current status and events to a local database (MySQL in our case) for later reading.
NagVis is a graphing and visualization addon that was created for Nagios. As Icinga started as a fork of Nagios and shares the same host/service layout system, it is capable of integrating with Icinga via the MySQL database and IDO2DB feature.
NagVis is used by CSCF to map out the monitored network using automatically generated tree-view graphs. These graphs are generated based upon room hostgroups and host parent/child properties.
This server installation guide assumes a fresh install of Ubuntu 18.04 LTS with networking and SSH access already configured. A basic understanding of Apache configuration is also required to tweak and finalize the webserver setup. In order to use Let's Encrypt
, the webserver must be externally accessible using either a DNS or HTTP challenge.
apt-get update
apt-get install curl gnupg
curl https://packages.icinga.com/icinga.key | apt-key add -
echo -e "deb https://packages.icinga.com/ubuntu icinga-CodeName main\ndeb-src https://packages.icinga.com/ubuntu icinga-CodeName main" | sed -e "s/CodeName/`lsb_release -c -s`/" > /etc/apt/sources.list.d/icinga.list
apt-get update
apt-get install icinga icingaweb2 icingacli php-gd
apt-get install software-properties-common
add-apt-repository universe add-apt-repository ppa:certbot/certbot
apt-get update apt-get install certbot python-certbot-apache
certbot -n --apache -d SERVER_FQDN --agree-tos -m ADMIN_EMAIL --redirect
apt-get install mysql-server mysql-client icinga2-ido-mysql
mysql_secure_installation
icinga2 feature enable ido-mysql systemctl restart icinga2
icinga2 api setup
/etc/icinga2/conf.d/api-users.conf
and add the following info to create an API user for IcingaWeb2.object ApiUser "director" { password = "RANDOMPASSWORD" permissions = [ "*" ] } object ApiUser "icingaweb2" { password = "RANDOMPASSWORD" permissions = [ "status/query", "actions/*", "objects/modify/*", "objects/query/*" ] }
systemctl restart icinga2
icingacli setup config directory --group icingaweb2
icingacli setup token create
apt-get install git php-mbstring php-gd php-sqlite3 graphviz sqlite3 rsync icinga-idoutils
git clone https://github.com/Icinga/icingaweb2-module-nagvis.git /usr/share/icingaweb2/modules/nagvis icingacli module enable nagvis
git clone https://github.com/NagVis/nagvis.git nagvis-repo cd nagios-repo
./install.sh -a y -q -i ido2db -w /etc/apache2 -s icinga -p /usr/local/nagvis
a2enconf nagvis systemctl restart apache2
/usr/local/nagvis/etc/nagvis.ini.php
to be set as the following:logonmodule="LogonEnv" logonenvvar="REMOTE_USER" logonenvcreateuser=1 logonenvcreaterole="Guests"
mysql -e "CREATE DATABASE director CHARACTER SET 'utf8'; CREATE USER director@localhost IDENTIFIED BY 'some-password'; GRANT ALL ON director.* TO director@localhost;"
git clone --single-branch --branch stable/0.5.0 https://github.com/Icinga/icingaweb2-module-incubator.git /usr/share/icingaweb2/modules/incubator git clone --single-branch --branch stable/0.7.0 https://github.com/Icinga/icingaweb2-module-reactbundle.git /usr/share/icingaweb2/modules/reactbundle icingacli module enable incubator icingacli module enable reactbundle
git clone https://github.com/Icinga/icingaweb2-module-director.git /usr/share/icingaweb2/modules/director icingacli module enable director
Resources
tab SQL Database
director
director
director
and password to the password set in the earlier MySQL query
utf8
useradd -r -g icingaweb2 -d /var/lib/icingadirector -s /bin/false icingadirector install -d -o icingadirector -g icingaweb2 -m 0750 /var/lib/icingadirector
/lib/systemd/system/icinga-director.service
with the following contents:[Unit] Description=Icinga Director - Monitoring Configuration Documentation=https://icinga.com/docs/director/latest/ Wants=network.target [Service] EnvironmentFile=-/etc/default/icinga-director EnvironmentFile=-/etc/sysconfig/icinga-director ExecStart=/usr/bin/icingacli director daemon run ExecReload=/bin/kill -HUP ${MAINPID} User=icingadirector SyslogIdentifier=icingadirector Type=notify NotifyAccess=main WatchdogSec=10 RestartSec=30 Restart=always [Install] WantedBy=multi-user.target
systemctl daemon-reload systemctl enable icinga-director systemctl start icinga-director
git clone --single-branch --branch stable/0.4.0 https://github.com/Icinga/icingaweb2-module-ipl.git /usr/share/icingaweb2/modules/ipl icingacli module enable ipl
git clone https://github.com/Icinga/icingaweb2-module-businessprocess.git /usr/share/icingaweb2/modules/businessprocess icingacli module enable businessprocess
apt update apt install icinga2 freeipmi-tools smartmontools ipmiutil libipc-run-perl systemctl stop icinga2 cd /usr/lib/nagios mv plugins plugins-debian git clone https://git.uwaterloo.ca/cscf/icinga-plugins.git cp icinga-plugins plugins
#/etc/sudoers.d/icinga nagios ALL = NOPASSWD: /usr/sbin/smartctl nagios ALL =(root) NOPASSWD: /usr/sbin/ipmi-sensors, /usr/sbin/ipmi-sel, /usr/sbin/ipmi-dcmi
icinga2 node wizard
Please specify if this is an agent/satellite setup ('n' installs a master setup) [Y/n]:Y
Please specify the common name (CN) [growl.ripple-domain.cs.uwaterloo.ca]: growl.cs.uwaterloo.ca
Please specify the parent endpoint(s) (master or satellite) where this node should connect to: Master/Satellite Common Name (CN from your master/satellite node): icinga.cscf.uwaterloo.ca
Do you want to establish a connection to the parent node from this node? [Y/n]:
Please specify the master/satellite connection information: Master/Satellite endpoint host (IP address or FQDN): icinga.cscf.uwaterloo.ca
Master/Satellite endpoint port [5665]:
Add more master/satellite endpoints? [y/N]:
Please specify the request ticket generated on your Icinga 2 master (optional). (Hint: # icinga2 pki ticket --cn 'growl.cs.uwaterloo.ca'): (enter ticket from Agent above)
Please specify the API bind host/port (optional):
Bind Host []:
Bind Port []:
Accept config from parent node? [y/N]: y
Accept commands from parent node? [y/N]: y
Local zone name [growl.cs.uwaterloo.ca]:
Parent zone name [master]:
Do you want to specify additional global zones? [y/N]:
Do you want to disable the inclusion of the conf.d directory [Y/n]:
systemctl start
I | Attachment | History | Action | Size | Date | Who | Comment |
---|---|---|---|---|---|---|---|
![]() |
icinga-stack.png | r1 | manage | 443.0 K | 2019-12-10 - 13:15 | DevonMerner | |
![]() |
icinga-stack2.png | r1 | manage | 555.9 K | 2019-12-10 - 14:01 | DevonMerner | |
![]() |
icinga-stack3.png | r1 | manage | 555.3 K | 2019-12-10 - 14:17 | DevonMerner | |
![]() |
logo_icinga1.png | r1 | manage | 58.3 K | 2019-12-10 - 13:15 | DevonMerner |