forked from ganglia/ganglia-web
-
Notifications
You must be signed in to change notification settings - Fork 1
/
actions.php
84 lines (76 loc) · 2.73 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
76
77
78
79
80
81
82
83
84
<?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 to view
<?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=\"{$_GET['vl']}\">";
if (isset($_GET['ti']) && ($_GET['ti'] !== ''))
print "<input type=hidden name=title value=\"{$_GET['ti']}\">";
}
?>
<select onChange="addItemToView()" name="view_name">
<option value='none'>Please choose one</option>
<?php
foreach ( $available_views as $view_id => $view ) {
print "<option value='" . $view['view_name'] . "'>" . $view['view_name'] . "</option>";
}
?>
</select>
</form>
<form>
<p>
Add alert: <p>
Alert when value is
<select name=alert_operator>
<option value=more>greater</option>
<option value=less>smaller</option>
<option value=equal>equal</option>
<option value=notequal>not equal</option>
</select> than
<input size=7 name=critical_value type=text>
<button onClick="alert('not implemented yet'); return false">Add</button>
</form>
<?php
} // end of if ( isset($_GET['show_views']) {
?>