我想通过主机ID获取从主机收到的所有最新数据。根据规格,我试试这个
$itemids=array("36361","36362","36363","36364","36365");
$groups = $api->historyGet(array(
"output"=> "extend",
"history"=> 0,
"hostids"=> "10657",
"itemids" => $itemids,
"limit"=> 1
));
作为响应,仅接收第一个数组元素的数据。 提前谢谢。
答案 0 :(得分:1)
这是您的PHP Zabbix API库的问题 - 是否能够自动将 PHP数组($ itemids)转换为 JSON数组?它显然有问题,所以尝试手动完成:
$itemids = array("36361","36362","36363","36364","36365");
// "convert" PHP array to JSON array string
$itemids = "[".implode($itemids, ",")."]";
// or use JSON array string directly: $itemids = "[36361,36362,36363,36364,36365]";
$groups = $api->historyGet(array(
"output"=> "extend",
"history"=> 0,
"hostids"=> "10657",
"itemids" => $itemids,
"limit"=> 1
));