Hello there,
I'm trying to get the "device-status" for each device from a json that I've (over)simplified here :
Code:
[
{
"device": {
"device-name": "toto",
"device-status": "Online"
}
},
{
"device": {
"device-name": "titi",
"device-status": "Online"
}
},
{
"device": {
"device-name": "tata",
"device-status": "Online"
}
}
]
Nothing fancy here except a {#DEVICE_NAME} LLD macro with the jsonpath $.device.['device-name'] (see attachment 1) on which I can base my dependent item prototype defined as seen on attachment 2.
The items have been created, but I struggle to find the right jsonpath for the preprocessing of my item prototype (see attachment 3)... None of these seem to be correct, as I don't get any data in Zabbix or get the following error : 1. Failed: cannot extract value from json by path "$.[?(@.device['device-name']=="toto")].['device-status']": no data matches the specified path
Code:
$.[?(@.device['device-name']=="{#DEVICE_NAME}")].['device-status']
$.[?(@.device.['device-name']=="{#DEVICE_NAME}")].['device-status']
$.device[?(@.['device-name']=="{#DEVICE_NAME}")].['device-status']
$.device.[?(@.['device-name']=="{#DEVICE_NAME}")].['device-status']
$.[?(@.device.['device-name']=="{#DEVICE_NAME}")].['device-status']
I've used similar syntaxes in the past, but I don't get where my error is. Could someone see it and help me please ?
Comment