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. 《程序设计方法》【PDF】下载

    内容简介 <程序设计方法>主要以方法为主导,结合C语言,把程序设计方法学研究中若干成熟的理论和方法用通俗易懂的语言描述出来.<程序设计方法>还选取趣味性强.技巧性高.能够启发学 ...

  2. 2.python数据类型

    1 Number(数字) 2   字符串类型(string)   字符串内置方法 # string.capitalize() 把字符串的第一个字符大写 # string.center(width) 返 ...

  3. 《Office 365 开发入门指南》公开邀请试读,欢迎反馈

    终于等来了这一天,可以为我的这本新书画上一个句号.我记得是在今年的2月份从西雅图回来之后,就萌发了要为中国的Office 365开发人员写一些东西并最终能帮到更多中国用户的想法,而从2月26日正式写下 ...

  4. 【Zookeeper】源码分析目录

    Zookeeper源码分析目录如下 1. [Zookeeper]源码分析之序列化 2. [Zookeeper]源码分析之持久化(一)之FileTxnLog 3. [Zookeeper]源码分析之持久化 ...

  5. SpringMVC总结

    本文是对慕课网上"搞定SSM开发"路径的系列课程的总结,详细的项目文档和课程总结放在github上了.点击查看 MVC简介 Model-View-Control,MVC是一种架构模 ...

  6. 基于telegraf+influxdb+grafana进行postgresql数据库监控

    前言 随着公司postgresql数据库被广泛应用,尤其是最近多个项目在做性能测试的时候都是基于postgresql的数据库,为了确定性能瓶颈是否会出现在数据库中,数据库监控也被我推上了日程.在网上找 ...

  7. 从一个word文件中读取所有的表格和标题(1)

    首先讲需求: 从word文件中读表格里的数据,然后插入数据库中.word文件中的表格是带有标题的,把标题读出来,进行匹配数据库. 需求分析: word2007底层是以xml文件存储的,所以分析xml的 ...

  8. Linux发行版 CentOS6.5下删除分区操作

    本文地址http://comexchan.cnblogs.com/,作者Comex Chan,尊重知识产权,转载请注明出处,谢谢!   有时候,发现分区分错了.需要删除分区,只需按照分区的步骤逆向操作 ...

  9. 论文笔记-Squeeze-and-Excitation Networks

    作者提出为了增强网络的表达能力,现有的工作显示了加强空间编码的作用.在这篇论文里面,作者重点关注channel上的信息,提出了"Squeeze-and-Excitation"(SE ...

  10. 在IIS使用localDB

    项目使用localdb来作为本机测试数据库,发布到本机IIS后项目却链接不到数据库,查看windows日志为如下错误 "无法获取本地应用程序数据路径.很可能是因为未加载用户配置文件.如果在 ...