码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2017-09-19 00:15:42      阅读:174      评论:0      收藏:0      [点我收藏+]

标签:and   support   param   optional   自动发现   pre   长度   erp   other   

一、概述

之前已经讲述了自动发现功能,自动注册和自动发现非常类似,但是比自动发现更精确。因为自动注册,是在Agent上自定义元数据,然后Agent将元数据发送给server进行匹配,如果匹配一致,则进行下一步的动作(添加主机、模板之类的操作),所以从流程上来说,主动注册比自动发现更加精确。

二、配置

1、指定服务器

在agent配置文件中指定Zabbix server - zabbix_agentd.conf

ServerActive=1.0.0.1

如果你没有在zabbix_agentd.conf中特别定义了Hostname,则服务器将使用agent的系统主机名命名主机。Linux中的系统主机名可以通过运行‘hostname‘命令获得。

修改配置后重启agent。

 

2、元素据参数 metadata 和HostMetadataItem

HostMetadata

HostMetadata是可选参数,用于定义主机元数据。主机元数据仅用于自动注册(主动模式)。
如果没有定义,这个值将从HostMetadataItem获得。如果指定的值超出了长度限制或不是utf-8格式的字符串,agent将会产生一个错误并且无法启动起来。
这个选项从2.2开始支持。

以下为官网原文:

Optional parameter that defines host metadata. Host metadata is used only at host auto-registration process (active agent).
If not defined, the value will be acquired from HostMetadataItem.
An agent will issue an error and not start if the specified value is over the limit or a non-UTF-8 string.
This option is supported in version 2.2.0 and higher.

HostMetadataItem

可选参数定义在agent上,用于采集主机元数据。这个选项仅用于当HostMetadata没有被定义的时候。支持UserParameters和别名,支持system.run[]。主机元数据仅用于自动注册(主动模式)。

Agent主动注册期间如果指定的item值超出了255个字符串的限制,将会记录一条警告日志。

值必须是UTF-8格式,否则将会被忽略。这个选项从2.2开始支持。

以下为官网原文:

   

Optional parameter that defines a Zabbix agent item used for getting host metadata. This option is only used when HostMetadata is not defined.
Supports UserParameters and aliases. Supports system.run[]regardless of EnableRemoteCommands value.
Host metadata is used only at host auto-registration process (active agent).
During an auto-registration request an agent will log a warning message if the value returned by the specified item is over the limit of 255 characters.
The value returned by the item must be a UTF-8 string otherwise it will be ignored.
This option is supported in version 2.2.0 and higher.

 

 3、Agent端配置(重点)

了解了元数据后,我们开始进行agent端的配置工作,具体配置如下:

ServerActive=172.31.0.35:10051   #指定serverIP,主动注册
HostnameItem=system.hostname  #指定主机hostname,用于区分操作系统
HostMetadata=awsadmin 2SAMVqMTqwCVbQvLSaFc1izjMgXDzl88   #指定主机特定元素据,用于匹配Agent主机

 

 

4、web端配置

点击 配置动作-->主动注册

技术分享

技术分享

配置动作

技术分享

配置条件

技术分享

实例:将Linux主机且元数据为2SAMVqMTqwCVbQvLSaFc1izjMgXDzl88的Agent使用hk-proxy

技术分享

配置操作

技术分享

至此,自动注册配置完成,坐等机器自动添加了。是不是很简单?

 

三、总结

  • 自动注册为Aagent主动上报元数据给Server端;
  • 自动注册通过元数据区分不同主机或主机组;
  • 自动注册比自动发现目标更加明确;
  • 自动注册比自动发现更加灵活,比如,你在腾讯云、阿里云、aws上都有主机,且主机网段没规律,这时,使用自动注册为最佳。

 

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

标签:and   support   param   optional   自动发现   pre   长度   erp   other   

原文地址:http://www.cnblogs.com/skyflask/p/7545790.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!