Reputation: 1
I have a task: without using scripts, I need to ping the IPMI interface of a host. By default, the check is performed on the first network interface. So, I decided to create a discovery rule that would allow performing a simple check -icmpping through the discovery of interfaces available on the host. To do this, I retrieve all interfaces via the API, but the item prototype does not trigger. The template is currently without any filters. At the very least, I want to make sure that simple check -icmpping items are created for all host interfaces. However, they are not being created.
version: '7.0'
template_groups:
- uuid: 7df96b18c230490a9a0a9e2307226338
name: Templates
templates:
- uuid: e29a8d45cdca42d5a4f2c596d821fd88
template: ipmipingtool
name: ipmipingtool
groups:
- name: Templates
items:
- uuid: 7001e17e1f6c418c9d6b21a2400b8232
name: ip_main
type: HTTP_AGENT
key: ip.main
value_type: TEXT
trends: '0'
preprocessing:
- type: JSONPATH
parameters:
- '$.result[*].ip'
url: 'http://zabbix.example.com/api_jsonrpc.php'
posts: |
{
"jsonrpc": "2.0",
"method": "hostinterface.get",
"params": {
"output": "extend"
},
"auth": "token",
"id": 1
}
headers:
- name: Content-Type
value: application/json
discovery_rules:
- uuid: 38b1285f913b469ebf11bb9b0ad1618f
name: ip_lld
type: DEPENDENT
key: ip.lld
delay: '0'
item_prototypes:
- uuid: c15181931db3446cb8120cdd6b0d9475
name: '{#ADDR}'
type: SIMPLE
key: 'icmpping[{#ADDR}]'
master_item:
key: ip.main
lld_macro_paths:
- lld_macro: '{#ADDR}'
path: '$.[*]'
preprocessing:
- type: JSONPATH
parameters:
- '$.[*]'
Item name: ip_main - It returns this information. ["127.0.0.1","192.168.1.111","192.168.1.92","192.168.1.93","192.168.1.95","192.168.1.117","192.168.1.88","192.168.1.65","192.168.1.76","192.168.1.111","192.168.1.88"]
After that, I send it to the discovery rules. I have changed the preprocessing steps and tried different JSON paths, but it doesn't affect the result. What is wrong?
Upvotes: 0
Views: 88