line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id$ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# client::elasticsearch::cat Brik |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
package Metabrik::Client::Elasticsearch::Cat; |
7
|
1
|
|
|
1
|
|
709
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
8
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# |
11
|
|
|
|
|
|
|
# DOC: Search::Elasticsearch::Client::6_0::Direct::Cat |
12
|
|
|
|
|
|
|
# |
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
5
|
use base qw(Metabrik::Client::Elasticsearch); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
994
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub brik_properties { |
17
|
|
|
|
|
|
|
return { |
18
|
0
|
|
|
0
|
1
|
|
revision => '$Revision$', |
19
|
|
|
|
|
|
|
tags => [ qw(unstable) ], |
20
|
|
|
|
|
|
|
author => 'GomoR ', |
21
|
|
|
|
|
|
|
license => 'http://opensource.org/licenses/BSD-3-Clause', |
22
|
|
|
|
|
|
|
attributes => { |
23
|
|
|
|
|
|
|
}, |
24
|
|
|
|
|
|
|
attributes_default => { |
25
|
|
|
|
|
|
|
}, |
26
|
|
|
|
|
|
|
commands => { |
27
|
|
|
|
|
|
|
show_nodes => [ ], |
28
|
|
|
|
|
|
|
show_tasks => [ ], |
29
|
|
|
|
|
|
|
show_shards => [ qw(indices|OPTIONAL) ], |
30
|
|
|
|
|
|
|
show_recovery => [ qw(indices|OPTIONAL) ], |
31
|
|
|
|
|
|
|
show_allocation => [ ], |
32
|
|
|
|
|
|
|
loop_show_allocation => [ qw(interval|OPTIONAL) ], |
33
|
|
|
|
|
|
|
show_health => [ ], |
34
|
|
|
|
|
|
|
loop_show_health => [ qw(interval|OPTIONAL) ], |
35
|
|
|
|
|
|
|
pending_tasks => [ ], |
36
|
|
|
|
|
|
|
}, |
37
|
|
|
|
|
|
|
}; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub brik_init { |
41
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
42
|
|
|
|
|
|
|
|
43
|
0
|
0
|
|
|
|
|
$self->open or return 0; |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
return $self->SUPER::brik_init; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub show_nodes { |
49
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
my $r = $self->_es->cat->nodes; |
52
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
return [ split(/\n/, $r) ]; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub show_tasks { |
57
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
my $r = $self->_es->cat->tasks; |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
return [ split(/\n/, $r) ]; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub show_shards { |
65
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
66
|
0
|
|
|
|
|
|
my ($indices) = @_; |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
my %args = (); |
69
|
0
|
0
|
|
|
|
|
if (defined($indices)) { |
70
|
0
|
|
|
|
|
|
$args{index} = $indices; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
my $r = $self->_es->cat->shards(%args); |
74
|
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
return [ split(/\n/, $r) ]; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub show_recovery { |
79
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
80
|
0
|
|
|
|
|
|
my ($indices) = @_; |
81
|
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
my %args = (); |
83
|
0
|
0
|
|
|
|
|
if (defined($indices)) { |
84
|
0
|
|
|
|
|
|
$args{index} = $indices; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
|
my $r = $self->_es->cat->recovery(%args); |
88
|
|
|
|
|
|
|
|
89
|
0
|
|
|
|
|
|
return [ split(/\n/, $r) ]; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub show_allocation { |
93
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
94
|
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
|
my %args = (); |
96
|
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
my $r = $self->_es->cat->allocation(%args); |
98
|
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
|
return [ split(/\n/, $r) ]; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub loop_show_allocation { |
103
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
104
|
0
|
|
|
|
|
|
my ($interval) = @_; |
105
|
|
|
|
|
|
|
|
106
|
0
|
|
0
|
|
|
|
$interval ||= 60; |
107
|
|
|
|
|
|
|
|
108
|
0
|
|
|
|
|
|
while (1) { |
109
|
0
|
|
|
|
|
|
my %lines = (); |
110
|
0
|
|
|
|
|
|
for my $line (@{$self->show_allocation}) { |
|
0
|
|
|
|
|
|
|
111
|
0
|
|
|
|
|
|
my @t = split(/\s+/, $line); |
112
|
0
|
|
|
|
|
|
$lines{$t[-1]} = $line; |
113
|
|
|
|
|
|
|
} |
114
|
0
|
|
|
|
|
|
for (sort { $a cmp $b } keys %lines) { |
|
0
|
|
|
|
|
|
|
115
|
0
|
|
|
|
|
|
print $lines{$_}."\n"; |
116
|
|
|
|
|
|
|
} |
117
|
0
|
|
|
|
|
|
print "--\n"; |
118
|
0
|
|
|
|
|
|
sleep($interval); |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
0
|
|
|
|
|
|
return 1; |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub show_health { |
125
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
126
|
|
|
|
|
|
|
|
127
|
0
|
|
|
|
|
|
my %args = (); |
128
|
|
|
|
|
|
|
|
129
|
0
|
|
|
|
|
|
my $r = $self->_es->cat->health(%args); |
130
|
|
|
|
|
|
|
|
131
|
0
|
|
|
|
|
|
return [ split(/\n/, $r) ]; |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
sub loop_show_health { |
135
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
136
|
0
|
|
|
|
|
|
my ($interval) = @_; |
137
|
|
|
|
|
|
|
|
138
|
0
|
|
0
|
|
|
|
$interval ||= 60; |
139
|
|
|
|
|
|
|
|
140
|
0
|
|
|
|
|
|
while (1) { |
141
|
0
|
|
|
|
|
|
my $lines = $self->show_health; |
142
|
0
|
|
|
|
|
|
for my $line (@$lines) { |
143
|
0
|
|
|
|
|
|
print "$line\n"; |
144
|
|
|
|
|
|
|
} |
145
|
0
|
|
|
|
|
|
sleep($interval); |
146
|
|
|
|
|
|
|
} |
147
|
|
|
|
|
|
|
|
148
|
0
|
|
|
|
|
|
return 1; |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
sub pending_tasks { |
152
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
153
|
|
|
|
|
|
|
|
154
|
0
|
|
|
|
|
|
return $self->_es->cat->pending_tasks; |
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
1; |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
__END__ |