confirm/PhpZabbixApi

Can't get history Data

Closed this issue · 1 comments

I'm trying to get the values of the hosts, so I can make some Graphs with GraphJS.
But it can't get the historydata smh.

try {
                   // connect to Zabbix-API
                   $api = new ZabbixApi($api_url, $username, $password);

              $params = array(          'groupids'          => '2 ',
                                        'history'           =>  0, 
                                        'sortfield'         => 'clock', 
                                        'sortorder'         => 'ASC',                                                                   
                                        'output'            => 'extend',                                                                                 
                                                            ); 


                $histories = $api->historyGet($params);     // get data from api

                foreach($histories as $history)  {        // loop through the returned data
                    print_r($history);                    //  gives you back the host array
                    echo "\n";

                }

            } catch(Exception $e) {

                // Exception in ZabbixApi catched
                echo $e->getMessage();
            }
Newan commented

try:

groupids' => array('2')
and you have a space behind '2 ' !