Ad Widget

Collapse

Need help with API response

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • plachance
    Junior Member
    • Nov 2014
    • 3

    #1

    Need help with API response

    Hi,

    I am trying to get all hosts with their items and triggers from the API. I am running zabbix on linux CentOS release 6.6 (Final).

    Here is my code:

    $hostList = $api-hostGet(array('selectItems'=>'extend','selectTrigg ers'=>'extend','output'=>'extend'));

    $hostCount=0;

    //echo sizeof($host,0);
    foreach ($hostList as $host) {

    echo $host->host;
    foreach ($host->items as $items)
    {
    echo $items->name.":".$items->lastvalue.".".$items->key_;
    echo "<br>";
    }
    echo "<br><br>";
    }


    It retrieves the info I need just fine:
    whml30967Zabbix $4 $2 processes, in %:0.0000.zabbix[process,alerter,avg,busy]

    I know that $4 has to be replaced by busy and $2 by alerter as I got the _key too.

    Is there a way , calling the API to automatically substitute VARS ( like $4,$2 ) to their real values ? That would be of a lot of help here.

    Thanks
Working...