forked from ganglia/ganglia-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
actions.php
75 lines (68 loc) · 2.72 KB
/
actions.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
68
69
70
71
72
73
74
75
<?php
include_once("./eval_conf.php");
include_once("./functions.php");
if ( isset($_GET['action']) && $_GET['action'] == "show_views" ) {
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Show available views
//////////////////////////////////////////////////////////////////////////////////////////////////////
$available_views = get_available_views();
?>
<table>
<?php
if ( isset($_GET['aggregate']) ) {
?>
<tr><th>Host regular expression</th><td><?php print join (",", $_GET['hreg']); ?></td></tr>
<tr><th>Metric regular expression</th><td><?php print join (",", $_GET['mreg']); ?></td></tr>
<?php
} else {
?>
<tr><th>Hostname</th><td><?php print $_GET['host_name']; ?></td></tr>
<tr><th>Metric/Report</th><td><?php print $_GET['metric_name']; ?></td></tr>
<?php
}
?>
</table>
<p>
<form id="add_metric_to_view_form">
Add graph to view: <br />
<?php
// Get all the aggregate form variables and put them in the hidden fields
if ( isset($_GET['aggregate']) ) {
foreach ( $_GET as $key => $value ) {
if ( is_array($value) ) {
foreach ( $value as $index => $value2 ) {
print '<input type="hidden" name="' . $key .'[]" value="' . $value2 . '" />';
}
} else {
print '<input type="hidden" name="' . $key .'" value="' . $value . '" />';
}
}
} else {
// If hostname is not set we assume we are dealing with aggregate graphs
print "<input type=\"hidden\" name=\"host_name\" value=\"{$_GET['host_name']}\" />";
$metric_name=$_GET['metric_name'];
print "<input type=\"hidden\" name=\"metric_name\" value=\"{$_GET['metric_name']}\" />";
print "<input type=\"hidden\" name=\"type\" value=\"{$_GET['type']}\">";
if (isset($_GET['vl']) && ($_GET['vl'] !== ''))
print "<input type=\"hidden\" name=\"vertical_label\" value=\"" . htmlentities(stripslashes($_GET['vl'])) . "\" />";
if (isset($_GET['ti']) && ($_GET['ti'] !== ''))
print "<input type=\"hidden\" name=\"title\" value=\"" . htmlentities(stripslashes($_GET['ti'])) . "\" />";
print "<table><tr><th rowspan=2>Optional thresholds to display</th><td>Warning</td><td><input size=6 name=\"warning\"></td>
</tr><td>Critical</td><td><input size=6 name=\"critical\"></td></tr></table>";
}
?>
<br />
<center>
<select onChange="addItemToView()" name="view_name">
<option value="none">Please choose a view to add to</option>
<?php
foreach ( $available_views as $view_id => $view ) {
print "<option value=\"" . $view['view_name'] . "\">" . $view['view_name'] . "</option>";
}
?>
</select>
</center>
</form>
<?php
} // end of if ( isset($_GET['show_views']) {
?>