Created
November 9, 2011 12:09
-
-
Save Shinpeim/1351262 to your computer and use it in GitHub Desktop.
CloudForecastでQudoの溜まってるjob queueの量をグラフ化するやつ
This file contains 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::Qudo; | |
use CloudForecast::Data -base; | |
use Qudo; | |
=head1 NAME | |
CloudForecast::Data::Qudo | |
=head1 SYNOPSIS | |
host_config) | |
resources: | |
- qudo:dsn:user:password:job | |
=cut | |
rrds ["queue",'GAUGE']; | |
graphs 'queue' => 'Queue'; | |
title { | |
my $c = shift; | |
my $title = "Qudo"; | |
if ( my $job = $c->args->[3] ) { | |
$title .= " $job"; | |
} | |
return $title; | |
}; | |
fetcher { | |
my $c = shift; | |
my $dsn = $c->args->[0]; | |
my $user = $c->args->[1]; | |
my $password = $c->args->[2]; | |
my $job = $c->args->[3]; | |
$job =~ s/_/::/g; | |
$dsn =~ s/_/:/g; | |
my $qudo = Qudo->new( | |
driver_class => 'DBI', | |
databases => [{ | |
dsn => $dsn, | |
username => $user, | |
password => $password, | |
}], | |
manager_abilities => [$job], | |
); | |
my $queue = $qudo->job_count($job, $dsn ); | |
return [ $queue ]; | |
}; | |
__DATA__ | |
@@ queue | |
DEF:queue=<%RRD%>:queue:AVERAGE | |
AREA:queue#00C000:Queue | |
GPRINT:queue:LAST:Cur\: %6.1lf | |
GPRINT:queue:AVERAGE:Ave\: %6.1lf | |
GPRINT:queue:MAX:Max\: %6.1lf | |
GPRINT:queue:MIN:Min\: %6.1lf\c |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment