Graphite-Enumerator
view release on metacpan or search on metacpan
bin/find-unused-graphite-metrics.pl view on Meta::CPAN
"interval=s" => \$interval,
"path=s" => \$basepath,
"v" => \my $verbose,
);
my $gren = Graphite::Enumerator->new(
host => 'https://graphite.example.com',
basepath => $basepath,
lwp_options => {
env_proxy => 0,
keep_alive => 1,
},
);
$gren->enumerate( sub {
my ($path) = @_;
my $last_hour_data_url = $gren->host . "render/?format=json&from=-$interval&target=summarize($path,%22$interval%22,%22max%22,true)";
my $res = $gren->ua->get($last_hour_data_url);
if ($res->is_success) {
my $last_hour_data = decode_json($res->content);
return if !$last_hour_data || !@$last_hour_data;
bin/graphite-ls.pl view on Meta::CPAN
USAGE
exit;
};
my $host = shift; # e.g. 'http://graphite.example.com'
my $basepath = shift // '';
my $gren = Graphite::Enumerator->new(
host => $host,
basepath => $basepath,
lwp_options => {
env_proxy => 0,
keep_alive => 1,
},
);
my $count = $gren->enumerate( sub {
my ($path) = @_;
$path =~ s/^\Q$basepath.// if our $t;
say $path;
} );
say "- $count metrics found";
lib/Graphite/Enumerator.pm view on Meta::CPAN
Graphite::Enumerator - Utility module to recursively enumerate graphite metrics
=head1 SYNOPSIS
my $gren = Graphite::Enumerator->new(
host => 'https://graphite.example.com',
basepath => 'general.metrics',
lwp_options => {
env_proxy => 1,
keep_alive => 1,
},
);
$gren->enumerate(sub {
my ($path) = @_;
print "Found metric $path !\n";
});
=head1 METHODS
=head2 Graphite::Enumerator->new(%args)
( run in 1.803 second using v1.01-cache-2.11-cpan-39bf76dae61 )