Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions elasticsearch_cache
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ Tomas Doran (t0m) - c<< <bobtfish@bobtfish.net> >>

=cut

my $host = 'localhost';
my $host = exists $ENV{'host'} ? $ENV{'host'} : 'localhost';
my $port = exists $ENV{'port'} ? $ENV{'port'} : 9200;

my $ua = LWP::UserAgent->new;
$ua->timeout(10);
Expand All @@ -50,15 +51,16 @@ sub get_json_from_url {
return $data;
}

my $data = get_json_from_url("http://$host:9200/_cluster/nodes");
my $t_data = get_json_from_url("http://$host:9200/_cluster/nodes/stats");
my %out;
my $data = get_json_from_url("http://$host:$port/_cluster/nodes");
my $t_data = get_json_from_url("http://$host:$port/_cluster/nodes/stats");
my %out = (field_size => 0, filter_size => 0);

foreach my $full_node_name (keys %{$data->{nodes}}) {
next unless $t_data->{nodes}{$full_node_name};
$out{field_size} = $t_data->{nodes}{$full_node_name}{indices}{cache}{field_size_in_bytes};
$out{filter_size} = $t_data->{nodes}{$full_node_name}{indices}{cache}{filter_size_in_bytes};

if (defined($t_data->{nodes}{$full_node_name}{indices}{cache})) {
$out{field_size} += $t_data->{nodes}{$full_node_name}{indices}{cache}{field_size_in_bytes};
$out{filter_size} += $t_data->{nodes}{$full_node_name}{indices}{cache}{filter_size_in_bytes};
}
}
if ($ARGV[0] and $ARGV[0] eq 'config') {
print "graph_args --base 1024\n";
Expand Down
5 changes: 3 additions & 2 deletions elasticsearch_cluster_shards
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ Tomas Doran (t0m) - c<< <bobtfish@bobtfish.net> >>

=cut

my $host = 'localhost';
my $host = exists $ENV{'host'} ? $ENV{'host'} : 'localhost';
my $port = exists $ENV{'port'} ? $ENV{'port'} : 9200;

my $ua = LWP::UserAgent->new;
$ua->timeout(10);
Expand All @@ -50,7 +51,7 @@ sub get_json_from_url {
return $data;
}

my $data = get_json_from_url("http://$host:9200/_cluster/health");
my $data = get_json_from_url("http://$host:$port/_cluster/health");

if ($ARGV[0] and $ARGV[0] eq 'config') {
print "graph_title ElasticSearch cluster shards\n";
Expand Down
11 changes: 6 additions & 5 deletions elasticsearch_docs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ Tomas Doran (t0m) - c<< <bobtfish@bobtfish.net> >>

=cut

my $host = 'localhost';
my $host = exists $ENV{'host'} ? $ENV{'host'} : 'localhost';
my $port = exists $ENV{'port'} ? $ENV{'port'} : 9200;

my $ua = LWP::UserAgent->new;
$ua->timeout(10);
Expand All @@ -50,13 +51,13 @@ sub get_json_from_url {
return $data;
}

my $data = get_json_from_url("http://$host:9200/_cluster/nodes");
my $t_data = get_json_from_url("http://$host:9200/_cluster/nodes/stats");
my %out;
my $data = get_json_from_url("http://$host:$port/_cluster/nodes");
my $t_data = get_json_from_url("http://$host:$port/_cluster/nodes/stats");
my %out = (num_docs => 0);

foreach my $full_node_name (keys %{$data->{nodes}}) {
next unless $t_data->{nodes}{$full_node_name};
$out{num_docs} = $t_data->{nodes}{$full_node_name}{indices}{docs}{count};
$out{num_docs} += $t_data->{nodes}{$full_node_name}{indices}{docs}{count};
}

if ($ARGV[0] and $ARGV[0] eq 'config') {
Expand Down
11 changes: 6 additions & 5 deletions elasticsearch_index_size
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ Tomas Doran (t0m) - c<< <bobtfish@bobtfish.net> >>

=cut

my $host = 'localhost';
my $host = exists $ENV{'host'} ? $ENV{'host'} : 'localhost';
my $port = exists $ENV{'port'} ? $ENV{'port'} : 9200;

my $ua = LWP::UserAgent->new;
$ua->timeout(10);
Expand All @@ -50,13 +51,13 @@ sub get_json_from_url {
return $data;
}

my $data = get_json_from_url("http://$host:9200/_cluster/nodes");
my $t_data = get_json_from_url("http://$host:9200/_cluster/nodes/stats");
my %out;
my $data = get_json_from_url("http://$host:$port/_cluster/nodes");
my $t_data = get_json_from_url("http://$host:$port/_cluster/nodes/stats");
my %out = (index_size => 0);

foreach my $full_node_name (keys %{$data->{nodes}}) {
next unless $t_data->{nodes}{$full_node_name};
$out{index_size} = $t_data->{nodes}{$full_node_name}{indices}{store}{size_in_bytes};
$out{index_size} += $t_data->{nodes}{$full_node_name}{indices}{store}{size_in_bytes};
}
if ($ARGV[0] and $ARGV[0] eq 'config') {
print "graph_args --base 1024\n";
Expand Down
10 changes: 6 additions & 4 deletions elasticsearch_jvm_memory
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ Tomas Doran (t0m) - c<< <bobtfish@bobtfish.net> >>

=cut

my $host = 'localhost';
my $host = exists $ENV{'host'} ? $ENV{'host'} : 'localhost';
my $port = exists $ENV{'port'} ? $ENV{'port'} : 9200;

my $ua = LWP::UserAgent->new;
$ua->timeout(10);
Expand All @@ -50,13 +51,14 @@ sub get_json_from_url {
return $data;
}

my $data = get_json_from_url("http://$host:9200/_cluster/nodes?jvm=true");
my %out;
my $data = get_json_from_url("http://$host:$port/_cluster/nodes?jvm=true");
my %out = (direct_max => 0, heap_init =>0, heap_max => 0, non_heap_init => 0, non_heap_max => 0);

foreach my $full_node_name (keys %{$data->{nodes}}) {
next unless $data->{nodes}{$full_node_name};
foreach my $name (grep { /_in_bytes$/ } keys %{ $data->{nodes}{$full_node_name}{jvm}{mem} }) {
my ($dname) = $name =~ m/(.+)_in_bytes$/;
$out{$dname} = $data->{nodes}{$full_node_name}{jvm}{mem}{$name};
$out{$dname} += $data->{nodes}{$full_node_name}{jvm}{mem}{$name};
}
}
if ($ARGV[0] and $ARGV[0] eq 'config') {
Expand Down
11 changes: 6 additions & 5 deletions elasticsearch_jvm_threads
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ Tomas Doran (t0m) - c<< <bobtfish@bobtfish.net> >>

=cut

my $host = 'localhost';
my $host = exists $ENV{'host'} ? $ENV{'host'} : 'localhost';
my $port = exists $ENV{'port'} ? $ENV{'port'} : 9200;

my $ua = LWP::UserAgent->new;
$ua->timeout(10);
Expand All @@ -50,14 +51,14 @@ sub get_json_from_url {
return $data;
}

my $data = get_json_from_url("http://$host:9200/_cluster/nodes?jvm=true");
my $t_data = get_json_from_url("http://$host:9200/_cluster/nodes/stats?jvm=true");
my %out;
my $data = get_json_from_url("http://$host:$port/_cluster/nodes?jvm=true");
my $t_data = get_json_from_url("http://$host:$port/_cluster/nodes/stats?jvm=true");
my %out = (count => 0, peak_count => 0);

foreach my $full_node_name (keys %{$data->{nodes}}) {
next unless $t_data->{nodes}{$full_node_name};
foreach my $name (keys %{ $t_data->{nodes}{$full_node_name}{jvm}{threads} }) {
$out{$name} = $t_data->{nodes}{$full_node_name}{jvm}{threads}{$name};
$out{$name} += $t_data->{nodes}{$full_node_name}{jvm}{threads}{$name};
}
}
if ($ARGV[0] and $ARGV[0] eq 'config') {
Expand Down