Ok. I 'm very carefully read Creating custom LLD rules
at https://www.zabbix.com/documentation...evel_discovery But didn't understand how it works.
I have JSON answer from server like this:
json1
If understand correctly I need to return with script JSON like:
json2
Ok.
Now I need to create discovery rule. It's ok I understand.
Now we received new json1 with data shuffled and some of them are updated:
How after that Zabbix understand where each parameter when json1 arrived?
at https://www.zabbix.com/documentation...evel_discovery But didn't understand how it works.
I have JSON answer from server like this:
json1
Code:
{
"data": {
"carts": [
{
"user_id": 1
"user_name": "John",
"total_price": 34
"in_cart" : [
{
"products": [{
"product_id": 1,
"price": 30,
},
{
"product_id": 3,
"price": 4
}
]
}
]
},
{
"user_id": 2
"user_name": "Kate",
"total_price": 5,
"in_cart" : [
{
"products": [
{
"product_id": 3,
"price": 5
}
]
}
]
}
]
}
}
json2
Code:
{
"data": [
{
"{#USERID}": 1
"{#USERNAME}": "John",
"{#TOTALPRICE}": 34,
"{#PRODUCTID}": 1,
"{#PRICE}": 30,
},
{
"{#USERID}": 1
"{#USERNAME}": "John",
"{#TOTALPRICE}": 34,
"{#PRODUCTID}": 3,
"{#PRICE}": 4
},
{
"{#USERID}": 2
"{#USERNAME}": "Kate",
"{#TOTALPRICE}": 5,
"{#PRODUCTID}": 3,
"{#PRICE}": 5
}
]
}
Now I need to create discovery rule. It's ok I understand.
Now we received new json1 with data shuffled and some of them are updated:
Code:
{
"data": {
"carts": [
{
"user_id": 2
"user_name": "Kate",
"total_price": 23,
"in_cart" : [
{
"products": [
{
"product_id": 1,
"price": 23
}
]
}
]
},
{
"user_id": 1
"user_name": "John",
"total_price":44
"in_cart" : [
{
"products": [
{
"product_id": 3,
"price": 44
}
]
}
]
},
{
"user_id": 3
"user_name": "Maria",
"total_price": 56
"in_cart" : [
{
"products": [
{
"product_id": 4,
"price": 56
}
]
}
]
},
]
}
}
Comment