zabbixt安装
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了zabbixt安装相关的知识,希望对你有一定的参考价值。
Zabbix监控分为两部分,一部分为server服务端,另一部分为agentd客户端。
Zabbix Server ip:192.168.8.10
Zabbix agentd ip:192.168.8.11
centos需要的packages安装详见
http://thankinglove.blog.51cto.com/2311485/1791783
mysql安装详见
http://thankinglove.blog.51cto.com/2311485/1791790
nginx安装详见
http://thankinglove.blog.51cto.com/2311485/1792183
1.Zabbix Server服务端安装
//安装需要的包及库 yum install -y net-snmp-devel libxml2-devel libcurl-devel //源码包放置目录 cd /usr/local/src //脚本自动安装Zabbix Server cat /usr/local/src/zabbixserver.sh cat /etc/group | grep ‘^zabbix‘ if [ $? -ne 0 ] then groupadd zabbix fi cat /etc/passwd | grep ‘^zabbix:‘ if [ $? -ne 0 ] then useradd zabbix -s /sbin/nologin -g zabbix -M fi cd /usr/local/src tar xzvf zabbix-2.2.13.tar.gz cd zabbix-2.2.13 ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql\ --with-net-snmp --with-libcurl --with-libxml2 make make install cp misc/init.d/fedora/core/zabbix_agentd /etc/init.d/ cp misc/init.d/fedora/core/zabbix_server /etc/init.d/ chmod +x /etc/init.d/zabbix_agentd chmod +x /etc/init.d/zabbix_server sed -i ‘s#BASEDIR=/usr/local#BASEDIR=/usr/local/zabbix#‘ /etc/init.d/zabbix_server sed -i ‘s#PIDFILE=/tmp/$BINARY_NAME.pid#PIDFILE=/usr/local/zabbix/logs/zabbix_server.pid#‘ /etc/init.d/zabbix_server sed -i ‘s#BASEDIR=/usr/local#BASEDIR=/usr/local/zabbix#‘ /etc/init.d/zabbix_agentd sed -i ‘s#PIDFILE=/tmp/$BINARY_NAME.pid#PIDFILE=$BASEDIR/logs/zabbix_agentd.pid#‘ /etc/init.d/zabbix_agentd mkdir -p /usr/local/zabbix/logs chown -R zabbix:zabbix /usr/local/zabbix mkdir -p /usr/local/nginx/html/zabbix cp -rp frontends/php/* /usr/local/nginx/html/zabbix
修改zabbix server配置文件
cat /usr/local/zabbix/etc/zabbix_server.conf | grep -v "^#" | grep -v ^$ LogFile=/usr/local/zabbix/logs/zabbix_server.log PidFile=/usr/local/zabbix/logs/zabbix_server.pid DBHost=127.0.0.1 DBName=zabbix DBUser=zabbix DBPassword=zabbix DBSocket=/var/lib/mysql/mysql.sock DBPort=3306 ListenIP=0.0.0.0
登入mysql,创建zabbix数据库及导入zabbix数据
//MYSQL_USER:mysql用户名, //MYSQL_PASSWORD:mysql用户密码 /usr/local/mysql/bin/mysql -u $MYSQL_USER -p$MYSQL_PASSWORD -e "create database zabbix default charset utf8" //导入zabbix数据,顺序不能弄错 /usr/local/mysql/bin/mysql -u$MYSQL_USER -p$MYSQL_PASSWORD zabbix < database/mysql/schema.sql /usr/local/mysql/bin/mysql -u$MYSQL_USER -p$MYSQL_PASSWORD zabbix < database/mysql/images.sql /usr/local/mysql/bin/mysql -u$MYSQL_USER -p$MYSQL_PASSWORD zabbix < database/mysql/data.sql //创建mysql的zabbix用户 /usr/local/mysql/bin/mysql -u $MYSQL_USER -p$MYSQL_PASSWORD -e "grant all on zabbix.*" to ‘zabbix‘@127.0.0.1 identified by ‘zabbix‘ /usr/local/mysql/bin/mysql -u $MYSQL_USER -p$MYSQL_PASSWORD -e "flush privileges"
启动zabbix server及重启mysql
service zabbix_server start service mysql restart
检查zabbix server启动是否成功
netstat -tnlp | grep :10051
2.Zabbix agentd客户端安装
//脚本安装zabbix agentd cat /usr/local/src/zabbixagentd.sh cat /etc/group | grep ‘^zabbix‘ if [ $? -ne 0 ] then groupadd zabbix fi cat /etc/passwd | grep ‘^zabbix:‘ if [ $? -ne 0 ] then useradd zabbix -s /sbin/nologin -g zabbix -M fi cd /usr/local/src tar xzvf zabbix-2.2.13.tar.gz cd zabbix-2.2.13 ./configure --prefix=/usr/local/zabbix --enable-agent check_ok configure make make install cp misc/init.d/fedora/core/zabbix_agentd /etc/init.d/ chmod +x /etc/init.d/zabbix_agentd sed -i ‘s#BASEDIR=/usr/local#BASEDIR=/usr/local/zabbix#‘ /etc/init.d/zabbix_agentd sed -i ‘s#PIDFILE=/tmp/$BINARY_NAME.pid#PIDFILE=$BASEDIR/logs/zabbix_agentd.pid#‘ /etc/init.d/zabbix_agentd sed -i ‘/PidFile=\/tmp\/zabbix_agentd.pid/ a PidFile=\/usr\/local\/zabbix\/logs\/zabbix_agentd.pid‘ /usr/local/zabbix/etc/zabbix_agentd.conf sed -i ‘s#LogFile=/tmp/zabbix_agentd.log#LogFile=/usr/local/zabbix/logs/zabbix_agentd.log#‘ /usr/local/zabbix/etc/zabbix_agentd.conf mkdir -p /usr/local/zabbix/logs chown -R zabbix:zabbix /usr/local/zabbix
修改zabbix agentd配置文件
cat /usr/local/zabbix/etc/zabbix_agentd.conf | grep -v "^#" | grep -v ^$ PidFile=/usr/local/zabbix/logs/zabbix_agentd.pid LogFile=/usr/local/zabbix/logs/zabbix_agentd.log Server=192.168.8.10 ServerActive=192.168.8.10 Hostname=192.168.8.11
启动zabbix agentd
service zabbix_agentd start
检查zabbix agentd启动是否成功
netstat -tnlp | grep :10050
本文出自 “ubuntu” 博客,请务必保留此出处http://thankinglove.blog.51cto.com/2311485/1793276
以上是关于zabbixt安装的主要内容,如果未能解决你的问题,请参考以下文章
在Tomcat的安装目录下conf目录下的server.xml文件中增加一个xml代码片段,该代码片段中每个属性的含义与用途
Android 插件化VirtualApp 源码分析 ( 目前的 API 现状 | 安装应用源码分析 | 安装按钮执行的操作 | 返回到 HomeActivity 执行的操作 )(代码片段