Zabbix-server服務端安裝
安裝Zabbix官方源和epel源
rpm -ivh http://repo.zabbix.com/zabbix/2.2/rhel/6/x86_64/zabbix-release-2.2-1.el6.noarch.rpm
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
安裝Zabbix-Server
yum install -y zabbix zabbix-get zabbix-server zabbix-web-mysql zabbix-web zabbix-agent
安裝MySQL數據路服務
yum install -y mysql-server
修改MySQL配置文件:
vim /etc/my.cnf
[mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock user=mysql # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 character-set-server=utf8 #設置字符集爲utf-8 innodb_file_per_table=1 #讓innodb的每個表文件單獨存儲 [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid
啓動服務
chkconfig mysqld on
service mysqld start
查看服務是否啓動成功
ps aux |grep mysql
1、創建Zabbix的數據庫
設置MySQL的root用戶密碼
mysqladmin -uroot password admin mysql -uroot -padmin create database zabbix character set utf8; grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix'; flush privileges;
2、導入Zabbix-Server的數據庫
mysql -uzabbix -pzabbix
use zabbix
source /usr/share/doc/zabbix-server-mysql-2.2.8/create/schema.sql;
show tables;
配置zabbix_server.conf
vim /etc/zabbix/zabbix_server.conf
LogFile=/var/log/zabbix/zabbix_server.log LogFileSize=0 PidFile=/var/run/zabbix/zabbix_server.pid DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=zabbix DBSocket=/var/lib/mysql/mysql.sock StartPollers=5 SNMPTrapperFile=/var/log/snmptt/snmptt.log CacheSize=256M AlertScriptsPath=/usr/lib/zabbix/alertscripts ExternalScripts=/usr/lib/zabbix/externalscripts
查看修改後的參數
egrep -v "(^#|^$)" /etc/zabbix/zabbix_server.conf
mkdir /etc/zabbix/alertscripts /etc/zabbix/externalscripts
啓動Zabbix-Server服務
service zabbix-server start
service httpd start
添加開機啓動項
chkconfig zabbix-server on
chkconfig httpd on
防火牆、Selinux及權限的設置
1、防火牆的設置
vim /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 10051 -j ACCEPT -A OUTPUT -m state --state NEW -m tcp -p tcp --dport 10050 -j ACCEPT #-A INPUT -m state --state NEW -m tcp -p tcp --sport 10050 -j ACCEPT
service iptables restart
2、關閉Selinux
setenforce 0
getenforce #獲取當前Selinux的運行狀態
或直接關閉Selinux:
vim /etc/selinux/config
SELINUX=disabled (此方法需重啓服務器生效)
3、php.ini配置文件的設置
vim /etc/httpd/conf.d/zabbix.conf
php_value date:timezone Asia/Shanghai 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
service httpd restart
配置web界面
http://192.168.0.136/zabbix
Zabbix-Agent客戶端安裝
安裝Zabbix官方源
rpm -ivh http://repo.zabbix.com/zabbix/2.2/rhel/6/x86_64/zabbix-release-2.2-1.el6.noarch.rpm
安裝Zabbix-Agent客戶端
yum install -y zabbix zabbix-agent
關閉防火牆
iptables -F
配置zabbix_agentd.conf
egrep -v "(^#|^$)" /etc/zabbix/zabbix_agentd.conf
PidFile=/var/run/zabbix/zabbix_agentd.pid LogFile=/var/log/zabbix/zabbix_agentd.log LogFileSize=0 Server=127.0.0.1,192.168.0.136 ServerActive=192.168.0.136:10051 Hostname=Zabbix server Include=/etc/zabbix/zabbix_agentd.d/
chkconfig zabbix-agent on
service zabbix-agent start