<\/span><\/h2>\nWe can install Icinga 2 from the Debian 9 package repository.<\/p>\n
Run the following commands to install Icinga 2 on the server:<\/p>\n
apt-get update\r\napt-get install icinga2 icinga2-studio vim-icinga2 monitoring-plugins-basic monitoring-plugins-common<\/pre>\nEnable Icinga 2 to start on server boot:<\/p>\n
systemctl enable icinga2.service<\/pre>\nRun the following command to check the Icinga 2 version:<\/p>\n
icinga2 --version<\/pre>\nOutput:<\/p>\n
icinga2 - The Icinga 2 network monitoring daemon (version: r2.6.0-1)\r\n\r\nCopyright (c) 2012-2016 Icinga Development Team (https:\/\/www.icinga.org\/)\r\nLicense GPLv2+: GNU GPL version 2 or later <http:\/\/gnu.org\/licenses\/gpl2.html>\r\nThis is free software: you are free to change and redistribute it.\r\nThere is NO WARRANTY, to the extent permitted by law.\r\n\r\nApplication information:\r\nInstallation root: \/usr\r\nSysconf directory: \/etc\r\nRun directory: \/run\r\nLocal state directory: \/var\r\nPackage data directory: \/usr\/share\/icinga2\r\nState path: \/var\/lib\/icinga2\/icinga2.state\r\nModified attributes path: \/var\/lib\/icinga2\/modified-attributes.conf\r\nObjects path: \/var\/cache\/icinga2\/icinga2.debug\r\nVars path: \/var\/cache\/icinga2\/icinga2.vars\r\nPID path: \/run\/icinga2\/icinga2.pid\r\n\r\nSystem information:\r\nPlatform: Debian GNU\/Linux\r\nPlatform version: 9 (stretch)\r\nKernel: Linux\r\nKernel version: 4.9.0-8-amd64\r\nArchitecture: x86_64\r\n\r\nBuild information:\r\nCompiler: GNU 6.3.0\r\nBuild host: x86-ubc-01<\/pre>\nIn order to check if the Icinga 2 service is up and running, run the following command:<\/p>\n
systemctl status icinga2.service<\/pre>\nWe should receive an output similar to this:<\/p>\n
\u25cf icinga2.service - Icinga host\/service\/network monitoring system\r\nLoaded: loaded (\/lib\/systemd\/system\/icinga2.service; enabled; vendor preset: enabled)\r\nActive: active (running) since Sun 2019-05-26 02:53:29 EDT; 1min 5s ago\r\nMain PID: 28688 (icinga2)\r\nCGroup: \/system.slice\/icinga2.service\r\n\u251c\u250028688 \/usr\/lib\/x86_64-linux-gnu\/icinga2\/sbin\/icinga2 --no-stack-rlimit daemon -e \/var\/log\/icinga2\/error.log\r\n\u2514\u250028711 \/usr\/lib\/x86_64-linux-gnu\/icinga2\/sbin\/icinga2 --no-stack-rlimit daemon -e \/var\/log\/icinga2\/error.log<\/pre>\nAs we can see from the output, the Icinga 2 error log file is located in the\u00a0\/var\/log\/icinga2\/<\/code> directory. The ‘error.log’ log file can be used to help troubleshoot problems with Icinga 2 configuration files, locate the cause of any crashes, etc.<\/p>\n<\/span>Step 4: Install Icinga 2 CLI<\/strong><\/span><\/h2>\nWe can install the Icinga 2 CLI tool from the Debian repository easily with just one command:<\/p>\n
apt-get install icingacli<\/pre>\n<\/span>Step 5: Install<\/strong> MariaDB and IDO (Icinga Data Output) modules for MySQL\/MariaDB<\/span><\/h2>\nInstall MariaDB and IDO modules for MySQL\/MAriaDB:<\/p>\n
apt-get install mariadb-common mariadb-server\r\napt-get install icinga2-ido-mysql<\/pre>\n<\/p>\n
Restart the Icinga 2 service for the changes to take effect:<\/p>\n
systemctl restart icinga2.service<\/pre>\n<\/span>Step 6: Create a Database for Icinga 2<\/span><\/h2>\nCreate a MariaDB database for Icinga 2:<\/p>\n
mysql -u root -p<\/pre>\nMariaDB [(none)]> CREATE DATABASE icinga2db;\r\nMariaDB [(none)]> GRANT ALL PRIVILEGES ON icinga2db.* TO 'icinga2user'@'localhost' IDENTIFIED BY 'StrongPassword<\/span>';\r\nMariaDB [(none)]> FLUSH PRIVILEGES;\r\nMariaDB [(none)]> exit;<\/pre>\nDon\u2019t forget to replace \u2018StrongPassword<\/span>\u2019 with an actual strong password.<\/p>\n