Install Zabbix 4.2 在 RHEL7
常見的開源監控軟體,有Zabbix、Nagios、Prometheus.......。
其中 Zabbix Server非常容易安裝,參考原廠安裝手冊,以下分享整個安裝過程與詳細指令。一個小時內可以完成安裝設定。
安裝元件介紹
使用標準的LAMP組合
- RHEL7
- Apache
- MySQL (Mariadb 5.5)
- PHP
- zabbix-4.2-2.el7 rpm pacakge
關閉Linux防火牆
systemctl stop firewalldsystemctl disable firewalld
SELinux
To do this edit the "/etc/selinux/config" file, making sure the SELINUX flag is set as follows.If SELinux is configured after installation, the server will need a reboot for the change to take effect.
SELINUX=permissive
getenforce
setenforce permissive
getenforce
Frontend installation prerequisites
Zabbix frontend requires additional packages not available in basic installation. You need to enable repository of optional rpms in the system you will run Zabbix frontend on:ll /etc/yum.repos.d/
vi public-yum-ol7.repo
[root@aot-zbx02 yum.repos.d]# vi public-yum-ol7.repo
[ol7_optional_latest]
name=Oracle Linux $releasever Optional Latest ($basearch)
baseurl=https://yum.oracle.com/repo/OracleLinux/OL7/optional/latest/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1
安裝MariaDB
yum repolistyum list mariadb*
yum install mariadb*
安裝 php, httpd
yum install nmap httpd policycoreutils-python net-snmp net-snmp-utils php-bcmath php-mbstring php-xml curl curl-devel net-snmp-devel perl-DBIyum install php php-gd php-ldap php-mysql php-odbc php-pdo php-pear php-pecl-memcache php-soap php-xmlrpc
Start MariaDB
systemctl start mariadbsystemctl enable mariadb
systemctl status mariadb
修改資料庫root密碼 (選用)
mysqladmin -uroot password 1234qwerAdding Zabbix repository
rpm -Uvh http://repo.zabbix.com/zabbix/4.2/rhel/7/x86_64/zabbix-release-4.2-2.el7.noarch.rpmInstall Zabbix Server, Zabbix Forntend and Zabbix Agent
yum install zabbix-server-mysql zabbix-web-mysql zabbix-agentCreating database
MySQL - Character set utf8 and utf8_bin collation is required for Zabbix server to work properly with MySQL database.mysql -uroot
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
Importing data
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -pzabbix zabbixmysql -uzabbix -pzabbix zabbix
mysql> SELECT
table_name AS `Table`,
round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB`
FROM information_schema.TABLES
WHERE table_schema = "zabbix";
Configure database for Zabbix server
vi /etc/zabbix/zabbix_server.confLogFileSize=10
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
Starting Zabbix server process
systemctl start zabbix-serversystemctl enable zabbix-server
systemctl status zabbix-server
Zabbix frontend configuration
For RHEL 7 and later the Apache configuration file for Zabbix frontend is located in /etc/httpd/conf.d/zabbix.conf.vi /etc/httpd/conf.d/zabbix.conf
# php_value date.timezone Europe/Riga
php_value date.timezone Asia/Taipei
systemctl start httpd
systemctl enable httpd
Frontend installation steps
Allow you to access your newly installed Zabbix.Note that a Zabbix proxy does not have a frontend; it communicates with Zabbix server only.
http://zabbix-frontend-hostname/zabbix
Enter password of zabbix
Configure and start Zabbix Agent
vi /etc/zabbix/zabbix_agentd.conf
LogFileSize=10
Server=127.0.0.1
ServerActive=127.0.0.1
Hostname=Zabbix server
systemctl start zabbix-agent
systemctl status zabbix-agent
systemctl enable zabbix-agent
All jobs are completed
Zabbix frontend is available at http://zabbix-frontend-hostname/zabbix in the browser. Default username/password is Admin/zabbix.
沒有留言:
張貼留言