Examining Performance: Windows 8 Storage Spaces

Update 8/12/2012

I picked up another RE4 500GB so now the test is using two Western Digital RE4 WD5003ABYX 500GB 7200 RPM 64MB Cache SATA 3.0Gb/s drives.

The first WD RE4 500GB on SATA2

The second WD RE4 500GB on SATA2

Now inside of a RAID1 created on the SATA2 ports for the ASRock Z77 Extreme4 motherboard. Using the two WD RE4 500GB drives from above.

And now inside a mirroring Storage Space on Windows 8 Release Preview.

_________________________________________________________________

I”ll be using two drives in this test:

  1. Western Digital RE4 WD5003ABYX 500GB 7200 RPM 64MB Cache SATA 3.0Gb/s
  2. Seagate Barracuda 7200.10 ST3320620AS 320GB 7200 RPM 16MB Cache SATA 3.0Gb/s

Here is the WD RE4 connected on SATA2.

And the Seagate:

Now inside of a RAID1 created on the SATA2 ports for the ASRock Z77 Extreme4 motherboard

And finally within Windows 8’s new Storage Spaces. Doing Mirroring.

Xen Hypervisor and VT-d VGA Passthrough

I just recently bought a new computer with the purpose of

  1. Replacing my dying HTPC
  2. Setting up a VM Server for all my little projects

I wanted to be able to kill two birds with one stone on this purchase. So I turned to VT-d (also known as IOMMU, Directed I/O, and AMD-V). This allows a hypervisor to provide direct I/O access to a piece of hardware. You can get really excellent performance out of it as in this youtube video:

Yes, that’s one computer running two (really 3 if you count dom0) operating systems playing two games at once. Essentially it’s one computer acting as two computers. Notice the smooth (i.e. lag free) graphics.

Here’s the parts I picked up (~<$1000):

  • Intel Core i7 3770 (don’t get a K, as these don’t have VT-d)
  • ASRock Z77 Extreme4 (this mobo was shown to support VT-d here)
  • Crucial Ballistix Sport DDR3-1600 CL9 2x8GB
  • NZXT Classic Series Source 210 Case
  • SeaSonic X-Series 660W Power Supply
  • Crucial M4 128GB SATA SSD
  • Western Digital RE4 WD5003ABYX 500GB 7200rpm
  • Vantec 2 Channel 4-Port SATA 6Gb/s PCIe Host Card
  • SAPPHIRE AMD Radeon HD 6450 1GB PCIe Video Card

I threw Fedora 17 x86_64 on the WD RE4 as my dom0. Then I followed Dizzy’s Create a Gaming Virtual Machine Guide @ overclock.net. Mad props to Dizzy for a great guide.

Here it is working. This is a screen shot of a Windows 7 VM running as domU on xen.

I passed through the HD 6450 video and audio (HDMI) pci devices to the Windows 7 VM. I also passed a usb controller so I could use a mouse and keyboard.

The result is that I have a VM that has pretty much no performance loss. I ran Furmark on this system, while native and while inside the VM on HDMI to my TV. There was no frame loss (granted Furmark only runs at 5 fps @ 1024×768 on this card).

You’ll notice that this card has a really low Aero performance. Not sure why, but I found that while running Windows natively as well. A quick check online shows it’s happening with others as well. I don’t really notice it so oh well.

There are a few issues with this setup. First off I couldn’t get my pci-passthrough’s to persist over restarts of the host dom0. So I wrote a script that detaches the pci devices from dom0 and then starts the VM.

#!/bin/bash

#01:00.0 VGA compatible controller: ATI Technologies Inc NI Caicos [AMD RADEON HD 6450]
virsh nodedev-dettach pci_0000_01_00_0

#01:00.1 Audio device: ATI Technologies Inc NI Caicos HDMI Audio [AMD RADEON HD 6450]
virsh nodedev-dettach pci_0000_01_00_1

#00:1d.0 USB Controller: Intel Corporation Panther Point USB Enhanced Host Controller #1 (rev 04) -- 2x grey 2.0 ports on back.
virsh nodedev-dettach pci_0000_00_1d_0

xm start win777

Unfortunately, I couldn’t get this to work when I placed it int /etc/rc.d/rc.local as xend hadn’t started yet when rc.local was run. So I can only start my Win7 VM manually.

Another way I tried to fix the above issue is by using xen-pciback.hide feature on the dom0 kernel so it doesn’t take over these pci devices. I placed the following line in /etc/sysconfig/grub

GRUB_CMDLINE_XEN="iommu=1 dom0_mem=2048M xen-pciback.hide=(0000:01:00.0)(0000:01:00.1)(0000:00:1d.0)"

That didn’t work either. As far as I can tell it has something to do with my kernel lacking modprobe modules.

The second issue is that the HDMI Audio crashes after the system has been up for a while. I plan on leaving this machine on all the time (running Rosetta@Home when I’m gone). This is supposedly a known issue, at least to Dizzy (not sure about Xen).

I got a little confused about the hard drive setup. My initial plan was to passthrough the SATA PCIe card I bought. This should have worked. In fact, the VM was able to detect the card and the SSD on it, but I couldn’t get it to boot my Win7 image instead of the empty SSD on the SATA Card. I also tried booting to a DVD Drive that I placed on the SATA Card. It recognized the dvd drive but kept on trying to boot the empty SSD and didn’t give me an option to boot the DVD.

Finally I figured out that Dizzy was just passing through the /dev/sda1, which was the SSD connected to dom0. This worked great. I initially had performance issues as seen below.

Crucial M4 on SATA2 controller. IDE emulation passed via /dev/sda1 to VM

But then I put the M4 on a SATA3 controller and performance went up. Again passed through to domU from dom0 as /dev/sda1 in IDE emulation

Conclusion

This was a really fun project and I’m glad I did it. But unfortunately the audio crashing after a while, combined with the lack of persistant pci passthrough which makes this VM have to be manually started, are deal breakers for me. I’m going to try VMware’s ESXi implementation of VT-d next. If that doesn’t work, I’ll settle with Windows 8’s Hyper-V.

Maybe in a few years the Xen VT-d experience will have improved. For now, Onwards!

Vi Helpful Commands

Figured I’d write down a quick set of commands in VI. Also, I keep on forgetting a few useful commands in vi so I’m gonna start archiving them here.

Show Hidden Characters

:set list

Reload a file from disk

:e

Hide Hidden Characters

:set nolist

Fix vi’s broken arrow keys (mostly ubuntu machines)

:set nocompatible

Or better yet put it in the .vimrc file.

 echo “set nocompatible” >> ~/.vimrc

Change blue syntax coloring to something you can read on black backgrounds

Add “hi comment ctermfg=blue” to the .vimrc file

 echo “hi comment ctermfg=blue” >> ~/.vimrc

Navigate to top and bottom

Go to top:

gg

Go to bottom:

shift+g

Searching

Search up:

?<SEARCHSTRING>

where <SEARCHSTRING> is what you’re looking for.

Search down:

/<SEARCHSTRING>

Ignore caps in search:

/\c<SEARCHSTRING>

?\c<SEARCHSTRING>

 

 Editing (Insert mode)

i

Press ‘esc’ to get out of insert mode. Use arrow keys and page up/page down to get around.

Delete current line

dd

Delete from one marker to the next

First make a marker

mk

Where k could be anything from the letter ‘a’ to ‘z’

Now move your cursor somewhere and type

d`k

This will delete everything between your current cursor and the marker at k.

Also note that typing `k will take you to that marker.

Exit and don’t save

:q!

! means force. If you changed something and didn’t put !, then it wouldn’t let you exit.

Exit and save

:wq

Open a file in read only mode

vi -R <FILENAME>

 

Find and Replace

:s/SEARCHSTRING/REPLACESTRING/

The above does one line on the cursor, but to do the whole page

:1,$s/SEARCHSTRING/REPLACESTRING/

or

:%s/SEARCHSTRING/REPLACESTRING/

Black Background, White Text on all pages in Chrome

I previously used Blank Your Monitor + Easy Reading on Firefox to change all pages on the browser to black background and white text. Now that I’m mainly using Chrome, I didn’t have this functionality. I just found a way around it.

Stylish addon with Midnight Surfing – Global Dark Style

It’ll make any page you go to in chrome have a black background with grey text.

Then to turn it on and off you just click the S and disable that style.

Ahh… my eyes rejoice.

Modifying Danby DCR412BLS for Homebrew Ball Lock Kegs

Found a used 4.4 cu. ft. Danby DCR412BLS on craigslist for $65 bucks. Figured it’d be a good kegerator for my ball lock kegs I grabbed from Midwest Supplies (Brew Logic Dual Tap Draft System).

After reading this post on homebrewtalk I enlisted the help of my brew buddy and set to bending down the freezer section. Here’s a photo log.

Here’s the refrigerator before modifications. I yanked out the trays and let it get to room temp for about 4-5 days. 

This is the freezer tray that we’ll be bending back. I plan on putting my CO2 tank and regulator outside the fridge so I don’t need to bend it back all the way.

This is the temp control unit. Three philips screws on it. I removed this to get the freezer tray to bend down.

The tray has 4 phillips screws holding it in place.

Another view of the freezer tray.

The temp controller line just slides out of the little clip. You might have to give it a good tug to get it out. Also you can see the pipe that you’ll be bending down. I heard from the forums to bend at the back of the pipe (near the wall). But more on that later…

Here we removed the temp controller. It just slid out (towards the fridge door). After that the freezer tray was freestanding.

Here we slid out the temp controller. We also unscrewed that clip in the back. Probably didn’t need to do that.

Now we were ready to start bending back the freezer section. Dum dum dum!

I read too much on the internet about freon and got a little paranoid. My brew buddy and I had some hefty gas masks lying around so we put em on before going any further. Probably overkill but hey– safety first right!

We heated up the pipe just a little to make it easier to bend. I could still touch it to move it. Took about 3-4 breaks in between and really concentrated on taking it easy.

Unfortunately we created *this* in the pipe. I’m still not positive if it’s just a paint crack or the pipe itself. All I can say is yikes!

We put some soapy water on it and didn’t see any movement (besides gravity). Then we plugged it in and heard a slight hissing. Still no movement on the soapy water. We left it hanging around for about an hour and it froze up all of the soapy water around the crease/hole. It also kept the fridge pretty cool (~40F).

So I’m thinking it’s not a hole but the paint cracking. Gonna leave it running in the garage for a while and see if it maintains temperature. Might have to run a cable down there and add it to my temp sensing network. (Muahaha).

Update 4/17/2012

So after running it for a while it seemed to be keeping things cold. It didn’t stop like I’d expect if it was cracked. I hooked up another temp sensor to it to monitor it’s temps. Below is a graph of my Magic Chef 2.7 cu. ft. bottle fridge (in green) compared to the Danby DCR412BLS Keg Fridge (in black). As you can see the Keg Fridge is running too cold for beer — 34.53F average. This is with the knob at it’s hottest setting. Bummer

So I did some more researching and ran across this post on HBT that talks about an adjustment screw. There should be two– one coarse and one fine. I looked around on the thermostat controller for the DC412BLS and I think I’ve identified it. Unfortunately it’s blocked by the casing.

WARNING!!! Disconnect your fridge before touching the metal on this controller. Trust me you don’t want to shock yourself. 

Here’s a really bad view of the screws I’m talking about. There’s two there on the top. Look inside the oval.

After pulling the fridge power plug, I took a pic of the leads (black, red, yellow) to remember their position) and then disconnected them.

So I drilled a hole in the casing for easier access. In the process of doing that I accidentally partially decapitated the fine adjustment screw. Doh.

Anyhow after that hole was drilled in the plastic casing, I could get to the coarse screw. I rotated it one direction for a couple of turns. We shall see if it works in a few hours.

Update 5/2/2012

The adjustment screw worked great. You’re going to want to turn it clockwise to increase it’s temperature. Here’s a graph showing the increase in temperature after turning it clockwise. I believe this was two turns.

I fiddled around with the coarse adjustment to get it in the right state. Then it was on to removing the side paneling on the door. If you just pull back the rubber there are about 8 screws that you undo. Then the panel just pops off. Remember to keep the rubber seal as you’ll need it in the next steps.

We bought what Home Depot calls “White Panel Board”. It comes in huge dimensions but its only 12 bucks. We had them cut it down for easier transportation. We guestimated the size so we’d have extra space on the edges.

Then we took the side panel that we just yanked off the door and set it on top to get the dimensions and holes for the screws. And it was off to cutting with a electric saw blade.

Then we fitted the rubber gasket back onto our new whiteboard panel. Pay attention to the orientation of the rubber seal. We found it didn’t seal right on our first try. so we rotated it upside down, i.e. 180 deg, and it fit perfectly. 

And screwed it back onto the door. This is harder than it seems but keep working on it and you’ll get there. This part is probably a two person job, with one person holding it in place.

Looking pretty good. 

We then tried fitting the two kegs in there. It worked but it was a tight fit.

We then started shaving down the sides to provide more room for our two kegs. We did this with a razor blade knife. If you apply a thin amount of pressure and then carefully pull back you can cut through the plastic. It’s pretty thin. You’ll see a picture below.

So we decided to keep the CO2 tank outside of the refrigerator so that the regulators act right. There were reports of it not regulating correctly inside the fridge on HBT. Plus there’s the space issue. So we decided to drill a hole.

CorneliusAlphonse was kind enough to take a pic and show a diagram of where he ran his lines on the DCR412BLS. However he ran his lines right above the compressor. The beauty of his setup is that he didn’t have to punch through any metal as there was a plastic plug where he ran it. But it was right on top of the compressor so we were worried about heat.

So we decided to try and punch through the metal and shift it over to the left of the compressor (when looking from the back). There’s a nice empty space.

And now we get into ‘how not to do it’. That metal is harder than it seems. This was amplified by the fact that we just happened to drill our hole on the edge of the metal. We started drilling from the top. See below.

If you’re going to do it our way, move the hole back further so it’s not on the angle of the metal below. Better yet, get the right tools for cutting through metal. I’m sure there’s a specialized hole cutting drill for this metal. We used a plastic cutting hole for the top and then ended up using a nail and hammer on the metal until we could punch it out. Lots of work and jagged edges.

We taped up the jagged edges with duct tape and sealed everything up that way. There’s still a hole in the fridge. I’ll update later on how it functions with this hole.

A closer look. Notice you can see the coils in the back of the fridge. That might help you pinpoint where we drilled.

There were thoughts of using a rubber gasket cut in a star format to pass our lines through. (I believe they’re actually called grommets) Something like the water cooling on computer cases.

There’s also thoughts of foam insulation for piping to seal up the hole.

 

Homebrew Temperature Sensing with 1-wire

I wanted a way to graph the temperatures of my home brew and throw alarms at me if it goes out of the bounds. I know that’s not RDWHAHB, but I figured it’d be a fun project anyway.

So I settled on 1-wire as my sensing network. The beauty of 1-wire networks is their simplicity. Each device on the network has a unique ID. Then all you need is a ground and a data line. Since the temp sensor I used can work off parasitic power, I don’t need a third voltage line. So the software just does a query for the temps of all sensors and they start spitting out their unique id and the value. Pretty awesome.

I grabbed a couple of Dallas DS18S20 IC temp sensors and a Dallas DS9490R USB adapter. The adapter takes in RJ11 (really only two wires) and converts it to USB. The usb adapter is plugged into an old laptop running Ubuntu 11.10 and digitemp. On top of digitemp I have another software package called dtgraph making it oh so very pretty.  More about how all these work and how to set up later. But first a few pictures!

Here is what the graphing system looks like. I have mine to log every 15 min. Below we’re seeing 13 hours with all three sensors. Notice that you can see when the fridge turns on and off. Nice!

Here I’ve set it to view 28 days. Again this logging every 15min and you can see that it captured 2,565 temperatures. It’s only showing 726 of them to save on render time. You can make it show all if you check the Repeats and All Data. Renders pretty fast on my 10 year old laptop.

Here’s the size of the mysql database after logging every 15 min for 29 days.

root@jdrews-M2Ne:/var/lib/mysql/digitemp# du -h
256K

So really not too bad.

Here’s what the DS9490R 1-wire to USB adapter looks like plugged into my laptop

I have the beige RJ45 cable coming out of the DS9490R going into a 5 RJ11 breakout box as shown below.

All three cables have DS18S20 sensors at their ends. The grey cable is a telephone cable I hacked up and the blue ones are standard cat5 cables that I crimped a RJ11 onto the end. All you really need are two cables — data and ground. If you’re running really long cables you might need a voltage line, but if it’s less than 30-40ft you should be good.

Enough talk here’s the sensor taped onto my carboy. Got a American Pale Ale on the way!

And here’s one going into my refrigerator. I stripped back the insulation and extra wires to make the cable smaller. It seals pretty well like this as the cables are fairly small. One day I’ll drill a hole and caulk. Right now it’s taped up with electrical tape. We shall see how well that handles the cold.

Also note that there are 4 wires gong in, but I’m actually only using 2. The white ones just keep the sensor hooked onto the tray, and consequently centered in the middle of the fridge.

Here’s the outside sensor. I was able to slip it under the window sill and shut and lock the window. Make sure you put it in the shade or it might tell you it’s 138F outside. 😉 This part of the house stays shaded all day.

I wrapped it in a small plastic ziplock and then sealed up the end of the ziplock with more electrical tape. Then I sealed it up again with a rubber band. Close up below.

Hardware Setup

Now to the hardware details. If you’re just dealing with parasitic power (i.e. no Vdd line) you’ll just need two wires, data and ground. The DS18S20 has three pins as seen below

Taken from the DS18S20 Datasheet @ Maxim

So for parasitic power you’ll solder the GND to Vdd. Grab a CAT5 cable and strip down two wires (I used orange and green). Solder a line on your CAT5 to the GND+Vdd and another line to the DQ (data line). Pay attention to your colors.

Now on the other end you’re going to crimp the CAT5 into a RJ11 (this is your standard telephone line). I don’t suggest using a telephone line as the wires are so thin that my solder gun burned through them (grr!).

Below is the diagram for your crimped RJ11.

Above chart taken from the DS9490R Datasheet @ Maxim

You’ll be just using 3 and 4, where 3 is the Data line and 4 is the GND line in a parasitic power setup. They call it 1-Wire Data and 1-Wire Return on the chart.

Crimp the RJ11 on there and that’s it. You’ve got a temperature sensor ready to slap on your carboy.

Software Setup

Now to setting up the software. I used digitemp combined with dtgraph. Digitemp pulls the data from the sensors. DTGraph pushes the data into a mysql database and handles the php website.

I used Ubuntu 11.10 for this but it should work for other Ubuntu versions. First up grab a copy of digitemp via apt-get

sudo apt-get install digitemp

Now we need to see if your usb adapter can see your sensors. Run the following and you should see the sensors on your network. -w means walk the network.

root@jdrews-M2Ne:/home/jdrews# digitemp_DS2490 -w
DigiTemp v3.5.0 Copyright 1996-2007 by Brian C. Lane
GNU Public License v2.0 - http://www.digitemp.com
Found DS2490 device #1 at 002/002
Turning off all DS2409 Couplers
.
Devices on the Main LAN
103C017C02080025 : DS1820/DS18S20/DS1920 Temperature Sensor
107CD17B02080088 : DS1820/DS18S20/DS1920 Temperature Sensor
10E3ED7B020800B8 : DS1820/DS18S20/DS1920 Temperature Sensor
815ADA30000000E0 : Unknown Family Code

Not sure why I always have a device called ‘Unknown Family Code’ but it still works.

Now let’s set up the .digitemprc config file.

digitemp_DS2490 -sUSB -i

This should create a .digitemprc file in your local directory. Mine looked like this:

TTY USB
READ_TIME 1000
LOG_TYPE 1
LOG_FORMAT "%b %d %H:%M:%S Sensor %s C: %.2C F: %.2F"
CNT_FORMAT "%b %d %H:%M:%S Sensor %s #%n %C"
HUM_FORMAT "%b %d %H:%M:%S Sensor %s C: %.2C F: %.2F H: %h%%"
SENSORS 3
ROM 0 0x10 0x3C 0x01 0x7C 0x02 0x08 0x00 0x25
ROM 1 0x10 0x7C 0xD1 0x7B 0x02 0x08 0x00 0x88
ROM 2 0x10 0xE3 0xED 0x7B 0x02 0x08 0x00 0xB8

You’re gonna want to copy this somewhere safe so you don’t overwrite it. I put mine in /home/jdrews/digitemp/digitemp.conf

Now let’s read some temps!

jdrews@jdrews-M2Ne:/home/jdrews/digitemp# digitemp_DS2490 -a -c /home/jdrews/digitemp/digitemp.conf
DigiTemp v3.5.0 Copyright 1996-2007 by Brian C. Lane
GNU Public License v2.0 - http://www.digitemp.com
Found DS2490 device #1 at 002/002
Apr 09 21:35:07 Sensor 0 C: 4.44 F: 39.99
Apr 09 21:35:08 Sensor 1 C: 21.75 F: 71.15
Apr 09 21:35:09 Sensor 2 C: 16.88 F: 62.38

Ok so now that we have some temps let’s start setting up the UI: dtgraph. Grab the latest tarball off http://sourceforge.net/projects/dtgraph/

Mine was dtgraph-0.4m.tar.gz. Untar it

tar -xvzf dtgraph-0.4m.tar.gz

In this file is an INSTALL doc that is pretty straight forward. I’ll walk you through the basics.

You’ll need a LAMP server. Install it with apt-get

sudo apt-get install mysql apache2 php5

For 12.04 LTS the above line looks like the following

sudo apt-get install mysql-server mysql-client apache2 php5

You’ll also need some mdb2 drivers and jpgraph

sudo apt-get install libphp-jpgraph php-mdb2 php-mdb2-driver-mysql

Ok now that we have the reqs down lets set up the mysql database to hold our temps. In this case my database is called stats.

mysqladmin create stats

Then use dtgraph’s scripts to create the structure in your new database.

mysql -u  -p stats < mysql_create_digitemp_metadata.sql
mysql -u  -p stats < mysql_create_digitemp.sql
mysql -u  -p stats < mysql_create_digitemp_alarms.sql

If you get a warning that looks like the following, just change your ‘TYPE=MyISAM’ to ‘ENGINE=MyISAM’. This is happening since we’re using a different version of mysql.

ERROR 1064 (42000) at line 6: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TYPE=MyISAM' at line 13

Now we’ll create a user for digitemp and grant it privileges to our new stats database. Log into mysql.

mysql -u root stats

And grant the rights to your new user, dt_logger

GRANT SELECT,INSERT,UPDATE ON stats.* TO dt_logger@localhost
      IDENTIFIED BY 'ChangeThisPassword';

So the database should now be setup. Lets get the website going.

Copy the contents of the ‘www’ folder in your dtgraph folder (the one we untar’d) to /var/www/dtgraph. You might need to create this folder. Feel free to name it something else if you want.

mkdir -p /var/www/dtgraph
cp -r www/* /var/www/dtgraph

Set the permissions on your conf.php to read and write. Group should suffice.

chmod g+rw conf.php

You’ll want to edit the conf.php and add in all your configuration info. Here’s the first half of mine with all the important changes. Pay particular notice to the digitemp_conf, the sql username and password, and the jp_path.

/************** Database Properties *****************/
/****************************************************/
$conf['driver'] = 'sql';

$conf['sql']['phptype'] = 'mysqli'; //mysql or mysqli, etc

// What protocol will we use to connect to the database.  The default
// is tcp, but if you wish to use UNIX sockets, change it to 'unix'.
$conf['sql']['protocol'] = 'tcp';

// If you are using UNIX sockets, you may need to specify the socket's
// location.
// $conf['sql']['socket'] = '/var/lib/mysql/mysql.sock';

// What port is the database server running on? Not required for all
// databases.
// $conf['sql']['port'] = 5432;

// What hostname is the database server running on, or what is the
// name of the system DSN to use?
$conf['sql']['hostspec'] = 'localhost';

// What username do we authenticate to the database server as?
$conf['sql']['username'] = 'dt_logger';
// What password do we authenticate to the database server with?
$conf['sql']['password'] = 'YOURPASSWORDHERE';

// What database name/tablespace are we using?
$conf['sql']['database'] = 'stats';
//Main table name that digitemp_mysql.pl logs to
$conf['sql']['table'] = 'digitemp';
//Metadata table describing available sensors
$conf['sql']['table_meta'] = 'digitemp_metadata';
//Alarms table describing raised/old alarms
$conf['sql']['table_alarms'] = 'digitemp_alarms';
// What charset does the database use internally?
$conf['sql']['charset'] = 'iso-8859-1';

/********************* LOGGER **********************/
/****************************************************/
// This is for the script that will insert current
// readings into the database (PHP version).
// This is optional - it is needed only if you logger.php (on cron)
$conf['digitemp_binary'] = '/usr/bin/digitemp_DS2490';
$conf['digitemp_config'] = '/home/jdrews/digitemp/digitemp.conf';

/************** JPGraph Properties ******************/
/****************************************************/

//The dir path under which jpgraph.php and others can be found
//This may be relative or absolute (filesystem, not url)
$conf['jp_path'] = "/usr/share/jpgraph/";

Ok now that that’s done let’s make sure you can see your webpage. Go to http://localhost/dtgraph (or whatever you named your folder). You should see the webpage. If not check to make sure apache and mysql are running. You could also see a blank page if index.php is not a default page type. If so go to http://localhost/dtgraph/index.php. Lastly start reading through the INSTALL file in dtgraph and see if there’s something we missed. 😉

Now lets set up the logging. I’m going to be using the logger.php that’s included with dtgraph. It pulls it configuration values from the conf.php file so as long as that’s set up correctly you should be able to run the following and get it to insert data into your digitemp database.

php /var/www/dtgraph/admin/logger.php

Now log into your mysql database and see if you have data. If all went well it should look like this.

root@jdrews-M2Ne:/var/www/dtgraph# mysql -u dt_logger -p stats
Enter password:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 459
Server version: 5.1.61-0ubuntu0.11.10.1 (Ubuntu)

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> select * from digitemp;
+-------+---------------------+------------------+------------+
| dtKey | time                | SerialNumber     | Fahrenheit |
+-------+---------------------+------------------+------------+
|     0 | 2012-03-16 10:45:02 | 107CD17B02080088 |      69.01 |
+-------+---------------------+------------------+------------+
1 row in set (0.00 sec)

Horray we have data! So let’s add some more datapoints by running the logger.php script a few more times. Now go look at your website again and you should see plot points. If not, you most likely have an issue connecting to the database. Check your conf.php and make sure it’s all correct.

Now it’s a good idea to password protect your admin folder if this is gonna be viewable from outside your network. You can do this with a simple .htaccess file sitting in the /admin folder. Refer to the tutorial here for more details: https://help.ubuntu.com/community/EnablingUseOfApacheHtaccessFiles

You set up the colors of your graph and the name of your sensors in the admin section. Here’s a helpful hint– Put your thumb and index finger on a sensor and watch the temp go up to figure out which is which.

http://localhost/dtgraph/admin/

Here’s how mine is set up.

You’ll notice I have alarms set for range and change amounts. To do this you’ll need to use sendmail or ssmtp (how I did it).

I’ll update this post later on how to set up ssmtp so your new fangled temperature monitoring system can send you alerts when your precious homebrew gets to warm/cold, or starts warming up/cooling down too fast.