Created
August 4, 2010 06:52
-
-
Save kazeburo/507761 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::Qmailqueue; | |
use CloudForecast::Data -base; | |
use CloudForecast::Log; | |
rrds map { [ $_, 'GAUGE' ] } qw /queue preprocess/; | |
graphs 'queue' => 'Qmail Queue'; | |
title { "Qmail Queue" }; | |
fetcher { | |
my $c = shift; | |
my $etbl = $c->component('SNMP')->table("nsExtendConfigTable"); | |
if ( !$etbl ) { | |
CloudForecast::Log->warn("couldnot get ExtendConfigTable"); | |
return [undef, undef]; | |
} | |
my $iid; | |
for my $id ( keys %{$etbl} ) { | |
if ( $etbl->{$id}->{nsExtendToken} eq 'qmail' ) { | |
$iid = $id; | |
last; | |
} | |
} | |
if ( !$iid ) { | |
CloudForecast::Log->warn("couldnot find qmail configuration"); | |
return [undef, undef]; | |
} | |
my $ret = $c->component('SNMP')->get(["nsExtendOutputFull",$iid]); | |
my $content = $ret->[0]; | |
my $queue; | |
my $preprocess; | |
if ( $content =~ m!messages in queue: (\d+)! ) { | |
$queue = $1; | |
} | |
if ( $content =~ m!messages in queue but not yet preprocessed: (\d+)! ) { | |
$preprocess = $1; | |
} | |
return [ $queue, $preprocess ]; | |
}; | |
__DATA__ | |
@@ queue | |
DEF:my1=<%RRD%>:queue:AVERAGE | |
DEF:my2=<%RRD%>:preprocess:AVERAGE | |
AREA:my2#0000FF: Preprocess | |
GPRINT:my2:LAST:Current\:%6.2lf | |
GPRINT:my2:AVERAGE:Ave\:%6.2lf | |
GPRINT:my2:MAX:Max\:%6.2lf\c | |
STACK:my1#C00000: Queue | |
GPRINT:my1:LAST:Current\:%6.2lf | |
GPRINT:my1:AVERAGE:Ave\:%6.2lf | |
GPRINT:my1: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
extend qmail /pato/to/bin/qmail-qstat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment