--- /dev/null
+# Register routine with plugin registery
+$CHECKFUNCS{'postqueue'} = \&check_postqueue;
+
+# Postfix mailq check for mail servers. If checks the number of mail
+# message queue against the $MAILQWARN AND $MAILQCRIT variables
+
+# $Id: check_postqueue,v 1.1 2005/10/27 19:15:58 willamowius Exp $
+
+use Spong::SafeExec qw(safe_exec);
+
+use File::Basename;
+
+sub check_postqueue {
+ my($mqcnt, $message, $color, $summary );
+
+ $singlq = 0;
+ my @msg = safe_exec($POSTQUEUE);
+ $mqcnt = 0;
+ while ($_ = shift @msg) {
+ $message .= $_;
+ if (/in (\d+) Requests\./) { $mqcnt = $1; }
+ next if (/^-/);
+ next if (length($_) < 4);
+ }
+
+ $color = "green";
+ if ($mqcnt > $MAILQWARN) { $color = "yellow"; }
+ if ($mqcnt > $MAILQCRIT) { $color = "red"; }
+ $summary = "Postfix mail queue count = $mqcnt";
+
+ &debug("postqueue - $color, $summary");
+ &status( $SPONGSERVER, $HOST, "postqueue", $color, $summary, $message );
+}
+
+# I'm include perl code, I need this line.
+1;
+