Categories

A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.

Block Paving…

So time for a new patio and drive.

The build as it evolves…

Share

A rainy day in Boca Raton

20130502_192913 20130502_192909 20130502_192907 20130502_192723 20130502_192720 20130502_192918It started out as a gentle shower atr around 10:00. By 14:00 it was a full blown storm…

 

20130502_212629 20130502_210743 20130502_210057

Share

Raspberry pi server monitoring with MRTG

A number of projects have been created to log sensor data from various things such as temperature or server availability etc. One of the most popular ways has been to use the cosm website or to write to google docs.

In a previous experiment I used mrtg to create graphs on my own web server. So having a spare raspberry pi and a bunch of scripts from other people I hacked it all together…

Some example graphs:-

 The first one is my router throughput and the second is a temperature sensor

 

192_168_0_1_1-day

temp2-day

 

 

I’ll start with simply gettung mrtg to run on the Pi and then show how to log other things.  Currently I’m logging two different temperature sensors, pressure, humidity, ping response from 2 servers and my adsl router usage.

First step is to install apache web server and mrtg.

This post may help

sudo apt-get install apache2 php5 libapache2-mod-php5

type “sudo groupadd www-data”, then
“sudo usermod -g www-data www-data”.
Now restart apache with
“sudo service apache2 restart”.

Then install mrtg. Amongst the other web sites, this one provides a lot of hints and tips.

Sudo apt-get install mrtg

Create the mrtg work directory

Sudo mkdir /var/www/mrtg

You will need to enable snmp on your router and change the community string from public to a more secure value. In this case we will use ‘community’

Assuming this is done then create an mrtgconfig file. Replacing the ip address below for yours.

sudo cfgmaker –output=/etc/mrtg.cfg  –global “workdir: /var/www/mrtg” community@192.168.0.1

This looks at the snmp mibs in your router and creates a standard cfg file.

Next we need to create the html file to display the graphs.

Sudo indexmaker –output=/var/www/mrtg/index.html /etc/mrtg.cfg

Finally we need to set a cron job to refreshh the graphs every 5 mins.

Edit the cron file.

Sudo nano /etc/cron.d/mrtg

To add the line

*/5 * * * * root env LANG=C /usr/bin/mrtg /etc/mrtg.cfg >> /var/log/mrtg/mrtg.log

This line may already be configured by MRTG. Essenstially it causes MRTG to run every 5 minutes and read the config file /etc/mrtg.cfg. The graph will then be output into the /var/www/mrtg directory where it is then displayed precio del viagra using thr /var/www/mrtg/index.html file.

MRTG can be used to graph many other data series. All it needs is 2 values output to the screen. So a simple script for the temperature sensor just needs to return two values. e.g. the command:-

sudo ./bmp085.py 11 4 # read temp

0

24

MRTG would then plot the two series as 0 and 24. In my example only 1 value is significant as the sensor only provides temperature. Another example may provide temperature and humidity. e.g.

sudo ./dht11 11 4

24

35

MRTG can then plot the two values on the same graph.

To plot ping stats for an IP address i installed mrtg-ping-probe. This just returns a couple of values. e.g.

mrtg-ping-probe 192.168.0.1

24

133

In order to get mrtg to add thes feature we need to add another element to the config file

A sample cfg file…

Target[temp2]: `/home/pi/bmp085/bmp085.py`

 MaxBytes[temp2]: 100

YLegend[temp2]: Deg

Legend1[temp2]: .

Legend2[temp2]: .

Legend3[temp2]: .

Legend4[temp2]: .

LegendO[temp2]:Events

LegendI[temp2]:

ShortLegend[temp2]: Temp

Title[temp2]: Temp2

Options[temp2]: gauge, nopercent, integer, unknaszero

Colours[temp2]: GREEN#00eb0c,BLUE#0000ff,GRAY#AAAAAA,VIOLET#ff00ff

WithPeak[temp2]: ymw

PageTop[temp2]: <H1>Temp2</H1>

 

 

Share

Raspberry Pi games

 

I had to get one. So i got two! The first one is just running XBIAN (XBMC). For those that dont know this is a media centre and with a few plug-ins such as TVCatchup it hangs off th eback of a spare HD TV and streams some free TV channels. I also discovered i can send any media on my phone to this setup as well.

The second one is more for playing around with. At the moment its running a NAS drive for backups and music etc. Theres plenty of help for this on the net at http://elinux.org/R-Pi_NAS and it works quite well.

I’m also playing around with bluetooth. I discovered this site http://www.dreamgreenhouse.com/projects/2012/rpibt/index.php .

I followed it more or less. I tried using it on Arch linux but this wouldnt find any devices so i installed Raspbian and it worked. I then mashed up a couple of scripts to send an email  whenever the Pi scans and finds another bluetooth device in range. 

I used this script to scan  for a bluetooth device

#!/bin/bash

if   hcitool scan | grep “:” > string

then

/home/pi/sendit.sh

else

echo “failed”

fi

The second script is a small python script to send an email. Its not pretty but it works and send the contents fo the file “string” which is the BT or MAC address of the devices found in the scan.

#!/usr/bin/python

import smtplib

import sys

message = “””From: Pi from@email.com

To: Home destination@email.com

Subject: Bluetooth Alert

“””

bluetooth = open(‘string’, ‘r’).read()

mssg=message+bluetooth

server = smtplib.SMTP(“mail.server.com”)

server.ehlo()

server.starttls()

server.ehlo()

server.login(‘from@email.com’, ‘password’)

# print message

print bluetooth

server.sendmail(‘from@email.com’,’destination@email.com’, mssg)

server.quit()

 

 

 

 

Share

The Run 11

It’s a year since I decided to start running again. About this time last year i found myself enterred for ‘The Run 10’. I had previously entered The Run 09 but had to drop out due to a torn calf muscle.

I hadnt trained for a while last year and managed to go round in 1:05. I’m hoping to beat that and ideally make jt I’m under an hour. I have beaten an hour on my last 2 10k runs but the weather is likely to make that a real challenge.

But I’ve run more or less 500 mikes since last year so I should do better …. The one fly in the ointment… 26 degrees! Hotter than July …

Well it was warm alright. I managed 59:57 pretty close to the hour lol. Ther were over 1500 finishers which made it pretty crowded at the start and finish.

20111003-190727.jpg

20111003-190739.jpg

Share

Coffee! Who needs Costas?

After months of searching I finally managed to get s new coffee machine. I’ve been searching for a bean to cup machine so I can chose espresso or make my own latte etc.

20110921-231916.jpg

The machine is a Delonghi esam4200 and it’s so cool. Fill up with water and beans and just dial the strength and quantity. Press the button and off it goes 🙂

It seems to go from cold to americano in the same time it takes the kettle to boil. It even cleans itself on switch on and switch off!

Some nice goodies. Caramel shortbread and cherry and almond slices!

20110929-183049.jpg

20110929-183103.jpg

Share

First half marathon…!

Trying to run a half marathon in my birthday 17/7/2011.

Not sure I’ll make it but my runners pack arrived so I’m getting nervous!

20110524-115341.jpg

The route is now published here. Only 2 days to go! 343 miles this year in training and the weather is going to be cool with some rain. Perfect for me.

Race day Update!
We arrived at 9am, plenty of parking and just a 5 minute walk to the start. The weather was perfect for me. 15 degrees c with a threat of rain.
The main problem then being the 200meter queue for the toilets!

 

The dedicated few took part in the warm up while we connected up our Garmins and iPhones. Being first timers we lined up with the sub 3hour marker. It wasn’t long and we were off. The first 500 yards was along an estate road but then we turned onto pathway’s. This was quite crowded and until 3 miles it was a little bit challenging.
By about 6 miles the first shower came and I was feeling pretty good still managing 10 minute miles. But by mile 9 my quads were cramping and it began to get tough. Another shower and it was mile 11. I was having to walk A few yards every half mile and it was sheer will power and crowd support pushing me on now.
The last 500 yards was very hard but I was determined to finish running and managed 2:18:23. Not bad for a first half marathon at age 51.

So the question I still feel uncomfortable answering is… Am I s runner or a jogger?

Share

Deddington Farmers Market

It’s always nice to visit Deddington farmers market. the whole village comes alive and naturally the church get in on the act too.

The church put in a coffe and biscuit stall as well as a few local craft stalls. The result is a very pleasant day.

The produce is all local and pretty high quality and I can never resist a nice joint of beef

Share

Running again

My knee is behaving so I’m running longer.
I managed 15 miles last week and now feel I should go for another 10k. Actually I’d love to reach the dizzy distance of a half marathon 🙂

So far I’ve managed 7.8 miles. Could I stretch to 13.1…..

Share

English Table Tennis Open

A visit to Sheffield on Friday. A great opportunity to see some of the worlds top players

Share

Trapped in Milton Keynes by snow!

Around 4 inches of snow yesterday meant that the major roads of the UK were brought to a halt for around 6 hours or so. Of course the airports remained closed for 24 hours. Why we can’t cope is a mystery and quite irritating…

Share

Feeding a hungry student…

Courtesy of Ikea…

Share

A service not offered in many places!

I couldn’t resist this. What an unusual service to offer. 🙂

Share

Costas caramel slices…

Just how many calories can one man enjoy…

Share