Big Brothers Everywhere
What actually looks like a normal radio is in fact a secret hidden camera. These are the side effects of Moore’s Law. It’s scary, what people come up with. Soon you will need a bug and wireless camera detector in your pocket in order to be safe at all…
How To Install Logging And Graphing On Your Apple Computer
RRDTool (Round Robin Database) by Tobias Oetiker is a fantastic command line application to track any sort of information.

Many of us have an old PPC Macintosh around, that is now running as server. This is a good opportunity to install some monitoring software on it. Find here some instructions on how to install the RRDtool on your Mac Os X PPC.
Installing RRDTool
First, you need to download the latest sources. Download them for example into the folder /usr/src/:
Type:cd /usr/src
curl -O http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.2.15.tar.gz
Extract the files:gunzip rrdtool-1.2.15.tar.gz
tar -xvf rrdtool-1.2.15.tar
RTFM:cd rrdtool-1.2.15/doc/
less rrdbuild.txt
Here we go:
Let’s decide, we want to build the software in /tmp/rrdbuild and install it in /usr/local/rrdtool, we type the following to commands:bash
export BUILD_DIR=/usr/src/rrdtool-1.2.15
export INSTALL_DIR=/usr/local/rrdtool
make sure, these directories exist.cd $BUILD_DIR
let’s configure:./configure --prefix=$INSTALL_DIR && make && make install
a few test will be conducted to your system. It will be very likely, that some things are missing. So you will have to check the manual and install those libraries first.
If nothing’s missing: get a cup of coffee. Your system is compiling the binaries. This may take a while.
On Mac OS X some Python libraries may give you an error message:_Py_FatalError
_Py_InitModule4
__Py_NoneStruct
collect2: ld returned 1 exit status
make[3]: *** [rrdtoolmodule.so] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
You may circumvent these by using the –disable-python switch in the configure statement:./configure --disable-python --prefix=$INSTALL_DIR && make && make install
There you go, rrdtool just has been installed successfully on your system! You will find the binaries under /usr/local/rrdtool/bin ($INSTALL_DIR)
For convenience reasons, I also created the folders /usr/local/rrdtool/scripts/ for the scripts and /usr/local/rrdtool/dbs/ for the databases.
Now let’s capture some data
To understand the concept of a Round Robin Database, it makes sense to have a glance at the beginner’s guide.
A very interesting application is the “Temperature Sensor” by Marcel Bresnik. You can also access the “tempmonitor” by command line. /Applications/misc/TemperatureMonitor.app/Contents/Resources/tempmonitor -a -l
BATTERY: 35 C
CPU TOPSIDE: 58.75 C
GPU ON DIE: 61.25 C
HDD BOTTOMSIDE: 47.5 C
SMART Disk HTS541080G9AT00 (MP28MBXBG5A57H): 38 C
So to start with, let’s grab some data about the temperature of the various sensors. You need three scripts per graph to proceed:
a.) a script that creates the database (use it once)
b.) a script that grabs the data and puts it into the database (use it once every 5 minutes)
c.) a script that grabs the data from the database and creates a graph (use it once every 15 minutes)
a.) let’s create a very simple database
rrdtool create filename [--start|-b start time] [--step|-s step] [DS:ds-name:DST:dst arguments] [RRA:CF:cf arguments]
We want to monitor the temperature of the computer:rrdtool create /usr/local/rrdtool/dbs/temperature.rrd DS:temperature:GAUGE:600:U:U \
RRA:AVERAGE:0.5:1:1200 \
RRA:MIN:0.5:12:2400 \
RRA:MAX:0.5:12:2400 \
RRA:AVERAGE:0.5:12:2400
b.) After having created the graph, we want to periodically update it
For this purpose, I take a PHP script (just because I’m familiar with PHP. You can also take Perl or Python of course.):<?
// get rid of the " C" at the end of the line
$temperature = substr(exec("/Applications/misc/TemperatureMonitor.app/Contents/Resources/tempmonitor"), 0, -2);
exec ("/usr/local/rrdtool/bin/rrdtool update /usr/local/rrdtool/dbs/temperature.rrd N:$temperature");
?>
Install a cronjob that executes this script every five minutes:crontab -e
then add:*/5 * * * * php /usr/local/rrdtool/scripts/temperature.php > /dev/null 2>&1
(You need VIM knowledge to be able to edit this file. Make sure you have the right permissions, you can easily test it by executing the above command.)
c.) Now let’s create the graph
and dump it into the web folder (in my case /wwwroot/rrd/images/). The easiest way to do this is via shell script. Such a shell script could look like this:#!/bin/bash
#
###
# cron.daily script
# recreates daily, weekly, monthly, and yearly users graphs.
# rrd database location: /usr/local/rrdtool/dbs/
# rrd graph location: /wwwroot/rrd/images/
#
#
/usr/local/rrdtool/bin/rrdtool graph /wwwroot/rrd/images/temperature_daily.gif \
--title "resolution: daily" \
--width 600 \
--color BACK#333333 \
--color SHADEA#000000 \
--color SHADEB#000000 \
--color CANVAS#000000 \
--color GRID#999999 \
--color MGRID#666666 \
--color FONT#CCCCCC \
--color FRAME#333333 \
--start -86400 \
--vertical-label " Degrees Celsius" \
--no-legend \
DEF:temp=/usr/local/rrdtool/dbs/temperature.rrd:temperature:AVERAGE \
AREA:temp#0066FF \
LINE1:temp#FF0000:temperature
#
/usr/local/rrdtool/bin/rrdtool graph /wwwroot/rrd/images/temperature_weekly.gif \
--title "resolution: weekly" \
--width 600 \
--color BACK#333333 \
--color SHADEA#000000 \
--color SHADEB#000000 \
--color CANVAS#000000 \
--color GRID#999999 \
--color MGRID#666666 \
--color FONT#CCCCCC \
--color FRAME#333333 \
--start -604800 \
--vertical-label " Degrees Celsius" \
--no-legend \
DEF:temp=/usr/local/rrdtool/dbs/temperature.rrd:temperature:AVERAGE \
AREA:temp#0066FF \
LINE1:temp#FF0000:temperature
We’re almost there. Next thing: add the execution of the shell script to the cron: */15 * * * * /usr/local/rrdtool/scripts/graph_temperature.sh > /dev/null 2>&1

And now the image should be updated every 15 minutes. Build a fancy website around it and you’re done!
Download an example package of scripts plus the crontab here.
Google Maps: Getting Started Pinning Down Locations
Learning by example is a good way of getting familiar with the Google Maps API. Google Maps in my opinion unveils its true power NOT by people pulling data but by people actually pushing data with geographical information. Therefore I have compiled a small example for newbies that allows you to get started with creating an app like this. You can further process the information in JavaScript or in a HTML form. It’s dead easy.
Good luck and let me know here what you make out of this!

