コード例 #1
0
echo date("d F Y", time());
?>
</div>
    <div id="time"><?php 
echo date("H:i", time());
?>
</div>
</div>
<!-- END GET RENDER DATE -->

<!-- We could use the Zabbix HostGroup name here, but would not work in a nice way when using a dozen of hostgroups, yet! So we hardcoded it here. --> 
<div id="sheetname">Your Group</div>

<?php 
// get hostgroupid with hosts
$groupids = $api->hostgroupGet(array('output' => 'extend', 'selectHosts' => 'extend', 'select_acknowledges' => 'extend', 'only_true' => '1'));
// get all hosts from each groupid
foreach ($groupids as $groupid) {
    $groupname = $groupid->name;
    $hosts = $groupid->hosts;
    if ($hosts) {
        $count = "0";
        //	echo "<div class=\"groupbox\">"; // Again, we dont want to use the groupfunction yet
        //      echo "<div class=\"title\">" . $groupname . "</div>";
        // print all host IDs
        foreach ($hosts as $host) {
            // Check if host is not disabled, we don't want them!
            $flaghost = $host->flags;
            if ($flaghost == "0" && $count == "0") {
                echo "<div class=\"groupbox js-masonry\" data-masonry-options='{ \"itemSelector\": \".hostbox\" }'\">";
                // echo "<div class=\"title\">" . $groupname . "</div>";
コード例 #2
0
ファイル: index.php プロジェクト: lyvivian0077/iphone
<html>
<pre>
<?php 
// load ZabbixApi
require_once 'lib/ZabbixApi.class.php';
use ZabbixApi\ZabbixApi;
try {
    // connect to Zabbix API
    $api = new ZabbixApi('http://xxxxx.jp/zabbix/api_jsonrpc.php', 'xxxxx', 'xxxxx');
    $groupget = $api->hostgroupGet(array('output' => 'extend', 'search' => array('name' => 'MySQL')));
    //var_dump($groupget);
    printf("<br />--------------------------------------------------------<br />");
    foreach ($groupget as $groups) {
        printf("%33s\t%5d<br />", $groups->name, $groups->groupid);
    }
    printf("<br />--------------------------------------------------------<br /><br /><br />");
    $itemget9 = $api->itemGet(array('output' => 'extend', 'limit' => 200, 'groupids' => 9, 'sortfield' => 'name', 'search' => array('name' => 'disk-used(/home)')));
    $itemget21 = $api->itemGet(array('output' => 'extend', 'limit' => 200, 'groupids' => 21, 'search' => array('name' => 'ZFS-capacity')));
    //var_dump($itemget21);
    $hosts9 = $api->hostGet(array('output' => 'extend', 'limit' => 200, 'groupids' => 9, 'sortfield' => 'host', 'sortorder' => 'ASC'));
    //var_dump($hosts9);
    $hosts21 = $api->hostGet(array('output' => 'extend', 'limit' => 200, 'groupids' => 21));
    //var_dump($hosts21);
    $hostmap9 = array();
    foreach ($hosts9 as $host) {
        $hostmap9[$host->hostid] = $host->host;
    }
    $hostmap21 = array();
    foreach ($hosts21 as $host) {
        $hostmap21[$host->hostid] = $host->host;
    }