The personal website of Philip Mather

Scripts & Snippets

A place for storing and sharing the various scripts and snippets I've picked up here and there.

http://www.techniqal.com/blog/2005/06/20/simple-python-socket-test/

Sort IP addresses properly...
sort -t. -n -k1,1 -k2,2 -k3,3 -k4,4

Cacti SNMPd Bug

In the event that Cacti can connect to a box but isn't graphing it properly then it can be because the machines have been cloned and have identical ID numbers in /var/net-snmp/snmpd.conf, whilst this isn't normally a problem it the same cacti thread attempts to read from consecutive boxes with the same ID it causes problems. This is how to fix it...

$ sudo -s
# /etc/init.d/snmpd stop
Stopping snmpd:                                            [  OK  ]
# echo "createUser cacti MD5 c4ct1us3r" > /var/net-snmp/snmpd.conf
# /etc/init.d/snmpd start
Starting snmpd:                                            [  OK  ]

Oracle TNS listener woes

Oracle derives the IP address to bind it's listener to from the result of 'hostname -i' this in turn is derived from the first entry in '/etc/hosts' that matches the fully qualified host name, even when that entry is commented out with a hash! Hence the always have the fully qualified host name entry with the IP address (specifically when using a floating IPs) for Oracle at the very top or perhaps just below the localhost/127.0.0.1 entries.