1 | <?php |
---|
2 | /* template head */ |
---|
3 | if (function_exists('Dwoo_Plugin_include')===false) |
---|
4 | $this->getLoader()->loadPlugin('include'); |
---|
5 | /* end template head */ ob_start(); /* template body */ ?><!-- Begin cluster_view.tpl --> |
---|
6 | <?php if ((isset($this->scope["heatmap"]) ? $this->scope["heatmap"] : null)) { |
---|
7 | ?> |
---|
8 | <script type="text/javascript" src="js/protovis-r3.2.js"></script> |
---|
9 | <?php |
---|
10 | }?> |
---|
11 | |
---|
12 | <script type="text/javascript"> |
---|
13 | function refreshClusterView() { |
---|
14 | $.get('cluster_view.php?' + jQuery.param.querystring() + '&refresh', function(data) { |
---|
15 | var item = data.split("<!-- || -->"); |
---|
16 | |
---|
17 | $('#cluster_title').html(item[1]); |
---|
18 | |
---|
19 | $('#cluster_overview').html(item[2]); |
---|
20 | |
---|
21 | if ($('#load_pie').size()) |
---|
22 | $('#load_pie').attr("src", item[3].replace(/&/g, "&")); |
---|
23 | |
---|
24 | if ($('#heatmap-fig').size()) { |
---|
25 | eval("heatmap = [" + item[4] + "]") ; |
---|
26 | vis.render(); |
---|
27 | } |
---|
28 | |
---|
29 | if ($('#stacked_graph').size()) { |
---|
30 | var localtimestamp = parseInt(item[0]); |
---|
31 | var src = $('#stacked_graph').attr('src'); |
---|
32 | $('#stacked_graph').attr("src", jQuery.param.querystring(src, "&st=" + localtimestamp)); |
---|
33 | } |
---|
34 | |
---|
35 | var host_metric_graphs = $('#host_metric_graphs'); |
---|
36 | host_metric_graphs.css('height', host_metric_graphs.height() + "px"); |
---|
37 | host_metric_graphs.html(item[5]); |
---|
38 | }); |
---|
39 | |
---|
40 | $("#optional_graphs img").each(function (index) { |
---|
41 | var src = $(this).attr("src"); |
---|
42 | if ((src.indexOf("graph.php") == 0) || |
---|
43 | (src.indexOf("./graph.php") == 0)) { |
---|
44 | var d = new Date(); |
---|
45 | $(this).attr("src", jQuery.param.querystring(src, "&_=" + d.getTime())); |
---|
46 | } |
---|
47 | }); |
---|
48 | } |
---|
49 | |
---|
50 | $(function() { |
---|
51 | // Modified from http://jqueryui.com/demos/toggle/ |
---|
52 | //run the currently selected effect |
---|
53 | function runEffect(id){ |
---|
54 | //most effect types need no options passed by default |
---|
55 | var options = { }; |
---|
56 | |
---|
57 | options = { to: { width: 200,height: 60 } }; |
---|
58 | |
---|
59 | //run the effect |
---|
60 | $("#"+id+"_div").toggle("blind",options,500); |
---|
61 | }; |
---|
62 | |
---|
63 | //set effect from select menu value |
---|
64 | $('.button').click(function(event) { |
---|
65 | runEffect(event.target.id); |
---|
66 | return false; |
---|
67 | }); |
---|
68 | |
---|
69 | $(function() { |
---|
70 | $( "#edit_optional_graphs" ).dialog({ autoOpen: false, minWidth: 550, |
---|
71 | beforeClose: function(event, ui) { location.reload(true); } }) |
---|
72 | $( "#edit_optional_graphs_button" ).button(); |
---|
73 | $( "#save_optional_graphs_button" ).button(); |
---|
74 | $( "#close_edit_optional_graphs_link" ).button(); |
---|
75 | }); |
---|
76 | |
---|
77 | $("#edit_optional_graphs_button").click(function(event) { |
---|
78 | $("#edit_optional_graphs").dialog('open'); |
---|
79 | $('#edit_optional_graphs_content').html('<img src="img/spinner.gif">'); |
---|
80 | $.get('edit_optional_graphs.php', "clustername=<?php echo $this->scope["cluster"];?>", function(data) { |
---|
81 | $('#edit_optional_graphs_content').html(data); |
---|
82 | }) |
---|
83 | return false; |
---|
84 | }); |
---|
85 | |
---|
86 | $("#save_optional_graphs_button").click(function(event) { |
---|
87 | $.get('edit_optional_graphs.php', $("#edit_optional_reports_form").serialize(), function(data) { |
---|
88 | $('#edit_optional_graphs_content').html(data); |
---|
89 | $("#save_optional_graphs_button").hide(); |
---|
90 | setTimeout(function() { |
---|
91 | $('#edit_optional_graphs').dialog('close'); |
---|
92 | }, 5000); |
---|
93 | }); |
---|
94 | return false; |
---|
95 | }); |
---|
96 | |
---|
97 | }); |
---|
98 | </script> |
---|
99 | |
---|
100 | <?php if ((isset($this->scope["graph_engine"]) ? $this->scope["graph_engine"] : null) == "flot") { |
---|
101 | ?> |
---|
102 | <script language="javascript" type="text/javascript" src="js/jquery.flot.min.js"></script> |
---|
103 | <script type="text/javascript" src="js/create-flot-graphs.js"></script> |
---|
104 | <style type="text/css"> |
---|
105 | .flotgraph2 { |
---|
106 | height: <?php echo $this->scope["graph_height"];?>px; |
---|
107 | width: <?php echo $this->scope["graph_width"];?>px; |
---|
108 | } |
---|
109 | </style> |
---|
110 | <?php |
---|
111 | }?> |
---|
112 | |
---|
113 | |
---|
114 | <style type="text/css"> |
---|
115 | .toggler { width: 500px; height: 200px; } |
---|
116 | a.button { padding: .15em 1em; text-decoration: none; } |
---|
117 | #effect { width: 240px; height: 135px; padding: 0.4em; position: relative; } |
---|
118 | #effect h3 { margin: 0; padding: 0.4em; text-align: center; } |
---|
119 | #heatmap-fig { |
---|
120 | width: 200px; |
---|
121 | height: 200px; |
---|
122 | } |
---|
123 | </style> |
---|
124 | |
---|
125 | <div id="metric-actions-dialog" title="Metric Actions"> |
---|
126 | <div id="metric-actions-dialog-content"> |
---|
127 | Available Metric actions. |
---|
128 | </div> |
---|
129 | </div> |
---|
130 | |
---|
131 | <div id="edit_optional_graphs"> |
---|
132 | <div style="text-align:center"> |
---|
133 | <button id='save_optional_graphs_button'>Save</button> |
---|
134 | </div> |
---|
135 | <div id="edit_optional_graphs_content">Empty</div> |
---|
136 | </div> |
---|
137 | |
---|
138 | <div style="background:rgb(238,238,238);text-align:center;"> |
---|
139 | <font size="+1" id="cluster_title">Overview of <?php echo $this->scope["cluster"];?> @ <?php echo $this->scope["localtime"];?></font> |
---|
140 | </div> |
---|
141 | |
---|
142 | <table border="0" cellspacing=4 width="100%"> |
---|
143 | <tr> |
---|
144 | <td align="left" valign="top"> |
---|
145 | <div id="cluster_overview"> |
---|
146 | <?php echo Dwoo_Plugin_include($this, 'cluster_overview.tpl', null, null, null, '_root', null);?> |
---|
147 | |
---|
148 | </div> |
---|
149 | <?php if (((isset($this->scope["extra"]) ? $this->scope["extra"] : null) !== null)) { |
---|
150 | ?> |
---|
151 | <?php echo Dwoo_Plugin_include($this, "".(isset($this->scope["extra"]) ? $this->scope["extra"] : null)."", null, null, null, '_root', null);?> |
---|
152 | |
---|
153 | <?php |
---|
154 | }?> |
---|
155 | |
---|
156 | </td> |
---|
157 | <td rowspan=2 align="center" valign=top> |
---|
158 | <div id="optional_graphs" style="padding-bottom:4px"> |
---|
159 | <?php echo $this->scope["optional_reports"];?><br> |
---|
160 | <?php |
---|
161 | $_fh0_data = (isset($this->scope["optional_graphs_data"]) ? $this->scope["optional_graphs_data"] : null); |
---|
162 | if ($this->isTraversable($_fh0_data) == true) |
---|
163 | { |
---|
164 | foreach ($_fh0_data as $this->scope['graph']) |
---|
165 | { |
---|
166 | /* -- foreach start output */ |
---|
167 | ?> |
---|
168 | <a href="./graph_all_periods.php?<?php echo $this->scope["graph"]["graph_args"];?>&g=<?php echo $this->scope["graph"]["name"];?>_report&z=large"> |
---|
169 | <img border=0 <?php echo $this->scope["additional_cluster_img_html_args"];?> title="<?php echo $this->scope["cluster"];?> <?php echo $this->scope["graph"]["name"];?>" src="./graph.php?<?php echo $this->scope["graph"]["graph_args"];?>&g=<?php echo $this->scope["graph"]["name"];?>_report&z=medium"></a> |
---|
170 | <?php |
---|
171 | /* -- foreach end output */ |
---|
172 | } |
---|
173 | }?> |
---|
174 | |
---|
175 | </div> |
---|
176 | <?php if ((isset($this->scope["user_may_edit"]) ? $this->scope["user_may_edit"] : null)) { |
---|
177 | ?> |
---|
178 | <button id="edit_optional_graphs_button">Edit Optional Graphs</button> |
---|
179 | <?php |
---|
180 | }?> |
---|
181 | |
---|
182 | </td> |
---|
183 | </tr> |
---|
184 | |
---|
185 | <tr> |
---|
186 | <td align="center" valign="top"> |
---|
187 | <?php if ((isset($this->scope["php_gd"]) ? $this->scope["php_gd"] : null) && ! (isset($this->scope["heatmap"]) ? $this->scope["heatmap"] : null)) { |
---|
188 | ?> |
---|
189 | <img id="load_pie" src="./pie.php?<?php echo $this->scope["pie_args"];?>" border="0" /> |
---|
190 | <?php |
---|
191 | }?> |
---|
192 | |
---|
193 | <?php if ((isset($this->scope["heatmap"]) ? $this->scope["heatmap"] : null) && (isset($this->scope["num_nodes"]) ? $this->scope["num_nodes"] : null) > 0) { |
---|
194 | ?> |
---|
195 | Utilization heatmap<br /> |
---|
196 | <div id="heatmap-fig"> |
---|
197 | <script type="text/javascript+protovis"> |
---|
198 | var heatmap = [ |
---|
199 | <?php echo $this->scope["heatmap"];?> |
---|
200 | |
---|
201 | ]; |
---|
202 | |
---|
203 | var w = heatmap[0].length, |
---|
204 | h = heatmap.length; |
---|
205 | |
---|
206 | var vis = new pv.Panel() |
---|
207 | .width(w * <?php echo $this->scope["heatmap_size"];?>) |
---|
208 | .height(h * <?php echo $this->scope["heatmap_size"];?>) |
---|
209 | .margin(2) |
---|
210 | .strokeStyle("#aaa") |
---|
211 | .lineWidth(4) |
---|
212 | .antialias(false); |
---|
213 | |
---|
214 | vis.add(pv.Image) |
---|
215 | .imageWidth(w) |
---|
216 | .imageHeight(h) |
---|
217 | .image(pv.Scale.linear() |
---|
218 | .domain(0, 0.25, 0.5, 0.75, 1.00) |
---|
219 | .range("#e2ecff", "#caff98", "#ffde5e" , "#ffa15e","#ff634f") |
---|
220 | .by(function(i, j) heatmap[j][i])); |
---|
221 | |
---|
222 | vis.render(); |
---|
223 | </script> |
---|
224 | </div> |
---|
225 | <?php |
---|
226 | }?> |
---|
227 | |
---|
228 | </td> |
---|
229 | </tr> |
---|
230 | </table> |
---|
231 | |
---|
232 | <?php if ((isset($this->scope["stacked_graph_args"]) ? $this->scope["stacked_graph_args"] : null)) { |
---|
233 | ?> |
---|
234 | <center> |
---|
235 | <table width="100%" border=0> |
---|
236 | <tr> |
---|
237 | <td colspan="1"> |
---|
238 | <font size="+1" style="text-align:center">Stacked Graph - <?php echo $this->scope["metric"];?></font> |
---|
239 | </td> |
---|
240 | </tr> |
---|
241 | <tr> |
---|
242 | <td> |
---|
243 | <center><img id="stacked_graph" src="stacked.php?<?php echo $this->scope["stacked_graph_args"];?>" alt="<?php echo $this->scope["cluster"];?> <?php echo $this->scope["metric"];?>"></center> |
---|
244 | </td> |
---|
245 | </tr> |
---|
246 | </table> |
---|
247 | </center> |
---|
248 | <?php |
---|
249 | }?> |
---|
250 | |
---|
251 | |
---|
252 | <script type="text/javascript"> |
---|
253 | // Need to set the field value to metric name |
---|
254 | $("#metrics-picker").val("<?php echo $this->scope["metric_name"];?>"); |
---|
255 | </script> |
---|
256 | |
---|
257 | |
---|
258 | <div id="cluster_view_chooser"> |
---|
259 | <table border="0" width="100%"> |
---|
260 | <tr> |
---|
261 | <td style="text-align:center;background:rgb(238,238,238);"> |
---|
262 | Show Hosts Scaled: |
---|
263 | <?php |
---|
264 | $_fh1_data = (isset($this->scope["showhosts_levels"]) ? $this->scope["showhosts_levels"] : null); |
---|
265 | $this->globals["foreach"]['default'] = array |
---|
266 | ( |
---|
267 | "iteration" => 1, |
---|
268 | "last" => null, |
---|
269 | "total" => $this->count($_fh1_data), |
---|
270 | ); |
---|
271 | $_fh1_glob =& $this->globals["foreach"]['default']; |
---|
272 | if ($this->isTraversable($_fh1_data) == true) |
---|
273 | { |
---|
274 | foreach ($_fh1_data as $this->scope['id']=>$this->scope['showhosts']) |
---|
275 | { |
---|
276 | $_fh1_glob["last"] = (string) ($_fh1_glob["iteration"] === $_fh1_glob["total"]); |
---|
277 | /* -- foreach start output */ |
---|
278 | ?> |
---|
279 | <input type="radio" name="sh" value="<?php echo $this->scope["id"];?>" id="shch<?php echo $this->scope["id"];?>" OnClick="ganglia_form.submit();" <?php echo $this->scope["showhosts"]["checked"];?>><label for="shch<?php echo $this->scope["id"];?>"><?php echo $this->scope["showhosts"]["name"];?></label> |
---|
280 | <?php |
---|
281 | /* -- implode */ |
---|
282 | if (!$_fh1_glob["last"]) { |
---|
283 | echo ""; |
---|
284 | } |
---|
285 | /* -- foreach end output */ |
---|
286 | $_fh1_glob["iteration"]+=1; |
---|
287 | } |
---|
288 | }?> |
---|
289 | | |
---|
290 | <span class="nobr"><?php echo $this->scope["cluster"];?> <strong><?php echo $this->scope["metric"];?></strong> |
---|
291 | last <strong><?php echo $this->scope["range"];?></strong> |
---|
292 | sorted <strong><?php echo $this->scope["sort"];?></strong></span> |
---|
293 | <?php if (((isset($this->scope["columns_size_dropdown"]) ? $this->scope["columns_size_dropdown"] : null) !== null)) { |
---|
294 | ?> |
---|
295 | | |
---|
296 | <font> |
---|
297 | <span class="nobr">Size <?php echo $this->scope["size_menu"];?></span> |
---|
298 | <span class="nobr">Columns <?php echo $this->scope["cols_menu"];?> (0 = metric + reports)</span> |
---|
299 | </font> |
---|
300 | <?php |
---|
301 | }?> |
---|
302 | |
---|
303 | </td> |
---|
304 | </tr> |
---|
305 | </table> |
---|
306 | </div> |
---|
307 | |
---|
308 | <div id="host_metric_graphs"> |
---|
309 | <?php echo Dwoo_Plugin_include($this, 'cluster_host_metric_graphs.tpl', null, null, null, '_root', null);?> |
---|
310 | |
---|
311 | </div> |
---|
312 | |
---|
313 | <script type="text/javascript"> |
---|
314 | $(function() { |
---|
315 | $( "#cluster_view_chooser" ).buttonset(); |
---|
316 | }); |
---|
317 | </script> |
---|
318 | <!-- End cluster_view.tpl --> |
---|
319 | <?php /* end template body */ |
---|
320 | return $this->buffer . ob_get_clean(); |
---|
321 | ?> |
---|