예제 #1
0
파일: host.php 프로젝트: rockylo/MoZBX
<?php

require_once "config.inc.php";
require_once "functions.php";
require_once "class_zabbix.php";
require_once "cookies.php";
$zabbix = new Zabbix($arrSettings);
// Populate our class
$zabbix->setUsername($zabbixUser);
$zabbix->setPassword($zabbixPass);
$zabbix->setZabbixApiUrl($zabbixApi);
// Login
if (isset($zabbixAuthHash) && strlen($zabbixAuthHash) > 0) {
    // Try it with the authentication hash we have
    $zabbix->setAuthToken($zabbixAuthHash);
} elseif (strlen($zabbix->getUsername()) > 0 && strlen($zabbix->getPassword()) > 0 && strlen($zabbix->getZabbixApiUrl()) > 0) {
    $zabbix->login();
}
if (!$zabbix->isLoggedIn()) {
    header("Location: index.php");
    exit;
}
require_once "template/header.php";
$zabbixHostId = (string) $_GET['hostid'];
$zabbixHostGroupId = (string) $_GET['groupid'];
$zabbixHostGroupName = (string) urldecode($_GET['groupname']);
if ($zabbixHostId > 0) {
    $host = $zabbix->getHostById($zabbixHostId);
    // Graphs
    $graphs = $zabbix->getGraphsByHostId($zabbixHostId);
    $graphs = $zabbix->sortGraphsByName($graphs);