improve redis restapi
This commit is contained in:
parent
849d950696
commit
da72ccdd8e
|
@ -42,6 +42,7 @@ sub new {
|
|||
if (!defined($options{noptions})) {
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"interval:s@" => { name => 'interval' },
|
||||
"hostname:s@" => { name => 'hostname' },
|
||||
"port:s@" => { name => 'port' },
|
||||
"proto:s@" => { name => 'proto' },
|
||||
|
@ -95,6 +96,7 @@ sub check_options {
|
|||
$self->{timeout} = (defined($self->{option_results}->{timeout})) ? shift(@{$self->{option_results}->{timeout}}) : 10;
|
||||
$self->{proxyurl} = (defined($self->{option_results}->{proxyurl})) ? shift(@{$self->{option_results}->{proxyurl}}) : undef;
|
||||
$self->{ssl} = (defined($self->{option_results}->{ssl})) ? shift(@{$self->{option_results}->{ssl}}) : 'tlsv1';
|
||||
$self->{interval} = (defined($self->{option_results}->{interval})) ? shift(@{$self->{option_results}->{interval}}) : '15min';
|
||||
|
||||
if (!defined($self->{hostname})) {
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify hostname option.");
|
||||
|
@ -105,6 +107,7 @@ sub check_options {
|
|||
scalar(@{$self->{option_results}->{hostname}}) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -137,6 +140,12 @@ sub get_connection_info {
|
|||
return $self->{hostname} . ":" . $self->{port};
|
||||
}
|
||||
|
||||
sub get_interval {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return $self->{interval};
|
||||
}
|
||||
|
||||
sub get {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
|
@ -189,6 +198,12 @@ RedisLabs Enterprise Cluster Rest API custom mode
|
|||
|
||||
=over 8
|
||||
|
||||
=item B<--interval>
|
||||
|
||||
Time interval from which to retrieve statistics (Default: '15min').
|
||||
Can be : '1sec', '10sec', '5min', '15min',
|
||||
'1hour', '12hour', '1week'.
|
||||
|
||||
=item B<--hostname>
|
||||
|
||||
Cluster hostname.
|
||||
|
@ -217,6 +232,10 @@ Proxy URL if any
|
|||
|
||||
Set HTTP timeout
|
||||
|
||||
=item B<--ssl>
|
||||
|
||||
SSL version (Default: tlsv1)
|
||||
|
||||
=back
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
|
|
@ -226,7 +226,6 @@ sub new {
|
|||
$self->{version} = '1.0';
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"interval:s" => { name => 'interval', default => '15min' },
|
||||
"units:s" => { name => 'units', default => '%' },
|
||||
"free" => { name => 'free' },
|
||||
});
|
||||
|
@ -244,7 +243,7 @@ sub check_options {
|
|||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $result = $options{custom}->get(path => '/v1/cluster/stats/last?interval='.$instance_mode->{option_results}->{interval});
|
||||
my $result = $options{custom}->get(path => '/v1/cluster/stats/last?interval='.$options{custom}->get_interval());
|
||||
my $result2 = $options{custom}->get(path => '/v1/cluster');
|
||||
my $result3 = $options{custom}->get(path => '/v1/nodes');
|
||||
|
||||
|
@ -304,12 +303,6 @@ Check RedisLabs Enterprise Cluster statistics.
|
|||
Only display some counters (regexp can be used).
|
||||
Example: --filter-counters='^cpu'
|
||||
|
||||
=item B<--interval>
|
||||
|
||||
Time interval from which to retrieve statistics (Default: '15min').
|
||||
Can be : '1sec', '10sec', '5min', '15min',
|
||||
'1hour', '12hour', '1week'
|
||||
|
||||
=item B<--units>
|
||||
|
||||
Units of thresholds (Default: '%') ('%', 'B').
|
||||
|
|
|
@ -441,7 +441,6 @@ sub new {
|
|||
$self->{version} = '1.0';
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"interval:s" => { name => 'interval', default => '15min' },
|
||||
"filter-database:s" => { name => 'filter_database' },
|
||||
"units:s" => { name => 'units', default => '%' },
|
||||
"free" => { name => 'free' },
|
||||
|
@ -474,7 +473,7 @@ sub change_macros {
|
|||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $result = $options{custom}->get(path => '/v1/bdbs/stats/last?interval='.$instance_mode->{option_results}->{interval});
|
||||
my $result = $options{custom}->get(path => '/v1/bdbs/stats/last?interval='.$options{custom}->get_interval());
|
||||
my $result2 = $options{custom}->get(path => '/v1/bdbs');
|
||||
|
||||
foreach my $database (keys $result) {
|
||||
|
@ -556,12 +555,6 @@ Check RedisLabs Enterprise Cluster databases statistics.
|
|||
Only display some counters (regexp can be used).
|
||||
Example: --filter-counters='rate|latency'
|
||||
|
||||
=item B<--interval>
|
||||
|
||||
Time interval from which to retrieve statistics (Default: '15min').
|
||||
Can be : '1sec', '10sec', '5min', '15min',
|
||||
'1hour', '12hour', '1week'
|
||||
|
||||
=item B<--warning-status>
|
||||
|
||||
Set warning threshold for status.
|
||||
|
|
|
@ -299,12 +299,11 @@ sub new {
|
|||
$self->{version} = '1.0';
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"interval:s" => { name => 'interval', default => '15min' },
|
||||
"filter-node:s" => { name => 'filter_node' },
|
||||
"units:s" => { name => 'units', default => '%' },
|
||||
"free" => { name => 'free' },
|
||||
"warning-status:s" => { name => 'warning_status', default => '' },
|
||||
"critical-status:s" => { name => 'critical_status', default => '%{status} !~ /down/i' },
|
||||
"critical-status:s" => { name => 'critical_status', default => '%{status} =~ /down/i' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
|
@ -331,7 +330,7 @@ sub change_macros {
|
|||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $result = $options{custom}->get(path => '/v1/nodes/stats/last?interval='.$instance_mode->{option_results}->{interval});
|
||||
my $result = $options{custom}->get(path => '/v1/nodes/stats/last?interval='.$options{custom}->get_interval());
|
||||
my $result2 = $options{custom}->get(path => '/v1/nodes');
|
||||
|
||||
foreach my $node (keys $result) {
|
||||
|
@ -399,12 +398,6 @@ Check RedisLabs Enterprise Cluster nodes statistics.
|
|||
Only display some counters (regexp can be used).
|
||||
Example: --filter-counters='^cpu'
|
||||
|
||||
=item B<--interval>
|
||||
|
||||
Time interval from which to retrieve statistics (Default: '15min').
|
||||
Can be : '1sec', '10sec', '5min', '15min',
|
||||
'1hour', '12hour', '1week'
|
||||
|
||||
=item B<--units>
|
||||
|
||||
Units of thresholds (Default: '%') ('%', 'B').
|
||||
|
@ -423,7 +416,7 @@ Can used special variables like: %{status}, %{shard_list},
|
|||
|
||||
=item B<--critical-status>
|
||||
|
||||
Set critical threshold for status (Default: '%{status} !~ /down/i').
|
||||
Set critical threshold for status (Default: '%{status} =~ /down/i').
|
||||
Can used special variables like: %{status}, %{shard_list},
|
||||
%{int_addr}, %{ext_addr}.
|
||||
'status' can be: 'active', 'going_offline', 'offline',
|
||||
|
|
|
@ -324,7 +324,6 @@ sub new {
|
|||
$self->{version} = '1.0';
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"interval:s" => { name => 'interval', default => '15min' },
|
||||
"filter-shard:s" => { name => 'filter_shard' },
|
||||
"warning-status:s" => { name => 'warning_status', default => '' },
|
||||
"critical-status:s" => { name => 'critical_status', default => '%{status} =~ /inactive/i | %{backup} =~ /failed/i |
|
||||
|
@ -355,7 +354,7 @@ sub change_macros {
|
|||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $result = $options{custom}->get(path => '/v1/shards/stats/last?interval='.$instance_mode->{option_results}->{interval});
|
||||
my $result = $options{custom}->get(path => '/v1/shards/stats/last?interval='.$options{custom}->get_interval());
|
||||
my $result2 = $options{custom}->get(path => '/v1/shards');
|
||||
|
||||
foreach my $shard (keys $result) {
|
||||
|
@ -419,12 +418,6 @@ Check RedisLabs Enterprise Cluster shards statistics.
|
|||
Only display some counters (regexp can be used).
|
||||
Example: --filter-counters='clients'
|
||||
|
||||
=item B<--interval>
|
||||
|
||||
Time interval from which to retrieve statistics (Default: '15min').
|
||||
Can be : '1sec', '10sec', '5min', '15min',
|
||||
'1hour', '12hour', '1week'
|
||||
|
||||
=item B<--warning-status>
|
||||
|
||||
Set warning threshold for status.
|
||||
|
|
Loading…
Reference in New Issue