![](https://static.wixstatic.com/media/68165d_eb34588446914155be154d46643abc47~mv2.png/v1/fill/w_980,h_422,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/68165d_eb34588446914155be154d46643abc47~mv2.png)
Giới thiệu.
Icinga2 là mã nguồn mở dùng để monitor hệ thống mạng, server,...
Icinga web 2 là giao diện quản lý GUI, report hỗ trợ cho Icinga2.
Update hệ thống.
yum install epel-release -y
yum update -y
1. Cài đặt LAMP Server.
Cài apache.
yum install httpd -y
systemctl start httpd
systemctl enable httpd
2. Cài SQL Server.
yum install mariadb mariadb-server -y
systemctl start mariadb
systemctl enable mariadb
Cấu hình bảo mật cho Mariadb.
mysql_secure_installation
Enter current password for root (enter for none): Nhấn enter
Set root password? [Y/n] y
New password: Nhập pass mới
Re-enter new password: Nhập lại pass mới
Remove anonymous users? [Y/n] y
Disable root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y
3. Cài đặt PHP.
yum install php php-gd php-intl php-ldap php-ZendFramework php-ZendFramework-Db-Adapter-Pdo-Mysql -y
yum install centos-release-scl -y
yum install rh-php71-php-mysqlnd rh-php71-php-cli php-Icinga rh-php71-php-common rh-php71-php-fpm rh-php71-php-pgsql rh-php71-php-ldap rh-php71-php-intl rh-php71-php-xml rh-php71-php-gd rh-php71-php-pdo rh-php71-php-mbstring -y
Chỉnh timezone trong file php.ini
vim /etc/opt/rh/rh-php71/php.ini
![](https://static.wixstatic.com/media/68165d_3a69cc4f41a04b079d44ee54bdc0b93c~mv2.png/v1/fill/w_964,h_525,al_c,q_90,enc_auto/68165d_3a69cc4f41a04b079d44ee54bdc0b93c~mv2.png)
systemctl start rh-php71-php-fpm.service
systemctl enable rh-php71-php-fpm.service
systemctl restart httpd
4. Cài Icinga2 và Plugins
rpm --import http://packages.icinga.org/icinga.key
rpm -i http://packages.icinga.org/epel/7/release/noarch/icinga-rpm-release-7-1.el7.centos.noarch.rpm
yum install icinga2 nagios-plugins-all -y
systemctl start icinga2.service
systemctl enable icinga2.service
5. Tạo database cho Icinga2.
mysql -u root -p
Enter password: Nhập mật khẩu vào Mariadb
MariaDB [(none)]>CREATE DATABASE icinga;
MariaDB [(none)]>GRANT SELECT, INSERT, UPDATE, DELETE, DROP, CREATE VIEW, INDEX, EXECUTE ON icinga.* TO 'icinga'@'localhost' IDENTIFIED BY 'icinga';
MariaDB [(none)]>FLUSH PRIVILEGES;
MariaDB [(none)]>EXIT;
6. Cài IDO modules (Icinga Data Output) cho MariaDB
yum install icinga2-ido-mysql -y
Import modules IDO schema vào database icinga đã tạo ở trên.
mysql -u root -p icinga < /usr/share/icinga2-ido-mysql/schema/mysql.sql
Enable IDO module.
vim /etc/icinga2/features-available/ido-mysql.conf
Nhập các thông tin ở bước tạo database cho Icinga2
![](https://static.wixstatic.com/media/68165d_bc339da930594a76862fed561b814365~mv2.png/v1/fill/w_980,h_570,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/68165d_bc339da930594a76862fed561b814365~mv2.png)
Enable ido-mysql.
icinga2 feature enable ido-mysql
systemctl restart icinga2.service
7. Cài đặt Icinga web 2.
icinga2 feature enable command
systemctl restart icinga2.service
usermod -a -G icingacmd apache
yum install icingaweb2 icingacli -y
icingacli setup config webserver apache --document-root /usr/share/icingaweb2/public
systemctl restart httpd.service
icingacli setup token create
Copy token này lại để dùng cho bước setup icinga web 2.
![](https://static.wixstatic.com/media/68165d_3117a1b7e83f4482a17e742275da6014~mv2.png/v1/fill/w_967,h_487,al_c,q_90,enc_auto/68165d_3117a1b7e83f4482a17e742275da6014~mv2.png)
8. Mở port http.
firewall-cmd --zone=public --permanent --add-service=http
firewall-cmd --reload
Truy cập vào web.
http://ip-máy-cài-Icinga2/icingaweb2/setup
Dán token lúc đã đã tạo vào >> Next
![](https://static.wixstatic.com/media/68165d_489f02dcfa4e49868bc0937ba9c4f637~mv2.png/v1/fill/w_980,h_572,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/68165d_489f02dcfa4e49868bc0937ba9c4f637~mv2.png)
Tick vào monitor >> Next
![](https://static.wixstatic.com/media/68165d_9ddb828d2e1840b1922d3b74547d595a~mv2.png/v1/fill/w_980,h_554,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/68165d_9ddb828d2e1840b1922d3b74547d595a~mv2.png)
Kiểm tra các yêu cầu.
![](https://static.wixstatic.com/media/68165d_24d7dda98c314a7691d6c842916294ce~mv2.png/v1/fill/w_980,h_530,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/68165d_24d7dda98c314a7691d6c842916294ce~mv2.png)
Chúng ta thấy module php-imagick chưa cài, nên chúng ta sẽ cài đặt nó.
yum install rh-php71-php-imagick -y
systemctl restart rh-php71-php-fpm.service
![](https://static.wixstatic.com/media/68165d_853e3bff9e2d45d2983e92c1e80c9b28~mv2.png/v1/fill/w_980,h_539,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/68165d_853e3bff9e2d45d2983e92c1e80c9b28~mv2.png)
Refresh lại.
![](https://static.wixstatic.com/media/68165d_d3350a41b9ed4cd791068873473bcad4~mv2.png/v1/fill/w_980,h_560,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/68165d_d3350a41b9ed4cd791068873473bcad4~mv2.png)
Nếu bị lỗi này thì tắt Selinux.
![](https://static.wixstatic.com/media/68165d_575ca742f2fd48729bd2b54eccfe268f~mv2.png/v1/fill/w_980,h_431,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/68165d_575ca742f2fd48729bd2b54eccfe268f~mv2.png)
Next
![](https://static.wixstatic.com/media/68165d_7569a83583e34076b7361ac1edac1378~mv2.png/v1/fill/w_980,h_560,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/68165d_7569a83583e34076b7361ac1edac1378~mv2.png)
Next
![](https://static.wixstatic.com/media/68165d_6c21ce0c20fa416c97fa7eecdcf23abf~mv2.png/v1/fill/w_980,h_552,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/68165d_6c21ce0c20fa416c97fa7eecdcf23abf~mv2.png)
Database Name: nhập icingaweb2
Username: Nhập root
Password: Nhập password user root để vào Mariadb (không phải pass login của root)
![](https://static.wixstatic.com/media/68165d_6dcb551313f447d18c8e01c02f304b77~mv2.png/v1/fill/w_980,h_562,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/68165d_6dcb551313f447d18c8e01c02f304b77~mv2.png)
Bấm Validate Configuration >> Thông báo thành công >> Next
![](https://static.wixstatic.com/media/68165d_f2c910b0ae9f422f8364057e5f12522c~mv2.png/v1/fill/w_980,h_566,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/68165d_f2c910b0ae9f422f8364057e5f12522c~mv2.png)
Next
![](https://static.wixstatic.com/media/68165d_4d0ab766c66343019b8b4c19de4abf22~mv2.png/v1/fill/w_980,h_555,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/68165d_4d0ab766c66343019b8b4c19de4abf22~mv2.png)
Tạo username và mật khẩu để login vào web >> Next
![](https://static.wixstatic.com/media/68165d_7a408b663cfe4f12ab119fde58895982~mv2.png/v1/fill/w_980,h_554,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/68165d_7a408b663cfe4f12ab119fde58895982~mv2.png)
Chọn như hình >> Next
![](https://static.wixstatic.com/media/68165d_d24c4fd9525a4619ac72c26a129c9553~mv2.png/v1/fill/w_980,h_568,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/68165d_d24c4fd9525a4619ac72c26a129c9553~mv2.png)
Next
![](https://static.wixstatic.com/media/68165d_709f4e285987479a9c57e80e9fb6c148~mv2.png/v1/fill/w_980,h_562,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/68165d_709f4e285987479a9c57e80e9fb6c148~mv2.png)
Next
![](https://static.wixstatic.com/media/68165d_a49402f09af6448482c43a5746e8807f~mv2.png/v1/fill/w_980,h_376,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/68165d_a49402f09af6448482c43a5746e8807f~mv2.png)
Next
![](https://static.wixstatic.com/media/68165d_e8266e4396e34b3ba4384eab49c56975~mv2.png/v1/fill/w_980,h_408,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/68165d_e8266e4396e34b3ba4384eab49c56975~mv2.png)
Nhập tên database, user, pass ở bước tạo database cho Icinga2 vào.
![](https://static.wixstatic.com/media/68165d_4188e262c8424b01af0e6102409eb3ba~mv2.png/v1/fill/w_980,h_568,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/68165d_4188e262c8424b01af0e6102409eb3ba~mv2.png)
Chọn Validate Configuration
![](https://static.wixstatic.com/media/68165d_f3be1f78c63748eaad7df86c4ba75d22~mv2.png/v1/fill/w_980,h_451,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/68165d_f3be1f78c63748eaad7df86c4ba75d22~mv2.png)
Chúng ta thấy successfully >> Next
![](https://static.wixstatic.com/media/68165d_1946f005d17e42989e2f8826d70e931c~mv2.png/v1/fill/w_980,h_467,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/68165d_1946f005d17e42989e2f8826d70e931c~mv2.png)
Transport Type chọn Local Command File >> Next
![](https://static.wixstatic.com/media/68165d_a1bffb934570477186438f0dfa9e1b24~mv2.png/v1/fill/w_980,h_422,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/68165d_a1bffb934570477186438f0dfa9e1b24~mv2.png)
Next
![](https://static.wixstatic.com/media/68165d_bfd45d9c0d1a4f5c8f9ac679fbf4636e~mv2.png/v1/fill/w_980,h_350,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/68165d_bfd45d9c0d1a4f5c8f9ac679fbf4636e~mv2.png)
Finish
![](https://static.wixstatic.com/media/68165d_b6ae164f375c4ed2adc609d537a2b27b~mv2.png/v1/fill/w_980,h_472,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/68165d_b6ae164f375c4ed2adc609d537a2b27b~mv2.png)
Login to Icinga Web 2
![](https://static.wixstatic.com/media/68165d_387e338e0903461c890dc7e1998eba28~mv2.png/v1/fill/w_980,h_443,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/68165d_387e338e0903461c890dc7e1998eba28~mv2.png)
Nhập Username và Password ở bước tạo tài khoản login vào Icinga Web
![](https://static.wixstatic.com/media/68165d_d266661981c44085bce347104a61e557~mv2.png/v1/fill/w_980,h_397,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/68165d_d266661981c44085bce347104a61e557~mv2.png)
Комментарии