Created
August 12, 2010 09:31
-
-
Save kazeburo/520630 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package CloudForecast::Data::Postfixqueue; | |
use CloudForecast::Data -base; | |
use CloudForecast::Log; | |
rrds map { [ $_, 'GAUGE' ] } qw /incoming active deferred hold/; | |
graphs 'queue' => 'Postfix Queue'; | |
title { 'Postfix Queue' }; | |
fetcher { | |
my $c = shift; | |
my $ret = $c->component('SNMP')->extend('postfixqueue'); | |
return [undef,undef,undef,undef] if !$ret || !$ret->[0]; | |
$ret->[0]=~s/\s+$//g; | |
my %ret = map { split /:/,$_,2 } split /\s/,$ret->[0],4; | |
return [ | |
map { exists $ret{$_} ? $ret{$_} : undef } qw/incoming active deferred hold/ | |
]; | |
}; | |
1; | |
__DATA__ | |
@@ queue | |
DEF:my1=<%RRD%>:incoming:AVERAGE | |
DEF:my2=<%RRD%>:active:AVERAGE | |
DEF:my3=<%RRD%>:deferred:AVERAGE | |
DEF:my4=<%RRD%>:hold:AVERAGE | |
AREA:my1#0000C0: Incoming | |
GPRINT:my1:LAST:Current\:%6.2lf | |
GPRINT:my1:AVERAGE:Ave\:%6.2lf | |
GPRINT:my1:MAX:Max\:%6.2lf\c | |
STACK:my2#009900: Active | |
GPRINT:my2:LAST:Current\:%6.2lf | |
GPRINT:my2:AVERAGE:Ave\:%6.2lf | |
GPRINT:my2:MAX:Max\:%6.2lf\c | |
STACK:my3#990000: Deferred | |
GPRINT:my3:LAST:Current\:%6.2lf | |
GPRINT:my3:AVERAGE:Ave\:%6.2lf | |
GPRINT:my3:MAX:Max\:%6.2lf\c | |
STACK:my4#660000: Hold | |
GPRINT:my4:LAST:Current\:%6.2lf | |
GPRINT:my4:AVERAGE:Ave\:%6.2lf | |
GPRINT:my4:MAX:Max\:%6.2lf\c |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
PATH="/usr/sbin:$PATH" | |
QUEUES="incoming active deferred hold" | |
for i in $QUEUES; do | |
COUNT=`/usr/sbin/qshape $i|grep TOTAL | awk '{print $2}'` | |
printf "$i:$COUNT " | |
done | |
echo '' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extend postfixqueue /path/to/queue.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment