从zabbix api 2.0中的多个ItemID检索值

从zabbix api 2.0中的多个ItemID检索值,api,json-rpc,zabbix,Api,Json Rpc,Zabbix,我想通过主机id获取从主机接收的所有最新数据。根据规格,我尝试使用此项 $itemids=array("36361","36362","36363","36364","36365"); $groups = $api->historyGet(array( "output"=> "extend", "history"=> 0, "hostids"=> "10657", "itemids" => $itemids, "limit"=

我想通过主机id获取从主机接收的所有最新数据。根据规格,我尝试使用此项

$itemids=array("36361","36362","36363","36364","36365");
$groups = $api->historyGet(array(
    "output"=> "extend",
    "history"=> 0,
    "hostids"=> "10657",
    "itemids" => $itemids,
    "limit"=> 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
));

我使用了foreach构造,但根据规范,我可以在history.get方法中将数组用作参数。为什么这不起作用?