一、需求

  zabbix 服务器可以手动加入zabbix-agent客户端,对于少量的机器,这没有什么。但到了线上,我们有大量的服务器需要监控时,如果再一个个的手动加的话,工作量势必会增加很多。这时,zabbix-server 的Discovery 自动发现 功能便派上了用场。

二、条件

  1.zabbix server 已经部署好,所需要加入的服务器zabbix-agent已经安装。

  2.防火墙都开放端口,主要是10050、10051端口,或者关闭整个iptables

三、zabbix-agent客户端的设置

  1.打开zabbix-agent.conf配置文件,只需要修改2处配置.大批量的修改,可以利用自动化部署工具、如saltstack、ansible等。我用的是saltstack推送文件的方式进行修改,在本实验环境中,我用的是国产的一个批量工具CheungSSH。

  2.批量执行的命令

sed -i 's/Server=127.0.0.1/Server=10.8.0.22/g' /etc/zabbix/zabbix_agentd.conf
sed -i 's/ServerActive=127.0.0.1/ServerActive=10.8.0.22/g' /etc/zabbix/zabbix_agentd.conf grep "Server" /etc/zabbix/zabbix_agentd.conf | grep -v '^#' service zabbix-agent restart

  上述命令完成后,要在zabbix-server上创建discover规则

四、zabbix-server 登陆web界面进行设置,创建规则,并自动加入,自动链接模板

  1.Configuration-->Discovery-->Create discovery rule


下面是创建规则时的具体参数,来自官网:

Parameter

Description

Name

Unique name of the rule. For example, “Local network”.

Discovery by proxy

What performs discovery:
no proxy -
Zabbix server is doing discovery
<proxy name> -
this proxy performs discovery

IP
range

The
range of IP addresses for discovery. It may have the following formats:
Single IP: 192.168.1.33
Range of IP addresses: 192.168.1-10.1-255. The range is limited by the total
number of covered addresses (less than 64K).
IP mask: 192.168.4.0/24
supported IP masks:
/16 - /30 for IPv4 addresses
/112 - /128 for IPv6 addresses
List: 192.168.1.1-255, 192.168.2.1-100, 192.168.2.200, 192.168.4.0/24
Since Zabbix 3.0.0 this field supports spaces, tabulation and multiple lines.

Delay
(in sec)

This
parameter defines how often Zabbix will execute the rule.
Delay is measured after the execution of previous discovery instance ends so
there is no overlap.

Checks

Zabbix
will use this list of checks for discovery.
Supported checks: SSH, LDAP, SMTP, FTP, HTTP, HTTPS,
POP, NNTP, IMAP, TCP, Telnet, Zabbix agent, SNMPv1 agent, SNMPv2 agent,
SNMPv3 agent, ICMP ping.
A protocol-based discovery uses the net.tcp.service[] functionality
to test each host, except for SNMP which queries an SNMP OID. Zabbix agent is
tested by querying an item. Please see agent items for more details.
The 'Ports' parameter may be one of following:
Single port: 22
Range of ports: 22-45
List: 22-45,55,60-70

Device
uniqueness criteria

Uniqueness
criteria may be:
IP address -
no processing of multiple single-IP devices. If a device with the same IP
already exists it will be considered already discovered and a new host will
not be added.
Type of discovery check -
either SNMP or Zabbix agent check.

Enabled

With
the check-box marked the rule is active and will be executed by Zabbix
server.
If unmarked, the rule is not active. It won't be executed.

  2.添加动作。自动添加主机到linux server 组,并链接模板Linux Os 。
  选择【Configuration】->【Actions】,在右边“Event source”选择“Discovery”,然后创建Action规则如下图所示:

  设置动作的 name:

  添加触发的Action的条件

A: ip 范围,或者某个ip,可以添加多个网段

D:agent的状态是up

C:服务类型是 zabbix-agent

  下面就是配置操作(Operations)。即符合条件后,进行的操作。

  操作主要有三个,添加主机、添加到server组、链接OS Liunx 模板,点击Add。后续的还可以添加sendmessage 等。

  3.观察MonitoringàDiscovery中,有没有机器加入进来。为了便于观察,我们之前设置的发现轮询的时间是60秒。如图:

上面是扫描发现的主机。6台客户端都已发现,下面的是自动链接到组和模板。

本文章属于本作者原创,遵循开源协议,如有转载,请注明本链接的源地址。谢谢    继续更新中!!

zabbix server的Discover功能,实现zabbix agent 大批量的自动添加,并链接到指定的模版(3)的更多相关文章

  1. CentOS 7 实现zabbix agent 自动添加,并链接到指定的模版

    如果添加的agent端数量较少时 , 手动添加还是可以的 , 如果数量较多 , 那么zabbix-server 的Discovery自动发现功能便派上了用场 首先所需要加入的服务器zabbix-age ...

  2. Centos 7.0 下安装 Zabbix server 3.0服务器的安装及 监控主机的加入(1)

    一.本系列分为6部分 1.Centos 7.0 下安装 Zabbix server 3.0服务器的安装及 监控主机的加入 2.Centos 6.5 下安装 Zabbix server 3.0服务器的安 ...

  3. zabbix server端与agent端源码安装 自定义监控项

    ZabbixServer的安装(只有源码装zabbix才能装支持java) 搭建自定义yum仓库并安装支持包 yum -y install createrepo #下载依赖关系命令 createrep ...

  4. zabbix server安装详解

    简介 zabbix(音同 zæbix)是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案. zabbix能监视各种网络参数,保证服务器系统的安全运营:并提供灵活的通知机制以 ...

  5. Centos 7.0_64bit 下安装 Zabbix server 3.0服务器的安装

    一.关闭selinux   修改配置文件/ etc / selinux / config,将SELINU置为禁用(disabled)   vim /etc/selinux/config  # This ...

  6. Centos 6.x 搭建 Zabbix Server

      zabbix(音同 zæbix)是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案. zabbix能监视各种网络参数,保证服务器系统的安全运营:并提供灵活的通知机制以让 ...

  7. 【Zabbix】Zabbix Server自动发现

    Zabbix自动发现 由于有上百台的虚拟机需要监控,如果一个个去添加配置,费时费力.Zabbix的自动发现,可以自动发现需要监控的机器,监控相应指标. 前置条件 安装部署好Zabbix Server. ...

  8. 【2】循序渐进学 Zabbix:安装配置 Zabbix Server 服务端

    上一篇 [1]循序渐进学 Zabbix :初识与基础依赖环境搭建( LNMP ) 安装 Zabbix Server 上篇我们在 192.168.200.101 上面安装了 Zabbix 所依赖的 LN ...

  9. 二、部署监控服务器-Zabbix Server

    二.部署监控服务器-Zabbix Server 1)源码安装Zabbix Server 多数源码包都是需要依赖包的,zabbix也- 样,源码编译前需要先安装相关依赖包. [root@zabbixse ...

随机推荐

  1. SpringMVC札集(06)——转发和重定向

    自定义View系列教程00–推翻自己和过往,重学自定义View 自定义View系列教程01–常用工具介绍 自定义View系列教程02–onMeasure源码详尽分析 自定义View系列教程03–onL ...

  2. React-Native基础_5.列表视图ListView

    列表视图ListView 用来显示垂直滚动列表,需要指定两个东西,1 数据的来源 dataSource,2 渲染列表的条目布局 rendRow 'use strict' import React, { ...

  3. awk命令结合管道命令对json文件进行统计分析

    json文件内容: $ head file.json {"B": 0.337, "C": 0.663, "name": "xxx& ...

  4. stark组件03

    优化代码 1:页面的增删改查url反转的封装到类里:ModelSatrk # 编辑页面的url def get_edit_url(self,obj): edit_url = reverse(" ...

  5. Hypergraph Models超图模型

    最近看了篇Paper(Hyperspectral Image Classification Through Bilayer Graph-Based Learning),里面出现了一个超图(Hyperg ...

  6. IOI2002 POJ1054 The Troublesome Frog 讨厌的青蛙 (离散化+剪枝)

    Description In Korea, the naughtiness of the cheonggaeguri, a small frog, is legendary. This is a we ...

  7. 论坛源码推荐(11.6):iPhone6/6 plus屏幕适配Demo,Java代码转Objective-C

    http://www.cocoachina.com/ios/20141106/10153.html iPhone6/6 plus 屏幕适配Demo(代码底层处理)(论坛会员satian)htt 该项目 ...

  8. Apache报错You don't have permission to access on this server

    解决方法: 打开httpd.conf文件 <Directory /> AllowOverride none Require all denied </Directory> 修改 ...

  9. C# winform中自定义用户控件 然后在页面中调用用户控件的事件

    下面是用户控件的代码: using System; using System.Collections.Generic; using System.ComponentModel; using Syste ...

  10. Hadoop MapReduce 操作 统计词频

    1.准备文件并设置编码格式为UTF-8并上传Linux 2.新建一个Java Project 3.导入jar 4.编写Map()和Reduce() 5.将代码输出成jar 6.在linux中启动hdf ...