forked from ganglia/ganglia-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
views.php
55 lines (46 loc) · 1.87 KB
/
views.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
<?php
include_once("./eval_conf.php");
include_once("./functions.php");
if( ! checkAccess(GangliaAcl::ALL_VIEWS, GangliaAcl::VIEW, $conf) ) {
die("You do not have access to view views.");
}
// Load the metric caching code we use if we need to display graphs
retrieve_metrics_cache();
$base = isset($_GET['base']) ? $_GET['base'] . "/" : "";
?>
<html>
<head>
<script type="text/javascript" src="<?php print $base; ?>js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="<?php print $base; ?>js/jquery-ui-1.8.14.custom.min.js"></script>
<link type="text/css" href="css/smoothness/jquery-ui-1.8.14.custom.min.css" rel="stylesheet"/>
<link rel="stylesheet" href="./styles.css" type="text/css">
</head>
<body>
<div>
<?php
$available_views = get_available_views();
$view_name = $_GET['vn'];
// Let's find the view definition
foreach ($available_views as $view_id => $view) {
if ($view['view_name'] == $view_name) {
$view_elements = get_view_graph_elements($view);
$range_args = "";
if (isset($_GET['r']) && $_GET['r'] != "")
$range_args .= "&r=" . $_GET['r'];
if (isset($_GET['cs']) && isset($_GET['ce']))
$range_args .= "&cs=" . $_GET['cs'] . "&ce=" . $_GET['ce'];
if (count($view_elements) != 0) {
foreach ($view_elements as $id => $element) {
$legend = isset($element['hostname']) ? $element['hostname'] : "Aggregate graph";
$base = isset($_GET['base']) ? $_GET['base'] : '.';
print "<a href=\"" . $base . "/graph_all_periods.php?" . htmlentities($element['graph_args']) ."&z=large\"><img title=\"" . $legend . " - " . $element['name'] . "\" border=0 src=\"" . $base . "/graph.php?" . htmlentities($element['graph_args']) . "&z=small" . $range_args . "\" style=\"padding:2px;\"></a>";
}
} else {
print "No graphs defined for this view. Please add some";
}
}
}
?>
</div>
</body>
</html>