Update api.zabbix.php
This commit is contained in:
parent
70ac4d9f8c
commit
51b76839c3
|
@ -1,27 +1,15 @@
|
|||
<?php
|
||||
loadHelper("zabbix.api");
|
||||
|
||||
$authenticate = zabbix_authenticate("192.168.0.90", "Admin", "zabbix");
|
||||
$data = array();
|
||||
|
||||
echo "<h1>Zabbix API</h1>";
|
||||
$data['authenticate'] = zabbix_authenticate("127.0.0.1", "Admin", "zabbix");
|
||||
$data['hosts'] = zabbix_retrieve_hosts();
|
||||
$data['items'] = array();
|
||||
|
||||
echo "<h2>Authenticate</h2>";
|
||||
echo "<pre>";
|
||||
var_dump($authenticate);
|
||||
echo "</pre>";
|
||||
|
||||
echo "<h2>Zabbix Hosts</h2>";
|
||||
$hosts = zabbix_retrieve_hosts();
|
||||
echo "<pre>";
|
||||
var_dump($hosts);
|
||||
echo "<pre>";
|
||||
|
||||
foreach($hosts->result as $host) {
|
||||
$items = zabbix_get_items($host->hostid);
|
||||
|
||||
echo "<h2>(Host ID: " . $host->hostid . ") " . $host->host . "</h2>";
|
||||
echo "<pre>";
|
||||
$items = zabbix_get_items($host->hostid);
|
||||
var_dump($items);
|
||||
echo "<pre>";
|
||||
foreach($data['hosts']->result as $host) {
|
||||
$data['items'][$host->hostid] = zabbix_get_items($host->hostid);
|
||||
}
|
||||
|
||||
header("Content-type: application/json");
|
||||
echo json_encode($data);
|
||||
|
|
Loading…
Reference in New Issue
Block a user