summaryrefslogtreecommitdiff
path: root/html/memory.tmpl
diff options
context:
space:
mode:
Diffstat (limited to 'html/memory.tmpl')
-rw-r--r--html/memory.tmpl105
1 files changed, 105 insertions, 0 deletions
diff --git a/html/memory.tmpl b/html/memory.tmpl
new file mode 100644
index 0000000..bfc8fa6
--- /dev/null
+++ b/html/memory.tmpl
@@ -0,0 +1,105 @@
+<?%
+ USE date;
+ statusfiles = {};
+
+ FILTER null;
+ name = 'memory_stat';
+ swapdata = [];
+ activedata = [];
+ cacheddata = [];
+ buffersdata = [];
+ timestamps = [];
+ FOREACH item = param.stack;
+ t = date.format(item.timestamp, '%H:%M:%S');
+ timestamps.push(t);
+ swapdata.push(item.memory.SwapTotal);
+ activedata.push(item.memory.Active);
+ cacheddata.push(item.memory.Cached);
+ buffersdata.push(item.memory.Buffers);
+ END;
+
+ # Maximum wert
+ max = param.stack.last.memory.MemTotal;
+
+ # Data ...
+ d = [
+ timestamps ,
+ swapdata ,
+ cacheddata ,
+ activedata ,
+ buffersdata ,
+ ];
+
+ USE my_graph = GD.Graph.lines(500,300);
+
+ # Xsteps
+ steps = param.stack.size / 5 | format('%d');
+
+ label = gettext('Memory usage since');
+ label = "${label} ${d.first.first}";
+ my_graph.set(
+ title => label,
+ x_label_skip => steps,
+ x_long_ticks => 1,
+
+ y_label => gettext('Memory usage in bytes'),
+ y_long_ticks => 1,
+
+ line_width => 2,
+ box_axis => 1,
+ boxclr => '#FFFFCC',
+ fgclr => '#BBBBBB'
+ legend_placement => 'RD',
+ legend_spacing => 5,
+ );
+ my_graph.set_title_font(param.font,10);
+ my_graph.set_y_label_font(param.font,10);
+ my_graph.set_x_label_font(param.font,10);
+ my_graph.set_x_axis_font(param.font,6);
+ my_graph.set_y_axis_font(param.font,6);
+ my_graph.set_legend( 'Swap', 'Active', 'Cached', 'Buffers');
+ statusfiles.$name = writefile("status_${name}.gif", my_graph.plot(d).gif );
+ END;
+
+ # ------------------- Piegraph für Speicher
+ FILTER null;
+ name = 'memory_now';
+ d2 = [
+ ["Active ${data.Active}","Cached ${data.Cached}","Inactive ${data.Inactive}","MemFree ${data.MemFree}","Buffers ${data.Buffers}"],
+ [ data.Active, data.Cached, data.Inactive, data.MemFree, data.Buffers]
+ ];
+ USE my_graph = GD.Graph.pie(400, 300);
+ label = gettext('Total Memory');
+ label = "${label} ${data.MemTotal}";
+ my_graph.set(
+ title => label,
+ axislabelclr => 'black',
+ pie_height => 25,
+ transparent => 0,
+ );
+ my_graph.set_title_font(param.font,10);
+ my_graph.set_label_font(param.font,10);
+ my_graph.set_value_font(param.font,8);
+ statusfiles.$name = writefile("status_${name}.gif", my_graph.plot(d2).gif );
+ END;
+ %?>
+<!-- Vitals Template -->
+<?% IF param.headingText %?>
+<table width=100%><tr><td class='tableheader'><h3><?% param.headingText %?></h3>
+<?% END %?>
+<table border="0" width="95%">
+<tr>
+ <td colspan=2 align=center>
+ <img src="<?% statusfiles.memory_now %?>">
+ </td>
+</tr>
+<tr>
+ <td colspan=2 align=center>
+ <img src="<?% statusfiles.memory_stat %?>">
+ </td>
+</tr>
+</table>
+<?% IF param.headingText %?>
+</td></tr></table>
+<p>
+<?% END %?>