标签:zabbix 安装
1.安装lamp
yum -y install gcc gcc-c++ autoconf httpd php mysql mysql-server php-mysql
httpd-manual mod_ssl mod_perl mod_auth_mysql php-gd php-xml php-mbstring php-ldap
php-pear php-xmlrpc php-bcmath mysql-connector-odbc mysql-devel libdbi-dbd-mysql
net-snmp-devel curl-devel unixODBC-devel OpenIPMI-devel java-devel
2.修改php.ini
date.timezone = Asia/Shanghai
max_execution_time = 300
post_max_size = 32M
max_input_time=300
memory_limit = 128M
mbstring.func_overload = 2
3.下载最新的zabbix版本
wget http://netix.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.4.7/zabbix-2.4.7.tar.gz
4.添加zabbix用户
groupadd zabbix -g 201
useradd -g zabbix -u 201 -m zabbix
5.编译安装
./configure --prefix=/usr --sysconfdir=/etc/zabbix --enable-server --enable-proxy --enable-agent --enable-ipv6 --with-mysql=/usr/bin/mysql_config --with-net-snmp --with-libcurl --with-openipmi --with-unixodbc --with-ldap --with-ssh2 --enable-java
make && make install
6.添加服务
vim /etc/services
zabbix-agent 10050/tcp #Zabbix Agent
zabbix-agent 10050/udp #Zabbix Agent
zabbix-trapper 10051/tcp #Zabbix Trapper
zabbix-trapper 10051/udp #Zabbix Trapper
7.导入数据
create database zabbix character set utf8;
grant all privileges on zabbix.* to zabbix@localhost identified by ‘zabbix‘;
flush privileges;
cd /home/software/zabbix-2.4.7/database
mysql -uzabbix -pzabbix zabbix < mysql/schema.sql
mysql -uzabbix -pzabbix zabbix < mysql/images.sql
mysql -uzabbix -pzabbix zabbix < mysql/data.sql
8.zabbix服务器的相关配置:
mkdir -p /var/log/zabbix
chown zabbix.zabbix /var/log/zabbix
cd /home/software/zabbix-2.4.7
cp misc/init.d/fedora/core/zabbix_* /etc/init.d/
chmod 755 /etc/init.d/zabbix_*
sed -i "s#BASEDIR=/usr/local#BASEDIR=/usr/#g" /etc/init.d/zabbix_server
sed -i "s#BASEDIR=/usr/local#BASEDIR=/usr/#g" /etc/init.d/zabbix_agentd
zabbix配置文件的zabbix_server.conf相关配置
/etc/zabbix/zabbix_server.conf
DBName=zabbix 数据库名称
DBUser=zabbix 数据库用户
DBPassword=zabbix 数据库密码
cat /etc/zabbix/zabbix_server.conf | grep -v "#" | grep -v "^$"
其他参数的配置:
LogFile=/var/log/zabbix/zabbix_server.log
DBHost=localhost
# DBName=zabbix
# DBUser=zabbix
# DBPassword=zabbix
# DBSocket=/var/lib/mysql/mysql.sock
DBPort=3306
StartPollers=160 # (测试环境默认值即可)
StartTrappers=20 # (测试环境默认值即可)
StartPingers=100 # (测试环境默认值即可)
StartDiscoverers=120 # (测试环境默认值即可)
MaxHousekeeperDelete=5000 # (测试环境默认值即可)
CacheSize=1024M # (测试环境默认值即可)
StartDBSyncers=16 # (测试环境默认值即可)
HistoryCacheSize=1024M # (测试环境默认值即可)
TrendCacheSize=1024M # (测试环境默认值即可)
HistoryTextCacheSize=512M # 说明:指定划出多少系统共享内存用于存储 character, text or log history数据,若二级代理内存足够,建议可适当扩大此数值,可很大程度上解决系统I/O压力,和数据库读压力
AlertScriptsPath=/etc/zabbix/alertscripts # 自定义的通知脚本路径
LogSlowQueries=1000
开启zabbix_server服务
错误日志
/var/log/zabbix/zabbix_server.log
如果报错可以开始debug模式
DebugLevel=4
9.客服端的配置文件
/etc/zabbix/zabbix_agentd.conf
Server=127.0.0.1 此处添加服务端的ip,如服务器不为本机,则需要填写远端zabbix_server的ip 地址
ServerActive=127.0.0.1 此处修改为服务端的ip
/tmp/zabbix_agentd.log 修改日志路径
UnsafeUserParameters=0 默认是不启用自定义脚本功能的,要自定义key,需开启,设置为1
Include=/etc/zabbix/zabbix_agentd.conf.d/ 自定义的agentd 配置文件可以写在这个目录下面
LogFile=/var/log/zabbix/zabbix_agentd.log
EnableRemoteCommands=0
Server=127.0.0.1,192.168.1.89
StartAgents=8
ServerActive=192.168.1.89:10051,192.168.1.253:10051
Hostname=nat.kx1d.com
Timeout=30
Include=/etc/zabbix/zabbix_agentd.conf.d/
UnsafeUserParameters=1
工作模式:
Server 是采用被动工作模式,允许访问的ip 地址,server 端要获取数据,当然得允许server 端了
ServerActive 是采用主动工作模式,将数据上传到哪台服务器,需要填写server 的端口,默认是10051
语法是ip1,ip2 可以填写多个server 端,中间用逗号隔开
10.拷贝网页文件到apache 目录
cp -r ./frontends/php/ /var/www/html/zabbix
chown -R apache.apache /var/www/html/zabbix
chkconfig zabbix_server on
chkconfig zabbix_agentd on
service zabbix_server start
service zabbix_agentd start
相关参考
http://www.techsiteanalytics.com/index.php/2013/08/19/6458
http://waringid.blog.51cto.com/65148/955939/
zabbix_server 配置文件参数解释
http://www.51ou.com/browse/zabbix/53885_6.html
监控的相关问题
http://www.ttlsa.com/monitor-safe/monitor/
本文出自 “SQLServer MySQL” 博客,请务必保留此出处http://dwchaoyue.blog.51cto.com/2826417/1840547
标签:zabbix 安装
原文地址:http://dwchaoyue.blog.51cto.com/2826417/1840547