This repository has been archived by the owner on May 8, 2019. It is now read-only.
forked from mattiasgeniar/MoZBX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
host.php
executable file
·67 lines (58 loc) · 1.67 KB
/
host.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?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 = (int) $_GET['hostid'];
if ($zabbixHostId > 0) {
$host = $zabbix->getHostById($zabbixHostId);
// Graphs
$graphs = $zabbix->getGraphsByHostId($zabbixHostId);
$graphs = $zabbix->sortGraphsByName($graphs);
// Triggers
$triggers = $zabbix->getTriggersByHostId($zabbixHostId);
?>
<div id="host_<?php echo $zabbixHostId?>" class="current">
<div class="toolbar">
<h1><?php echo $host->host?></h1>
<a class="back" href="#">Back</a>
</div>
<?php
if (is_array($graphs) && count($graphs) > 0) {
?>
<h2>Graphs</h2>
<ul class="rounded">
<?php
foreach ($graphs as $graph) {
echo "<li><a href=\"graph.php?graphid=". $graph["graphid"] ."\"><img src=\"images/chart.png\" class=\"icon_list\">". $graph["name"] ."</a></li>";
}
?>
</ul>
<?php
} else {
echo "<h2>No graphs</h2>";
}
?>
</div>
<?php
} else {
echo "Invalid hostgroup.";
}
?>