Hi there,
I would like to find 2 items for 1 specific host using zabbix api call.
In this case I want to find for host with hostid 10381 items containing the name "uptime" and "Total memory"
I have no problem to find 1 item in a query:
curl -s -X POST -H 'Content-Type: application/json-rpc' -d " \
{
"jsonrpc": "2.0",
"method": "item.get",
"params": {
"output": "extend",
"hostids": "10381",
"search": {
"name": "uptime"
},
"sortfield": "name"
},
"auth": "$auth",
"id": 1
}
" $url | jq . | grep lastvalue
OUTPUT: "lastvalue": "76833",
However, when I want to find 2 items in one query with e.g. the name "uptime" and "Total memory", it doesnt work:
curl -s -X POST -H 'Content-Type: application/json-rpc' -d " \
{
"jsonrpc": "2.0",
"method": "item.get",
"params": {
"output": "extend",
"hostids": "10381",
"search": {
"name": ["Total memory", "uptime"]
},
"sortfield": "name"
},
"auth": "$auth",
"id": 1
}
" $url | jq .
OUTPUT:
"jsonrpc": "2.0",
"result": [],
"id": 1
My variables: $auth, $url, specific hostid
Is there any posibility to search for 2 items in 1 query?
I would like to find 2 items for 1 specific host using zabbix api call.
In this case I want to find for host with hostid 10381 items containing the name "uptime" and "Total memory"
I have no problem to find 1 item in a query:
curl -s -X POST -H 'Content-Type: application/json-rpc' -d " \
{
"jsonrpc": "2.0",
"method": "item.get",
"params": {
"output": "extend",
"hostids": "10381",
"search": {
"name": "uptime"
},
"sortfield": "name"
},
"auth": "$auth",
"id": 1
}
" $url | jq . | grep lastvalue
OUTPUT: "lastvalue": "76833",
However, when I want to find 2 items in one query with e.g. the name "uptime" and "Total memory", it doesnt work:
curl -s -X POST -H 'Content-Type: application/json-rpc' -d " \
{
"jsonrpc": "2.0",
"method": "item.get",
"params": {
"output": "extend",
"hostids": "10381",
"search": {
"name": ["Total memory", "uptime"]
},
"sortfield": "name"
},
"auth": "$auth",
"id": 1
}
" $url | jq .
OUTPUT:
"jsonrpc": "2.0",
"result": [],
"id": 1
My variables: $auth, $url, specific hostid
Is there any posibility to search for 2 items in 1 query?
Comment