Category Archives: Hosting

Quick nagios host config generator

Here is a quick script I have cobbled to generate nagios host configs it may need to be changed for template etc but you get the gist.

It includes support for padding of hostname numbers e.g. padding of 3 = web001, web002….web045…web999.

#!/bin/bash
# Nagios host config generater.
# Bruce Tonge
#
#If you need to gen a config for a large number of sequentialy numbered hosts
#just run:
#nagios.sh web example.com 1 50 3
#
#This will create host entries for machines 1-50 but named web001 - web050
#The output should be redirected to a file.

if [ “$#” -lt “4” ]
then
echo “usage: $0 <hostprefix> <fqdn> <first node number> <last node number> <host number padding>”
exit 0
fi

host_str=$1 #host prefix
fqdn_str=$2 #domain name
fnode_num=$3 #first node number
lnode_num=$4 #last node number
pad_num=$5 #charicters to pad

for hostnum in `seq -f”%0$5g” $3 $4`;
do
shorthostname=$host_str$hostnum
longhostname=$host_str$hostnum.$fqdn_str
printf “#Host Entry for Node $shorthostname.\n”
printf “define host{\n”
printf “\tuse\tbasic-host\n”
printf “\thost_name\t$shorthostname\n”
printf “\talias\t$shorthostname\n”
printf “\taddress\t$longhostname\n”
printf “\t}\n”
printf “\n”;
done
exit 0

My Single Line WordPress Upgrade

Here is my take on the single line word press upgrade I saw at hack a day.
The bellow will download the latest version and unpack it. IT then removes the new plugins and themes as to not over wright your installed ones. IT then copies the new install over the old one and resets the permissions on the files.
wget http://wordpress.org/latest.zip && unzip latest.zip && rm -rf ./wordpress/wp-content/ && cp -r ./wordpress/* ../

You may need to change the paths for your installation but this should work quite well.
As allways take a backup before you run this just in case.

Lost

The lost casts guys are back on the wire just before series 4 starts to air in the US. Cant wait to hear more from them. Also I just wanted to link this guy not that he isn’t popular enough or that linking him here will help. Johnny has done some really cool projects over the years more recently he has done alot with the Wii Mote that mos people will have seen all over the net. but I think that some of his other projects are of possibly greater note have a look.

I have also recently moved to another new server with more power and before it was really commissioned we purchased its replacement well this server will become a fail over node but that isn’t important. And we are now running ISPCP in anger. we have had to make several changes to the system to make it work the way we need and want it to but nothing to dramatic.  More info on ISPCP issues to follow.