Add zabbix example
Change-Id: I9e21724e4766ce4e21de7123e7a14d4f8ff2e07f
This commit is contained in:
parent
0a176f7c7b
commit
601bcd0e64
|
@ -0,0 +1,100 @@
|
|||
---
|
||||
version: "2.0"
|
||||
|
||||
name: zabbix
|
||||
|
||||
actions:
|
||||
zabbix:
|
||||
base: std.http
|
||||
base-input:
|
||||
url: "http://{$.host}/zabbix/api_jsonrpc.php"
|
||||
method: POST
|
||||
body:
|
||||
jsonrpc: 2.0
|
||||
method: $.method
|
||||
params: $.params
|
||||
auth: $.auth
|
||||
id: 1
|
||||
headers:
|
||||
Content-Type: application/json
|
||||
input:
|
||||
- host
|
||||
- method
|
||||
- params
|
||||
- auth
|
||||
output:
|
||||
result: $.content
|
||||
|
||||
zabbix_auth:
|
||||
base: std.http
|
||||
base-input:
|
||||
url: "http://{$.host}/zabbix/api_jsonrpc.php"
|
||||
method: POST
|
||||
body:
|
||||
jsonrpc: 2.0
|
||||
method: user.authenticate
|
||||
params:
|
||||
user: $.username
|
||||
password: $.password
|
||||
id: 0
|
||||
headers:
|
||||
Content-Type: application/json
|
||||
input:
|
||||
- host
|
||||
- username
|
||||
- password
|
||||
output:
|
||||
auth: $.content.result
|
||||
|
||||
workflows:
|
||||
register_on_zabbix:
|
||||
type: direct
|
||||
|
||||
input:
|
||||
- machine_ip
|
||||
- zabbix_host
|
||||
- zabbix_username
|
||||
- zabbix_password
|
||||
|
||||
tasks:
|
||||
get_zabbix_auth:
|
||||
action: zabbix_auth host={$.zabbix_host} username={$.zabbix_username} password={$.zabbix_password}
|
||||
publish:
|
||||
zabbix_auth: $.auth
|
||||
on-success:
|
||||
- zabbix_host_group_create
|
||||
|
||||
zabbix_host_group_create:
|
||||
action: zabbix method="hostgroup.create" auth={$.zabbix_auth} host={$.zabbix_host}
|
||||
input:
|
||||
params:
|
||||
- name: Demo host group
|
||||
publish:
|
||||
hostgroup_id: $.result.result.groupids[0]
|
||||
on-success:
|
||||
- zabbix_host_create
|
||||
|
||||
zabbix_host_create:
|
||||
action: zabbix method="host.create" auth={$.zabbix_auth} host={$.zabbix_host}
|
||||
input:
|
||||
params:
|
||||
host: Demo host
|
||||
ip: $.machine_ip
|
||||
port: 10500
|
||||
useip: 1
|
||||
groups:
|
||||
- groupid: $.hostgroup_id
|
||||
publish:
|
||||
host_id: $.result.result.hostids[0]
|
||||
on-success:
|
||||
- zabbix_item_create
|
||||
|
||||
zabbix_item_create:
|
||||
action: zabbix method="item.create" auth={$.zabbix_auth} host={$.zabbix_host}
|
||||
input:
|
||||
params:
|
||||
description: Simple check on host (ping)
|
||||
key_: 'icmpping[<ip>,<count>,<interval>,<size>,<timeout>]'
|
||||
hostid: $.host_id
|
||||
publish:
|
||||
item_id: $.result.result.itemids[0]
|
Loading…
Reference in New Issue