King of the Potato People

Code, photos and ramblings of Rick Hodger

Archive for the ‘Coding’ Category

Postfix Mail Queue statistics via SNMP

without comments

This post documents a small shell script designed to provide basic mail queue statistics via SNMP for Postfix.

Requirements

Installation

The code can be downloaded here.

To install, place the script anywhere in your system and edit it to provide the correct path to the “qshape” perl script that comes with Postfix.

Note: Under openSUSE qshape.pl is part of the postfix-docs package and is not installed by default.

To configure net-snmp, edit your snmpd.conf line and add a line as follows:

pass [oid-of-choice] /bin/snmpqshape.sh [oid-of-choice]

For example, due to a quirk in a paticular SNMP monitoring package I use, I had to use an OID belonging to Motorola:

pass .1.3.6.1.4.1.17713.2 /bin/snmpqshape.sh .1.3.6.1.4.1.17713.2

Net-SNMP will return 3 OIDs on query:

.0 :: Incoming
.1 :: Active
.2 :: Deferred

MRTG / RRDTool

Since the setup of monitoring / statistics tools such as MRTG or RRDTool is site-specific, no provisions are made on this page to provide a complete usage example. A minimal example for RRDTool:
#! /bin/sh
STR="`snmpwalk -OvQ -r 10 -t 5 -v 2c -c publicommunity hostname.site.com \
.1.3.6.1.4.1.17713.2 | perl -ne 's/^/:/;s/\n//;print'`"
rrdtool update /path/to/rr-database.rrd -t incoming:active:deferred N${STR}

DISCLAIMER
This code is free to use and distribute, and the author offers no liability or warranty for it’s misuse.

Written by rick

June 16th, 2009 at 4:30 pm

Posted in Coding, Geek, Linux

Tagged with , , , , , ,

PHP :: Convert a string to NATO alphabet

without comments

Giving a password over the phone to someone is always painful, and I can never remember the NATO alphabet (Whiskey Tango Foxtrot!). The following PHP function will convert any string into the NATO alphabet for easy recitation.

Read the rest of this entry »

Written by rick

April 16th, 2009 at 4:05 pm

Posted in Coding, Geek

Spamhaus DROP list

without comments

The Spamhaus DROP list (Don’t Route or Peer) is still awaiting it’s BGP feed for network providers. So in the meantime, I’ve knocked up a little PHP script that downloads the DROP list from Spamhaus and spits out either a list of IPtables rules or a Cisco access control list.

View Source: http://www.potato-people.com/code/misctools/spamhausdrop.phps

Download: http://www.potato-people.com/code/misctools/spamhausdrop.tar.gz

Written by rick

September 18th, 2008 at 10:04 am

Posted in Coding, Geek, ISP

Tagged with , , ,

Reservoir

with one comment

In my spare time, I’m working on a tool for photographers for managing photo collections. I was unable to find one that matched my requirements in the open source world, and frankly didn’t like the look of a lot of the commercial ones. Plus, making it web based means I can access my photos from anywhere in the world.

Click through for a demo video of the progress so far…

Read the rest of this entry »

Written by rick

April 11th, 2008 at 12:09 pm

Posted in Coding, Photography

Tagged with , , , ,