Hi Everyone,
I've been trying to request inventory asset tag data with the API but i keey getting empty arrays. Does anyone else get this issue or am i doing something wrong?
i keep getting empty arrays, no matter what inventory field i try to request.
PHP Code
Returned data for 1 server (Json), inventory array is at the back of the data:
I've been trying to request inventory asset tag data with the API but i keey getting empty arrays. Does anyone else get this issue or am i doing something wrong?
i keep getting empty arrays, no matter what inventory field i try to request.
PHP Code
PHP Code:
function RequestServers($Server){
global $AuthKey;
$url = "https://$Server/zabbix/api_jsonrpc.php";
$headers = array();
$headers[] = "Content-Type: application/json";
$POSTdata = array();
$POSTdata["method"] = "host.get";
$POSTdata["jsonrpc"] = "2.0";
$POSTdata["id"] = 2;
$POSTdata["auth"] = $AuthKey;
$POSTdata["params"]["output"] = "extend";
$POSTdata["params"]["selectInventory"] = "asset_tag";
$POSTjson = json_encode($POSTdata);
$ArrResponse = APIcallPOST($url, $headers, $POSTjson);
$data = $ArrResponse;
return $data;
}
Code:
[0]=> array(27) { ["hostid"]=> string(5) "10352" ["proxy_hostid"]=> string(5) "10326" ["host"]=> string(11) "V-ADConnect" ["status"]=> string(1) "1" ["lastaccess"]=> string(1) "0" ["ipmi_authtype"]=> string(2) "-1" ["ipmi_privilege"]=> string(1) "2" ["ipmi_username"]=> string(0) "" ["ipmi_password"]=> string(0) "" ["maintenanceid"]=> string(1) "0" ["maintenance_status"]=> string(1) "0" ["maintenance_type"]=> string(1) "0" ["maintenance_from"]=> string(1) "0" ["name"]=> string(11) "V-ADConnect" ["flags"]=> string(1) "0" ["templateid"]=> string(1) "0" ["description"]=> string(24) "word opgekuist binnekort" ["tls_connect"]=> string(1) "1" ["tls_accept"]=> string(1) "1" ["tls_issuer"]=> string(0) "" ["tls_subject"]=> string(0) "" ["proxy_address"]=> string(0) "" ["auto_compress"]=> string(1) "1" ["custom_interfaces"]=> string(1) "0" ["uuid"]=> string(0) "" ["inventory_mode"]=> string(1) "0" [B]["inventory"]=> array(0) { }[/B] }
Comment