Skip to content

api_action

遇见王斌 edited this page Sep 8, 2017 · 3 revisions

action 管理

action列表

[root@Linux ~]#zabbix_api action_get --table
1.2.2
+----------+------------------------------------------------+--------------+----------+
| actionid | name                                           | eventsource  | status   |
+----------+------------------------------------------------+--------------+----------+
| 2        | Auto discovery. Linux servers.                 | discovery    | Disabled |
| 3        | Report problems to Zabbix administrators       | triggers     | Disabled |
| 4        | Report not supported items                     | internal     | Disabled |
| 5        | Report not supported low level discovery rules | internal     | Disabled |
| 6        | Report unknown triggers                        | internal     | Disabled |
| 7        | ceshi_action                                   | registration | Enabled  |
| 8        | trigger_action                                 | triggers     | Enabled  |
+----------+------------------------------------------------+--------------+----------+
sum:  7

zabbix客户端自动注册 action

功能:Active agent主动联系zabbix server,最后由zabbix server将这些agent加到host里。对于需要部署特别多服务器的人来说,这功能相当给力。

(1)agent

修改agent配置文件

ServerActive=66.175.222.222
Hostname=auto-reg-test01
HostMetadata=Linux

(2)server

界面操作需要做以下操作

步骤:configuration>>actions>>Event source(选择Auto registration)>>CreaAction

  • Action选项卡-----------定义Action名称:Action_for_autoreg
  • Conditions选项卡------添加:Host metadata like Linux
  • Operations选项卡-----添加:Add host,Add to host group ,Link to template

直接执行python main.py即可

执行后需要输入action_name和hostgroup_name

使用zabbix_api进行操作

zabbix_api action_autoreg_create "ceshi_action" "Linux servers"