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. 神经网络NN笔记

    参考:http://www.cnblogs.com/subconscious/p/5058741.html 俗话说,好记性不如烂笔头~~~~ 边学边记,方便以后查找~~~~~ 一.介绍一下经典的神经网 ...

  2. CSS文字不换行,溢出省略

    white-space:nowrap; overflow:hidden; text-overflow:ellipsis;

  3. iOS 去掉小数点后边多余的0

    -(NSString*)removeFloatAllZero:(NSString*)string { NSString * testNumber = string; NSString * outNum ...

  4. Safari不能连接到服务器

    系统偏好设置-网络-高级-代理,把"网页代理"和"安全网页代理"两个复选项去掉,最下面"使用被动FTP模式"复选项保留,即可解决!

  5. ASP.NET Cookie 概述

    什么是 Cookie? Cookie 是一小段文本信息,伴随着用户请求和页面在 Web 服务器和浏览器之间传递.Cookie 包含每次用户访问站点时 Web 应用程序都可以读取的信息. 例如,如果在用 ...

  6. xamarin android menu的用法

    在Android中的菜单有如下几种: OptionMenu:选项菜单,android中最常见的菜单,通过Menu键来调用 SubMenu:子菜单,android中点击子菜单将弹出一个显示子菜单项的悬浮 ...

  7. 程序员的自我救赎---1.4.1:核心框架讲解(DAL)

    <前言> (一) Winner2.0 框架基础分析 (二)PLSQL报表系统 (三)SSO单点登录 (四) 短信中心与消息中心 (五)钱包系统 (六)GPU支付中心 (七)权限系统 (八) ...

  8. Java之路第一步——第一行Java代码

    main()方法是Java应用程序的入口方法,也就是说,程序在运行的时候,第一个执行的方法就是main()方法. 名字必须是main: 必须是public static void 类型的: 必须接收一 ...

  9. 4、树莓派的中文:安装ftp,安装gcc,安装qt,编译qt程序,运行qt界面程序

    本博文仅作本人操作过程的记录,留作备忘.自强不息 QQ1222698 1.安装FTP:sudo apt-get install vsftpd 2.配置FTP,修改,/etc/vsftpd.conf # ...

  10. springBoot系列教程05:fastjson的集成、配置及使用

    springBoot自带的json用着不太习惯,已习惯了fastJSON,下面介绍下fastjson的配置 1. pom引入 <dependency> <groupId>com ...