3.3.1 zabbix proxy安装(源码方式)

1.创建目录

mkdir -p /usr/local/zabbix

2.安装必要软件

yum install -y fping(若安装不成功) 或 wget http://pkgs.repoforge.org/fping/fping-3.1-1.el6.rf.i686.rpm

yum install -y gcc make cmake mysql-server mysql-devel php php-gd php-devel php-mysql php-bcmath php-ctytpe php-xml php-xmlreader php-xlmwriter php-session php-net-socket php-mbstring php-gettext httpd net-snmp curl curl-devel net-snmp net-snmp-devel perl-DBI libxml libxml2-devel

3. 添加用户

groupadd zabbix
useradd -g zabbix zabbix -s /sbin/nologin

4. 创建数据库

service mysqld start
mysql -uroot -p
>create database zabbix_proxy default charset utf8;
> grant all on zabbix_proxy.* to zabbix@localhost identified by 'zabbix';
>flush privileges;
>exit

5. 导入数据库中的表

cd /root/zabbix-2.2./database/mysql
# mysql -uzabbix -pzabbix zabbix < schema.sql (proxy端只需要这一步,不需要数据)

6. 编译安装(proxy和client)

proxy:
cd /root/zabbix-2.2.
./configure --enable-agent --enable-proxy --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 --prefix=/usr/local/zabbix
make && make install agent:
cd /root/zabbix-2.2.4
./configure --enable-agent --prefix=/usr/local/zabbix
make && make install

7. 编辑配置文件(zabbix_proxy)

cd /usr/local/zabbix/etc/

vi /usr/local/zabbix/etc/zabbix_proxy.conf
Server=192.168.1.100
Hostname=db-proxy
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
ProxyLocalBuffer=
ProxyOfflineBuffer=
ConfigFrequency=
DataSenderFrequency=
StartPollers=
StartIPMIPollers=
StartPollersUnreachable=
StartTrappers=
StartPingers=
StartHTTPPollers=
StartVMwareCollectors=
VMwareCacheSize=40M
StartSNMPTrapper=
CacheSize=100M
StartDBSyncers=
HistoryCacheSize=100M
HistoryTextCacheSize=200M
Timeout=
LogSlowQueries=
AllowRoot=

8. 配置proxy的agent文件

vi /usr/local/zabbix/etc/zabbix_agentd.conf修改如下内容:
Server=192.168.1.100
ServerActive=192.168.1.100
Hostname=db-proxy
RefreshActiveChecks=
MaxLinesPerSecond=
Timeout=
AllowRoot=
UnsafeUserParameters=
UserParameter=system.agent.checkSecure,/usr/local/ServerScript/check_secure.sh

9. 添加到services

# vi /etc/services
在文件最后面添加如下的内容:
zabbix-agent /tcp # Zabbix Agent
zabbix-agent /udp # Zabbix Agent
zabbix-trapper /tcp # Zabbix Trapper
zabbix-trapper /udp # Zabbix Trapper

10. 启动守护进程

vi /etc/init.d/zabbix_proxy
vi /etc/init.d/zabbix_agentd
添加后面的脚本
chmod a+x /etc/init.d/zabbix_proxy
chmod a+x /etc/init.d/zabbix_agentd
service zabbix_proxy start
service zabbix_agentd start

11. 添加开机启动

chkconfig zabbix_proxy on
chkconfig zabbix_agentd on

12. 允许10050和10051通过防火墙

iptables -A INPUT -p tcp --dport  -j ACCEPT
iptables -A INPUT -p tcp --dport -j ACCEPT
或者关闭防火墙
service iptables stop
setenforce

13. 启动服务

service zabbix_proxy start
service zabbix_agentd start

3.3.2 Agent端配置

1.修改客户(agent)端配置文件

vi /usr/local/zabbix/etc/zabbix_agentd.conf
PidFile=/var/run/zabbix/zabbix_agented_om.pid
LogFile=/var/log/zabbix/zabbix_agented_om.log
LogFileSize=
Server=10.19.1.18
ListenPort=
ServerActive=10.19.1.18
Hostname=db-proxy
Include=/etc/zabbix_agentd_om/etc/zabbix_agentd.conf.d/

2.重启客户端

service zabbix_agentd restart

3.脚本zabbix_proxy

 #!/bin/sh
# chkconfig:
# desctription: Zabbix Proxy
# Zabbix
# Copyright (C) - Zabbix SIA
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., Franklin Street, Fifth Floor, Boston, MA -, USA. # Start/Stop the Zabbix agent daemon.
# Place a startup script in /sbin/init.d, and link to it from /sbin/rc[].d SERVICE="Zabbix proxy"
DAEMON=/usr/local/zabbix/sbin/zabbix_proxy
PIDFILE=/tmp/zabbix_agentd.pid
BASEDIR=/usr/local/zabbix/
ZABBIX_AGENTD=$BASEDIR/sbin/zabbix_proxy
case $ in
'start')
if [ -x ${DAEMON} ]
then
$DAEMON
# Error checking here would be good...
echo "${SERVICE} started."
else
echo "Can't find file ${DAEMON}."
echo "${SERVICE} NOT started."
fi
;;
'stop')
if [ -s ${PIDFILE} ]
then
if kill `cat ${PIDFILE}` >/dev/null >&
then
echo "${SERVICE} terminated."
rm -f ${PIDFILE}
fi
fi
;;
'restart')
$ stop
sleep
$ start
;;
*)
echo "Usage: $0 start|stop|restart"
;;
esac

4.脚本zabbix_agentd

 #!/bin/sh
#chkconfig:
#description:Zabbix agent
# Zabbix
# Copyright (C) - Zabbix SIA
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., Franklin Street, Fifth Floor, Boston, MA -, USA. # Start/Stop the Zabbix agent daemon.
# Place a startup script in /sbin/init.d, and link to it from /sbin/rc[].d SERVICE="Zabbix agent"
DAEMON=/usr/local/zabbix/sbin/zabbix_agentd
PIDFILE=/tmp/zabbix_agentd.pid
BASEDIR=/usr/local/zabbix
ZABBIX_AGENTD=$BASEDIR/sbin/zabbix_agentd case $ in
'start')
if [ -x ${DAEMON} ]
then
$DAEMON
# Error checking here would be good...
echo "${SERVICE} started."
else
echo "Can't find file ${DAEMON}."
echo "${SERVICE} NOT started."
fi
;;
'stop')
if [ -s ${PIDFILE} ]
then
if kill `cat ${PIDFILE}` >/dev/null >&
then
echo "${SERVICE} terminated."
rm -f ${PIDFILE}
fi
fi
;;
'restart')
$ stop
sleep
$ start
;;
*)
echo "Usage: $0 start|stop|restart"
;;
Esac

3.3.2 zabbix proxy安装(yum安装方式简要安装)

1、安装yum源

yum clean all
rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/6/x86_64/zabbix-release-3.0-1.el6.noarch.rpm
rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm

2、安装proxy和agent

yum install zabbix-proxy-3.0.   zabbix-proxy-mysql-3.0.  zabbix-agent-3.0.
yum install zabbix-agent-3.0.

3、导入表文件

mysql -uzabbix -pzabbix zabbix_proxy < schema.sql 
 

4、数据库授权

use mysql
grant all privileges on *.* to root@"%" identified by "EhqSDFW{OZzS7XX";
update user set password= password('EhqW{OZSFDzS7XX') where user='root';
flush privileges; create database zabbix_proxy default charset utf8;
grant all on zabbix_proxy.* to zabbix@localhost identified by 'zabbix';
flush privileges;

5、配置proxy

cat /etc/zabbix/zabbix_proxy.conf

LogFile=/var/log/zabbix/zabbix_proxy.log
PidFile=/var/log/zabbix/zabbix_proxy.pid
Server=172.29.31.112
Hostname=gz-qxg-proxy
DBName=zabbix_proxy
DBUser=zabbix
DBPassword=zabbix
ProxyLocalBuffer=
ProxyOfflineBuffer=
ConfigFrequency=
DataSenderFrequency=
StartPollers=
StartIPMIPollers=
StartPollersUnreachable=
StartTrappers=
StartPingers=
StartHTTPPollers=
StartVMwareCollectors=
VMwareCacheSize=40M
StartSNMPTrapper=
CacheSize=256M
StartDBSyncers=
HistoryCacheSize=256M
Timeout=
LogSlowQueries=

6、启动服务

启动proxy
service zabbix-proxy start
 
启动agent
service zabbix-agent  start
 
 

Zabbix实战-简易教程(5)--Proxy和Agent端(源码和yum方式)的更多相关文章

  1. Zabbix实战-简易教程(6)--Server端高可用

    3.4 server前端高可用    至此,单台Zabbix server环境已经搭建完成,为了达到高可用效果,我们需要通过2台服务器之间通过HA软件进行探测,一旦检测到主的server挂掉后,从的s ...

  2. Zabbix实战-简易教程(4)--Server端安装

    在数据库安装完成后,接着开始安装server端了.我们这里采用yum安装. 3.2.0 安装需求 ● PHP 5.6.18 ● curl 7.47.1 ● zabbix_server (Zabbix) ...

  3. Zabbix实战-简易教程系列

    一.基础篇(安装和接入) Zabbix实战-简易教程--总流程  Zabbix实战-简易教程--整体架构图 Zabbix实战-简易教程--DB安装和表分区 Zabbix实战-简易教程--Server端 ...

  4. Zabbix实战-简易教程--排错(持续收集中)

    一.安装错误 1.zabbix 安装故障之无法跳到下一步或点击下一步没反应 执行命令:chownnginx:nginx /var/lib/php/session/ -R   2.proxy上无法采集交 ...

  5. Zabbix实战-简易教程--动作(Actions)--自动注册

    一.概述 之前已经讲述了自动发现功能,自动注册和自动发现非常类似,但是比自动发现更精确.因为自动注册,是在Agent上自定义元数据,然后Agent将元数据发送给server进行匹配,如果匹配一致,则进 ...

  6. Zabbix实战-简易教程--WEB类--Nginx

    一.开启Nginx status状态 1.在默认主机里面加上location添加ngx_status 如下操作: server { listen 127.0.0.1:8080; server_name ...

  7. Zabbix实战-简易教程--日志类

    一.主动模式和被动模式介绍 要监控日志,必须使用主动模式,那么,什么是主动模式?什么是被动模式呢? 1.主动模式和被动模式 主动模式 主动模式通讯过程: ● Agent打开TCP连接(主动检测变成Ag ...

  8. Zabbix实战-简易教程--中间件ZooKeeper监控

    一.监控思路 通过zabbix trapper方式监控,之前看到网友们都是通过定时任务进行主动上传数据,但是,zabbix还有另外一神器--自动发现,也能达到同样的功能. 二.实现步骤 1.准备脚本 ...

  9. Zabbix实战-简易教程--中间件RabbitMQ监控

    一.环境 zabbix版本:3.0 二.脚本说明 .├── rabbitmq.template.xml   模板文件├── scripts  │   └── rabbitmq│   ├── api.p ...

随机推荐

  1. 「mysql优化专题」主从复制面试宝典!面试官都没你懂得多!(11)

    内容较多,可先收藏,目录如下: 一.什么是主从复制 二.主从复制的作用(重点) 三.主从复制的原理(重中之重) 四.三步轻松构建主从 五.必问面试题干货分析(最最重要的点) 一.什么是主从复制(技术文 ...

  2. spring boot部署系统--morphling简介

    Morphling 简介 Morphling是一套基于Spring Boot 1.5开发的部署系统,依赖简单,一套Mysql即可运行,操作简单明了,适用于百台规模几下机器的运维操作 功能概述 系统部署 ...

  3. dubbo服务治理中间件,zookeeper注册中心

    对传统项目架构进行拆分: 集群概念: 面向服务分布式架构: 服务层提供被注册的对象需要实现序列化接口Serializable: 配置表现层和服务层: 依赖包: 服务层: <!-- 定义dubbo ...

  4. 肖秀荣8套卷2018pdf下载|2018肖秀荣冲刺8套卷pdf下载电子版

    肖秀荣8套卷2018pdf下载|2018肖秀荣冲刺8套卷pdf下载电子版 下载链接: https://u253469.ctfile.com/fs/253469-229815828

  5. ORACLE环境变量设置

    用oracle帐号登录,配置相关环境变量: vi .bash_profile export ORACLE_BASE=/u01/app/oracleexport ORACLE_HOME=/u01/app ...

  6. BZOJ 4819 新生舞会

    第一句话:算出3.363636的孩子啊,你跑错流种了. 貌似上一篇我讲SDOI出原题?嘿还真是! 半个月前有一个叫WG的男人给我们搞过一场考试... ... 里面有一道题叫做保密... ...SDOI ...

  7. 微信JS-SDK使用步骤(以微信扫一扫为例)

    概述: 微信JS-SDK是微信公众平台面向网页开发者提供的基于微信内的网页开发工具包. 通过使用微信JS-SDK,网页开发者可借助微信高效地使用拍照.选图.语音.位置等手机系统的能力,同时可以直接使用 ...

  8. vue2 vue-rout

    vue 2.0的路由比起1.0简单了许多,分为以下几个步骤: 1.创建路由块和视图块: to里面是要切换的路径名称 <div id="app"> <div> ...

  9. Qt编写QUI皮肤生成器

    用Qt写项目写多了,为了满足不同客户的需求,需要定制不同样式的界面,QUI皮肤生成器应运而生.思考这个工具的架构花了一年时间,如何从复杂的配色方案中提取出共性,然后将共性转为具体的QSS文件.思考架构 ...

  10. hiberation4 获取session

    T t; Configuration cfg = new Configuration(); cfg.configure(); ServiceRegistry serviceRegistry = new ...