Category Archives: random

Quick & Dirty Server Monitoring

Sometimes it’s difficult to setup Nagios for server monitoring. This is what I do instead.

Firstly, for load monitoring:


#!/bin/bash

FILENAME=< absolute path >/monitoring/logs/load-$(date +%Y%m%d).txt

cat /proc/loadavg | awk '{print strftime("%Y/%m/%d %H:%M:%S", systime()), $1, $2, $3}' >>  $FILENAME

Run it both from cron, and then I use another cron script and gnuplot to graph the output.

genloadgraph.sh:



DATE=$1
if [ -z $DATE ]; then DATE="$(date +%Y%m%d)"; fi
FILENAME=load-$DATE.txt
cp < absolute path >/monitoring/logs/$FILENAME < absolute path >/monitoring/load.txt
gnuplot < absolute path >/monitoring/loadplot.p
rm < absolute path >/monitoring/load.txt

loadplot.p:


set terminal png large size 800,600
set xdata time
set timefmt "%Y/%m/%d %H:%M:%S"
set title "Load"
set format x "%H:%M:%S"
set out '< absolute path >/monitoring/load.png'
plot "< absolute path >/monitoring/load.txt" using 1:3 title '1 min average' with lines, "< absolute path >/monitoring/load.txt" using 1:4 title '5 min average' with lines, "< absolute path >/monitoring/load.txt" using 1:5 title '15 min average' with lines
set output

Gives a graph like this:

Load Graph

It possible to do a similar thing for website monitoring:



#!/bin/bash

FILENAME=< absolute path >/monitoring/logs/nicklothian-$(date +%Y%m%d).txt
(time wget -q --delete-after http://nicklothian.com/blog/) 2>&1 | awk '/real/ {print strftime("%Y

/%m/%d %H:%M:%S", systime()), $2}' >> $FILENAME

Recommendations for Australian Contractor service companies?

I’m currently employed as a contractor, which means I need to have my own company (I operate as a sole trader). For a variety of reasons this sucks, and I’m interested in any recommendations for companies which act as contractor shell companies (I’m not sure what the proper terminology is). What I’m looking for is a company which employs me as an employee, and the company I actually work for pays my contract rate to. Then the shell company handles all the tax obligations, etc.

I’ve heard of a few companies in Australia which do this, but the only one I remembered to save is Entity Solutions. Anyone got any other recommendations (or experience with them)?

Desktop Tower Defense Strategies

Somewhat to my surprise, it seems that more people want to read about Desktop Tower Defense than they do about anything else I’ve written. Over the last few days roughly 40% of the traffic to this blog has been to my previous post on DTD.

While I’m a long way from an excellent player, I’ve developed my strategies to the point where I’m consistently scoring just below 6000 points.

My first tip is that it’s a mistake to try and build a really long maze. When I started playing I tried to make the longest maze possible, covering the board with towers. That’s a mistake because you just can’t get the firepower you need to stop the creeps on higher levels. Instead, concentrate on upgrading towers in the center of the board. I find its better to upgrade a couple of towers to the maximum level, a fair few to medium levels, but I leave plenty untouched. I usually aim to have two Squirt Towers upgraded to Typhoon Towers separated by a Bash Tower.

My second tip is to use Swarm Towers. For a while I tried to avoid that, and thought that I should be able to deal with flying creeps just using Squirt Towers. It might be possible, but I sure haven’t got it to work. One problem with the Squirt Tower only strategy is that typically they are also dealing with other creeps at the same time the flying creeps need to be shot down. I’ve found that three appropriately upgraded Swarm Towers give enough support to my existing Squirt Towers to enable me to shoot down all flying creeps.

My final tip it to be aggressive in the use of the “Send next level” button. It’s pretty easy to pick up 500+ points like this.

I think these three tips are the difference between scoring 3500 and scoring 5900+. If I had to guess I’d say the first tip is worth over 1000 points, and the second two are worth roughly 500 points each.

So there you go – Nick’s quick Desktop Tower Defense Strategy guide. Feel free to add your own tips here, and to add your scores to the “badmagicnumber” group