Hello,
Im trying get certain key with hostnames.
In my code im getting all Servers in group no:292 with a key named "Cpu Total (Processor Time])".
But the data only i get from host is id. I need hostnames too. Is there any api info about this or should i just write another api query to get ID and Hostnames and match them in a loop? I have more then hundred server in this group so api query will have better performance.
My wider purpose is make a dashboard with our needs with certain keys. This is one of them..
Thanks for help.
$(document).ready(function(){
$.ajax({
url: 'http://url/zabbix/api_jsonrpc.php',
contentType:"application/json-rpc",
data: JSON.stringify ({
"jsonrpc": "2.0",
"method": "item.get",
"params": {
"output": "extend",
"groupids": "292",
"search": {
"hostids": "14719"
"key_": "Processor Time]",
"filter":"lastvalue"
}, "sortfield": "name"
},
"id": 2,
"auth": "$authkey"} ),
type:"POST",
success: function(searchResult) {
var resultData
resultData = searchResult["result"][0]["lastvalue"];
$('#cpuValue').html(resultData);
}
});
});
Im trying get certain key with hostnames.
In my code im getting all Servers in group no:292 with a key named "Cpu Total (Processor Time])".
But the data only i get from host is id. I need hostnames too. Is there any api info about this or should i just write another api query to get ID and Hostnames and match them in a loop? I have more then hundred server in this group so api query will have better performance.
My wider purpose is make a dashboard with our needs with certain keys. This is one of them..
Thanks for help.
$(document).ready(function(){
$.ajax({
url: 'http://url/zabbix/api_jsonrpc.php',
contentType:"application/json-rpc",
data: JSON.stringify ({
"jsonrpc": "2.0",
"method": "item.get",
"params": {
"output": "extend",
"groupids": "292",
"search": {
"hostids": "14719"
"key_": "Processor Time]",
"filter":"lastvalue"
}, "sortfield": "name"
},
"id": 2,
"auth": "$authkey"} ),
type:"POST",
success: function(searchResult) {
var resultData
resultData = searchResult["result"][0]["lastvalue"];
$('#cpuValue').html(resultData);
}
});
});
Comment