top of page

HƯỚNG DẪN CÀI ĐẶT ICINGA2 VÀ ICINGA WEB 2 TRÊN CENTOS 7

Writer's picture: Tuan NguyenTuan Nguyen

Updated: Nov 17, 2018



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

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


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.

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


Tick vào monitor >> Next


Kiểm tra các yêu cầu.


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

Refresh lại.


Nếu bị lỗi này thì tắt Selinux.


Next


Next


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)


Bấm Validate Configuration >> Thông báo thành công >> Next


Next


Tạo username và mật khẩu để login vào web >> Next


Chọn như hình >> Next


Next


Next


Next


Nhập tên database, user, pass ở bước tạo database cho Icinga2 vào.


Chọn Validate Configuration


Chúng ta thấy successfully >> Next


Transport Type chọn Local Command File >> Next


Next


Finish


Login to Icinga Web 2


Nhập Username và Password ở bước tạo tài khoản login vào Icinga Web


16 views0 comments

Комментарии


 

© 2018 by Tuấn Nguyễn

 Liên hệ tôi
  • Facebook - Black Circle
  • Google+ - Black Circle
bottom of page