zabbix安裝步驟
zabbix3.4 安裝
為了簡單起見,以下的安裝將zabbix-server,zabbix-agent和mariadb數據庫裝在同一臺服務器中,並通過使用yum源的方式來進行快速搭建zabbix服務。
測試系統環境:CentOS Linux release 7.3.1611 (Core)
搭建服務之前,大家可以查看一下自己服務器的版本號:
[[email protected] yum.repos.d]# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
Yum源安裝:
# rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm
服務器端安裝
# yum install zabbix-server-mysql zabbix-web-mysql
# yum install mariadb-server -y 安裝mariadb數據庫
# mysqladmin -uroot password ‘<password>‘ 修改數據庫的root密碼
# mysql -uroot -p<password>
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to [email protected] identified by ‘<password>‘;
mysql> quit
#zcat /usr/share/doc/zabbix-server-mysql-3.4.0/create.sql.gz | mysql -uzabbix -p zabbix 導入zabbix所需要的表
Configure database for Zabbix server
# vi /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=<password>
#systemctl start zabbix-server
註意關閉selinux,否則啟動報錯。
關閉selinux步驟如下:
vi /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=permissive 將此處的SELINUX=enforcing為permissive
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
修改完配置文件以後使用setenforce命令來即時修改配置
# setenforce 0
查看是否修改成功:
getenforce(或者sestatus),如:
# sestatus
[[email protected] ~]# sestatus
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: permissive
Mode from config file: permissive
Policy MLS status: enabled
Policy deny_unknown status: allowed
Max kernel policy version: 28
zabbix的PHP的前端配置
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value always_populate_raw_post_data -1
php_value date.timezone Asia/Shanghai 此處為自己修改的時區
#systemctl start httpd
http://<server_ip_or_name>/zabbix 進行前端配置安裝,zabbix默認的用戶為Admin,密碼為zabbix
需要關閉防火墻,否則無法訪問頁面,關閉防火墻:
#systemctl stop firewalld.service
zabbix代理安裝 (代理端用於使用監控主機)
# yum install zabbix-agent
# service zabbix-agent start
註意:在後面的創建Item過程中,選擇Key時,要將選擇的system.cpu.load[<cpu>,<mode>]的key值修改成system.cpu.load,否則會報Invalid first parameter的錯誤。
本文出自 “zhangleivod” 博客,請務必保留此出處http://9980200.blog.51cto.com/9970200/1971768
zabbix安裝步驟