RRDTool Memory Usage Graphs
[This modification has been verified to work with Smoothwall Express 2.0.]
This page describes how to create RRDTool graphs showing the memory usage of your Smoothwall.
The scripts described below will create daily, weekly, monthly and yearly graphs
of the physical memory usage and swap usage, viewable through the Smoothwall web interface.
Now with max, average and current total displayed as text under the graph.
Background:
Smoothwall Express 2.0 uses
RRDTool
for graphing the network traffic of each interface.
RRDTool (round robin database) is a very flexible data storage and graphing package
and can also be used for monitoring and graphing other parameters.
For example, I use RRDTool on other linux boxes to monitor
wireless link details,
network traffic,
system load, memory usage, motherboard, CPU temperature, PSU voltages
(using lm_sensors),
HDD temperature
(using hddtemp),
local weather, uptime of my ADSL connection,
peak/offpeak quota and non-quota traffic from my ISP, etc.
Screen Shots:
Here's a screen shot of the summary page, showing the daily graph of memory usage.

the summary page, showing the daily memory usage graph
The physical memory usage and swap usage are graphed as a stacked area trend, with
the swap usage stacked on top of the physical memory usage,
so the total height of the graph shows the total memory usage.
(Note that I artificially loaded a test Smoothwall box to increase the memory
usage for these screenshots.)
Requirements:
You'll need:
-
A Smoothwall Express 2.0 installation (obviously...).
-
An SCP client (such as WinSCP,
or SSH Secure File Transfer Client, part of
SSH Secure Shell)
for copying files onto your Smoothwall box.
-
A way of getting a command-line prompt on your Smoothwall box
(either by logging directly onto your Smoothwall box,
using a SSH client such as
PuTTY
or SSH Secure Shell,
or via the Smoothwall web interface).
-
sw_mem.tgz (2KB - contains
data collection script, web page for viewing graphs)
Installing the Components:
SCP the sw_mem.tgz tarball into /tmp
and untar it using
tar -zxvf /tmp/sw_mem.tgz -C /
Test the script by manually running it from a command prompt:
/usr/local/bin/rrdtool_mem.pl
and you should see output similar to this:
memory: 27.49 Mbytes, swap: 0.00 Mbytes
creating rrd database for memory usage...
595x185
595x185
595x185
595x185
Automate the data collection and graph generation process by scheduling this
script to run every five minutes, by adding the following to the end of
/etc/crontab
# store and graph memory usage data
*/5 * * * * root /usr/local/bin/rrdtool_mem.pl >/dev/null
Make a copy of the page title image:
cp /home/httpd/html/ui/assets/3.6/img/pagetitles/page-graphs.png \
/home/httpd/html/ui/assets/3.6/img/pagetitles/page-ographs.png
Edit /var/smoothwall/main/ui/alertboxes.en.pl
and immediately after the line containing
'graphs.cgi' => '<font class=\'pagetitle\'>Traffic Graphs</font>
<br>Statistical graphs based upon traffic usage across your
SmoothWall\'s network interfaces.',
insert a line containing the following (note that it should be on a single line):
'ographs.cgi' => '<font class=\'pagetitle\'>Other Graphs</font>
<br>Other graphs showing system information.',
Edit /var/smoothwall/langs/base.pl and immediately
after the line containing
'sstraffic graphs' => 'traffic graphs',
insert a new line containing
'ssother graphs' => 'other graphs',
Also in /var/smoothwall/langs/base.pl,
immediately before the line containing
# usbadsl.cgi
insert some new lines containing
# ographs.cgi
'other graphs' => 'Other graphs',
'other graphsc' => 'Other graphs:',
Edit /var/smoothwall/header.pl and replace
&subsectiontab('/cgi-bin/graphs.cgi', $tr{'sstraffic graphs'}, 1);
with the following code
&subsectiontab('/cgi-bin/graphs.cgi', $tr{'sstraffic graphs'}, 0);
&subsectiontab('/cgi-bin/ographs.cgi', $tr{'ssother graphs'}, 1);
To restrict viewing access to the the graphs, edit
/home/httpd/cgi-bin/.htaccess and add the following to the end
<Files ographs.cgi>
require user admin
</Files>
Viewing the RRDTool Memory Usage Graphs:
Now point a web browser at Smoothwall's web interface, and navigate to the
"about your smoothie" menu item, and then to the "other graphs" menu item to
view the graphs.
Note that it'll take at least 5 minutes before any data is displayed on the graphs,
as at least two data points (5 minutes apart) are required in order for RRDTool
to be able to build a graph.
The default view is of the daily graphs of the memory usage.
Clicking this daily graph will then display daily, weekly, monthly and yearly
graphs for the selected interface.
Use the "back" button of your browser to revert back to the summary view.
Note that 5-minute average values are used for generating the daily graphs,
30-minute averages for the weekly graphs,
2-hour averages for the monthly graphs,
and 12-hour averages for the yearly graphs.
Note:
Note that most of the Smoothwall fixes are likely to overwrite header.pl
with a newer version, so if you install a new fix, it may overwrite your changes.
As a result, you'll probably need to reapply your changes to
header.pl after installing any fixes.
Similarly, when doing a fresh installation of Smoothwall,
only make these changes once you've fully patched the installation.
References:
RRDTool Traffic Graphs on Smoothwall
Network Traffic Monitoring with RRDTool
About RRD Tool
RRD Tool Manual
last updated 27 Dec 2012
|