Postfix Mail Queue statistics via SNMP
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.
PHP :: Convert a string to NATO alphabet
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.
IPv6 Subnet Size Reference Table
More numbers than you can shake a stick at. Just to give you an idea, at the ISP level (/32) that’s 79 septillion IP addresses assigned. That number is so big I had to go look it up on Wikipedia to find out what it’s called. Every home user will have 18 quntillion addresses at his disposal – I don’t have 18 quntillion pieces of lint in my house, let alone a desire to connect every single one to the internet!
Rant :: How to suck as a customer
Folks, domain names are a subscription service. That means you have to pay to keep them every so often.
You don’t pay for them once and keep them forever. If it’s a .com, you most likely have to renew it every year and it’s a lot like your Time magazine subscription: If you don’t pay the bill, you stop receiving the service. » Read more…
Limit total bandwidth on Linux
Want to limit the total bandwidth available to a Linux server, and don’t want to do it at the switch or router? Here’s how!
Spamhaus DROP list
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
Pet Hate: MTR
MTR, also known as Matt’s Trace Route, is an enahanced traceroute utility which after making the initial run continues to rerun the traceroute and calculate hop-specific packet loss and latencies.
Unfortunately, virtually everytime someone calls me and mentions “packet loss” and “MTR” in the same breath, it’s because they do not understand the output.





