Created
March 11, 2013 15:55
-
-
Save myfinder/5135246 to your computer and use it in GitHub Desktop.
CloudForecast Data Object for Riak
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::Riak; | |
use CloudForecast::Data -base; | |
use LWP::UserAgent; | |
use JSON; | |
=head1 NAME | |
CloudForecast::Data::Riak - riak resource monitor | |
=head1 SYNOPSIS | |
host_config) | |
resources: | |
- riak[[:port]:title]] | |
see also) | |
- http://docs.basho.com/riak/1.3.0/cookbooks/Statistics-and-Monitoring/ | |
=cut | |
rrds map { [$_,'COUNTER'] } qw/node_gets_total node_puts_total coord_redirs_total/; | |
rrds map { [$_,'GAUGE'] } qw/fsm_objsize_mean fsm_objsize_median fsm_objsize_95 fsm_objsize_100 get_fsm_time_mean get_fsm_time_median get_fsm_time_95 get_fsm_time_100 put_fsm_time_mean put_fsm_time_median put_fsm_time_95 put_fsm_time_100 fsm_siblings_mean fsm_siblings_median fsm_siblings_95 fsm_siblings_100 memory_proc_used read_repairs read_repairs_total pbc_connect pbc_active sys_process_count/; | |
graphs 'operation_count' => 'get/set/redirect count'; | |
graphs 'get_objsize' => 'node_get_fsm_objsize'; | |
graphs 'get_time' => 'node_get_fsm_time'; | |
graphs 'put_time' => 'node_put_fsm_time'; | |
graphs 'siblings' => 'node_get_fsm_siblings'; | |
graphs 'read_repairs' => 'read repairs'; | |
graphs 'pbc_conns' => 'protobuf connections'; | |
graphs 'memory_used' => 'memory process used'; | |
graphs 'proc_count' => 'system process count'; | |
title { | |
my $c = shift; | |
my $title = $c->args->[1] || "riak"; | |
if ( my $port = $c->args->[0] ) { | |
$title .= " ($port)"; | |
} | |
return $title; | |
}; | |
fetcher { | |
my $c = shift; | |
my $host = $c->address; | |
my $port = $c->args->[0] || 8098; | |
my $ua = LWP::UserAgent->new; | |
my $res = $ua->get("http://$host:$port/stats"); | |
my $body = decode_json($res->content); | |
return [ $body->{node_gets_total}, $body->{node_puts_total}, $body->{coord_redirs_total}, $body->{node_get_fsm_objsize_mean}, $body->{node_get_fsm_objsize_median}, $body->{node_get_fsm_objsize_95}, $body->{node_get_fsm_objsize_100}, $body->{node_get_fsm_time_mean}, $body->{node_get_fsm_time_median}, $body->{node_get_fsm_time_95}, $body->{node_get_fsm_time_100}, $body->{node_put_fsm_time_mean}, $body->{node_put_fsm_time_median}, $body->{node_put_fsm_time_95}, $body->{node_put_fsm_time_100}, $body->{node_get_fsm_siblings_mean}, $body->{node_get_fsm_siblings_median}, $body->{node_get_fsm_siblings_95}, $body->{node_get_fsm_siblings_100}, $body->{read_repairs}, $body->{read_repairs_total}, $body->{pbc_connect}, $body->{pbc_active}, $body->{memory_processes_used}, $body->{sys_process_count} ]; | |
}; | |
__DATA__ | |
@@ operation_count | |
DEF:my1=<%RRD%>:node_gets_total:AVERAGE | |
DEF:my2=<%RRD%>:node_puts_total:AVERAGE | |
DEF:my3=<%RRD%>:coord_redirs_total:AVERAGE | |
AREA:my1#00C000:Gets | |
GPRINT:my1:LAST:Cur\: %6.1lf | |
GPRINT:my1:AVERAGE:Ave\: %6.1lf | |
GPRINT:my1:MAX:Max\: %6.1lf | |
GPRINT:my1:MIN:Min\: %6.1lf\c | |
STACK:my2#0000C0:Sets | |
GPRINT:my2:LAST:Cur\: %6.1lf | |
GPRINT:my2:AVERAGE:Ave\: %6.1lf | |
GPRINT:my2:MAX:Max\: %6.1lf | |
GPRINT:my2:MIN:Min\: %6.1lf\c | |
STACK:my3#eaaf00:Redirect | |
GPRINT:my3:LAST:Cur\: %6.1lf | |
GPRINT:my3:AVERAGE:Ave\: %6.1lf | |
GPRINT:my3:MAX:Max\: %6.1lf | |
GPRINT:my3:MIN:Min\: %6.1lf\c | |
@@ get_objsize | |
DEF:my1=<%RRD%>:fsm_objsize_mean:AVERAGE | |
DEF:my2=<%RRD%>:fsm_objsize_median:AVERAGE | |
DEF:my3=<%RRD%>:fsm_objsize_95:AVERAGE | |
DEF:my4=<%RRD%>:fsm_objsize_100:AVERAGE | |
AREA:my1#8a8ae6:Mean | |
GPRINT:my1:LAST:Cur\: %6.1lf | |
GPRINT:my1:AVERAGE:Ave\: %6.1lf | |
GPRINT:my1:MAX:Max\: %6.1lf | |
GPRINT:my1:MIN:Min\: %6.1lf\c | |
STACK:my2#6060e0:Median | |
GPRINT:my2:LAST:Cur\: %6.1lf | |
GPRINT:my2:AVERAGE:Ave\: %6.1lf | |
GPRINT:my2:MAX:Max\: %6.1lf | |
GPRINT:my2:MIN:Min\: %6.1lf\c | |
STACK:my3#80e080:95th PCTL | |
GPRINT:my3:LAST:Cur\: %6.1lf | |
GPRINT:my3:AVERAGE:Ave\: %6.1lf | |
GPRINT:my3:MAX:Max\: %6.1lf | |
GPRINT:my3:MIN:Min\: %6.1lf\c | |
STACK:my4#000080:100th PCTL | |
GPRINT:my4:LAST:Cur\: %6.1lf | |
GPRINT:my4:AVERAGE:Ave\: %6.1lf | |
GPRINT:my4:MAX:Max\: %6.1lf | |
GPRINT:my4:MIN:Min\: %6.1lf\c | |
@@ get_time | |
DEF:my1=<%RRD%>:get_fsm_time_mean:AVERAGE | |
DEF:my2=<%RRD%>:get_fsm_time_median:AVERAGE | |
DEF:my3=<%RRD%>:get_fsm_time_95:AVERAGE | |
DEF:my4=<%RRD%>:get_fsm_time_100:AVERAGE | |
AREA:my1#8a8ae6:Mean | |
GPRINT:my1:LAST:Cur\: %6.1lf | |
GPRINT:my1:AVERAGE:Ave\: %6.1lf | |
GPRINT:my1:MAX:Max\: %6.1lf | |
GPRINT:my1:MIN:Min\: %6.1lf\c | |
STACK:my2#6060e0:Median | |
GPRINT:my2:LAST:Cur\: %6.1lf | |
GPRINT:my2:AVERAGE:Ave\: %6.1lf | |
GPRINT:my2:MAX:Max\: %6.1lf | |
GPRINT:my2:MIN:Min\: %6.1lf\c | |
STACK:my3#80e080:95th PCTL | |
GPRINT:my3:LAST:Cur\: %6.1lf | |
GPRINT:my3:AVERAGE:Ave\: %6.1lf | |
GPRINT:my3:MAX:Max\: %6.1lf | |
GPRINT:my3:MIN:Min\: %6.1lf\c | |
STACK:my4#000080:100th PCTL | |
GPRINT:my4:LAST:Cur\: %6.1lf | |
GPRINT:my4:AVERAGE:Ave\: %6.1lf | |
GPRINT:my4:MAX:Max\: %6.1lf | |
GPRINT:my4:MIN:Min\: %6.1lf\c | |
@@ put_time | |
DEF:my1=<%RRD%>:put_fsm_time_mean:AVERAGE | |
DEF:my2=<%RRD%>:put_fsm_time_median:AVERAGE | |
DEF:my3=<%RRD%>:put_fsm_time_95:AVERAGE | |
DEF:my4=<%RRD%>:put_fsm_time_100:AVERAGE | |
AREA:my1#8a8ae6:Mean | |
GPRINT:my1:LAST:Cur\: %6.1lf | |
GPRINT:my1:AVERAGE:Ave\: %6.1lf | |
GPRINT:my1:MAX:Max\: %6.1lf | |
GPRINT:my1:MIN:Min\: %6.1lf\c | |
STACK:my2#6060e0:Median | |
GPRINT:my2:LAST:Cur\: %6.1lf | |
GPRINT:my2:AVERAGE:Ave\: %6.1lf | |
GPRINT:my2:MAX:Max\: %6.1lf | |
GPRINT:my2:MIN:Min\: %6.1lf\c | |
STACK:my3#80e080:95th PCTL | |
GPRINT:my3:LAST:Cur\: %6.1lf | |
GPRINT:my3:AVERAGE:Ave\: %6.1lf | |
GPRINT:my3:MAX:Max\: %6.1lf | |
GPRINT:my3:MIN:Min\: %6.1lf\c | |
STACK:my4#000080:100th PCTL | |
GPRINT:my4:LAST:Cur\: %6.1lf | |
GPRINT:my4:AVERAGE:Ave\: %6.1lf | |
GPRINT:my4:MAX:Max\: %6.1lf | |
GPRINT:my4:MIN:Min\: %6.1lf\c | |
@@ siblings | |
DEF:my1=<%RRD%>:fsm_siblings_mean:AVERAGE | |
DEF:my2=<%RRD%>:fsm_siblings_median:AVERAGE | |
DEF:my3=<%RRD%>:fsm_siblings_95:AVERAGE | |
DEF:my4=<%RRD%>:fsm_siblings_100:AVERAGE | |
AREA:my1#8a8ae6:Mean | |
GPRINT:my1:LAST:Cur\: %6.1lf | |
GPRINT:my1:AVERAGE:Ave\: %6.1lf | |
GPRINT:my1:MAX:Max\: %6.1lf | |
GPRINT:my1:MIN:Min\: %6.1lf\c | |
STACK:my2#6060e0:Median | |
GPRINT:my2:LAST:Cur\: %6.1lf | |
GPRINT:my2:AVERAGE:Ave\: %6.1lf | |
GPRINT:my2:MAX:Max\: %6.1lf | |
GPRINT:my2:MIN:Min\: %6.1lf\c | |
STACK:my3#80e080:95th PCTL | |
GPRINT:my3:LAST:Cur\: %6.1lf | |
GPRINT:my3:AVERAGE:Ave\: %6.1lf | |
GPRINT:my3:MAX:Max\: %6.1lf | |
GPRINT:my3:MIN:Min\: %6.1lf\c | |
STACK:my4#000080:100th PCTL | |
GPRINT:my4:LAST:Cur\: %6.1lf | |
GPRINT:my4:AVERAGE:Ave\: %6.1lf | |
GPRINT:my4:MAX:Max\: %6.1lf | |
GPRINT:my4:MIN:Min\: %6.1lf\c | |
@@ read_repairs | |
DEF:my1=<%RRD%>:read_repairs:AVERAGE | |
DEF:my2=<%RRD%>:read_repairs_total:AVERAGE | |
AREA:my1#00C000:Current | |
GPRINT:my1:LAST:Cur\: %6.1lf | |
GPRINT:my1:AVERAGE:Ave\: %6.1lf | |
GPRINT:my1:MAX:Max\: %6.1lf | |
GPRINT:my1:MIN:Min\: %6.1lf\c | |
STACK:my2#0000C0:Total | |
GPRINT:my2:LAST:Cur\: %6.1lf | |
GPRINT:my2:AVERAGE:Ave\: %6.1lf | |
GPRINT:my2:MAX:Max\: %6.1lf | |
GPRINT:my2:MIN:Min\: %6.1lf\c | |
@@ pbc_conns | |
DEF:my1=<%RRD%>:pbc_connect:AVERAGE | |
DEF:my2=<%RRD%>:pbc_active:AVERAGE | |
AREA:my1#00C000:Connect | |
GPRINT:my1:LAST:Cur\: %6.1lf | |
GPRINT:my1:AVERAGE:Ave\: %6.1lf | |
GPRINT:my1:MAX:Max\: %6.1lf | |
GPRINT:my1:MIN:Min\: %6.1lf\c | |
STACK:my2#0000C0:Active | |
GPRINT:my2:LAST:Cur\: %6.1lf | |
GPRINT:my2:AVERAGE:Ave\: %6.1lf | |
GPRINT:my2:MAX:Max\: %6.1lf | |
GPRINT:my2:MIN:Min\: %6.1lf\c | |
@@ memory_used | |
DEF:my1=<%RRD%>:memory_proc_used:AVERAGE | |
AREA:my1#00C000:Used | |
GPRINT:my1:LAST:Cur\: %6.1lf | |
GPRINT:my1:AVERAGE:Ave\: %6.1lf | |
GPRINT:my1:MAX:Max\: %6.1lf | |
GPRINT:my1:MIN:Min\: %6.1lf\c | |
@@ proc_count | |
DEF:my1=<%RRD%>:sys_process_count:AVERAGE | |
AREA:my1#00C000:Count | |
GPRINT:my1:LAST:Cur\: %6.1lf | |
GPRINT:my1:AVERAGE:Ave\: %6.1lf | |
GPRINT:my1:MAX:Max\: %6.1lf | |
GPRINT:my1:MIN:Min\: %6.1lf\c |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment