标签:zabbix
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
标签:zabbix
原文地址:http://chenjunru.blog.51cto.com/5698966/1620156