Skip to content

Instantly share code, notes, and snippets.

@kazeburo
Created August 12, 2010 10:01
Show Gist options
  • Save kazeburo/520671 to your computer and use it in GitHub Desktop.
Save kazeburo/520671 to your computer and use it in GitHub Desktop.
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 $ret = $c->component('SNMP')->get(
["1.3.6.1.4.1.2021.95.101","1"],
["1.3.6.1.4.1.2021.95.101","2"]
);
return [undef,undef] if !$ret;
my $queue;
my $preprocess;
if ( $ret->[0] || "" =~ m!messages in queue: (\d+)! ) {
$queue = $1;
}
if ( $ret->[1] || "" =~ m!messages in queue but not yet preprocessed: (\d+)! ) {
$preprocess = $1;
}
return [ $queue, $preprocess ];
};
1;
__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
exec .1.3.6.1.4.1.2021.95 qmailqueue /var/qmail/bin/qmail-qstat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment