summaryrefslogtreecommitdiff
path: root/html/network.tmpl
diff options
context:
space:
mode:
Diffstat (limited to 'html/network.tmpl')
-rw-r--r--html/network.tmpl115
1 files changed, 115 insertions, 0 deletions
diff --git a/html/network.tmpl b/html/network.tmpl
new file mode 100644
index 0000000..0f4538d
--- /dev/null
+++ b/html/network.tmpl
@@ -0,0 +1,115 @@
+<?%
+ USE date;
+ statusfiles = {};
+
+ FILTER null;
+ name = 'network_stat';
+ timestamps = [];
+ FOREACH entry = param.stack.first.network;
+ iname = entry.first.split(':').first;
+
+ rxbytes.${iname} = [];
+ txbytes.${iname} = [];
+ rxerror.${iname} = [];
+ txerror.${iname} = [];
+
+ oldentry.${iname} = [];
+ END;
+
+ FOREACH item = param.stack;
+ t = date.format(item.timestamp, '%H:%M:%S');
+ timestamps.push(t);
+
+ FOREACH entry = item.network;
+ iname = entry.first.split(':').first;
+
+ UNLESS oldentry.${iname}.size;
+ oldentry.${iname} = entry;
+ END;
+
+ bytes = entry.1 - oldentry.${iname}.1;
+ rxbytes.${iname}.push(bytes);
+
+ bytes = entry.5 - oldentry.${iname}.5;
+ txbytes.${iname}.push(bytes);
+
+ rxerror.${iname}.push(entry.3);
+ txerror.${iname}.push(entry.7);
+ oldentry.${iname} = entry;
+ END;
+ END;
+
+ FOREACH iname = rxbytes.keys.sort;
+
+ # Data ...
+ d = [
+ timestamps,
+ rxbytes.${iname},
+ rxerror.${iname},
+ txbytes.${iname},
+ txerror.${iname},
+ ];
+
+ USE my_graph = GD.Graph.lines(600,300);
+
+ # Xsteps
+ steps = param.stack.size / 5 | format('%d');
+ label = gettext('Traffic on Interface');
+ label = "${label} ${iname}";
+ my_graph.set(
+ title => label,
+ x_label_skip => steps,
+ x_long_ticks => 1,
+
+ y_label => gettext('Transfer 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( 'RxBytes', 'RxErrors', 'TxBytes', 'TxErrors');
+ statusfiles.$iname = writefile("status_network_${iname}.gif", my_graph.plot(d).gif );
+ END;
+ END;
+ %?>
+
+<!-- Vitals Template -->
+<?% IF param.headingText %?>
+<table width=100%><tr><td class='tableheader'><h3><?% param.headingText %?></h3>
+<?% END %?>
+<table border="0" width="95%">
+ <?% fields = data.shift %?>
+ <tr>
+ <?% FOREACH field = fields %?>
+ <th><?% field %?></th>
+ <?% END %?>
+ </tr>
+ <?% FOREACH zeile = data %?>
+ <tr>
+ <?% FOREACH field = zeile %?>
+ <td><?% field %?></td>
+ <?% END %?>
+ </tr>
+ <?% END %?>
+
+ <?% FOREACH file = statusfiles.keys %?>
+ <tr>
+ <td colspan="<?% fields.size %?>" align=center>
+ <img src="<?% statusfiles.$file %?>">
+ </td>
+ </tr>
+ <?% END %?>
+</table>
+<?% IF param.headingText %?>
+</td></tr></table>
+<p>
+<?% END %?>