fix efs path
This commit is contained in:
parent
076c320652
commit
4d16c55602
|
@ -97,7 +97,7 @@ sub long_output {
|
||||||
|
|
||||||
sub set_counters {
|
sub set_counters {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
$self->{maps_counters_type} = [
|
$self->{maps_counters_type} = [
|
||||||
{ name => 'metrics', type => 3, cb_prefix_output => 'prefix_metric_output', cb_long_output => 'long_output',
|
{ name => 'metrics', type => 3, cb_prefix_output => 'prefix_metric_output', cb_long_output => 'long_output',
|
||||||
message_multiple => 'All FS metrics are ok', indent_long_output => ' ',
|
message_multiple => 'All FS metrics are ok', indent_long_output => ' ',
|
||||||
|
@ -128,10 +128,11 @@ sub new {
|
||||||
my ($class, %options) = @_;
|
my ($class, %options) = @_;
|
||||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
$options{options}->add_options(arguments => {
|
$options{options}->add_options(arguments => {
|
||||||
"name:s@" => { name => 'name' },
|
'name:s@' => { name => 'name' },
|
||||||
});
|
});
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,7 +154,7 @@ sub check_options {
|
||||||
$self->{aws_timeframe} = defined($self->{option_results}->{timeframe}) ? $self->{option_results}->{timeframe} : 172800;
|
$self->{aws_timeframe} = defined($self->{option_results}->{timeframe}) ? $self->{option_results}->{timeframe} : 172800;
|
||||||
$self->{aws_period} = defined($self->{option_results}->{period}) ? $self->{option_results}->{period} : 86400;
|
$self->{aws_period} = defined($self->{option_results}->{period}) ? $self->{option_results}->{period} : 86400;
|
||||||
$self->{aws_statistics} = ['Sum'];
|
$self->{aws_statistics} = ['Sum'];
|
||||||
|
|
||||||
foreach my $metric (keys %metrics_mapping) {
|
foreach my $metric (keys %metrics_mapping) {
|
||||||
next if (defined($self->{option_results}->{filter_metric}) && $self->{option_results}->{filter_metric} ne ''
|
next if (defined($self->{option_results}->{filter_metric}) && $self->{option_results}->{filter_metric} ne ''
|
||||||
&& $metric !~ /$self->{option_results}->{filter_metric}/);
|
&& $metric !~ /$self->{option_results}->{filter_metric}/);
|
||||||
|
@ -175,7 +176,7 @@ sub manage_selection {
|
||||||
timeframe => $self->{aws_timeframe},
|
timeframe => $self->{aws_timeframe},
|
||||||
period => $self->{aws_period},
|
period => $self->{aws_period},
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach my $metric (@{$self->{aws_metrics}}) {
|
foreach my $metric (@{$self->{aws_metrics}}) {
|
||||||
foreach my $statistic (@{$self->{aws_statistics}}) {
|
foreach my $statistic (@{$self->{aws_statistics}}) {
|
||||||
next if (!defined($metric_results{$instance}->{$metric}->{lc($statistic)}) &&
|
next if (!defined($metric_results{$instance}->{$metric}->{lc($statistic)}) &&
|
|
@ -76,7 +76,7 @@ my %metrics_mapping = (
|
||||||
|
|
||||||
sub custom_metric_calc {
|
sub custom_metric_calc {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
$self->{result_values}->{timeframe} = $options{new_datas}->{$self->{instance} . '_timeframe'};
|
$self->{result_values}->{timeframe} = $options{new_datas}->{$self->{instance} . '_timeframe'};
|
||||||
$self->{result_values}->{value} = $options{new_datas}->{$self->{instance} . '_' . $options{extra_options}->{metric}};
|
$self->{result_values}->{value} = $options{new_datas}->{$self->{instance} . '_' . $options{extra_options}->{metric}};
|
||||||
$self->{result_values}->{value_per_sec} = $self->{result_values}->{value} / $self->{result_values}->{timeframe};
|
$self->{result_values}->{value_per_sec} = $self->{result_values}->{value} / $self->{result_values}->{timeframe};
|
||||||
|
@ -90,7 +90,8 @@ sub custom_metric_threshold {
|
||||||
my $exit = $self->{perfdata}->threshold_check(
|
my $exit = $self->{perfdata}->threshold_check(
|
||||||
value => defined($self->{instance_mode}->{option_results}->{per_sec}) ? $self->{result_values}->{value_per_sec} : $self->{result_values}->{value},
|
value => defined($self->{instance_mode}->{option_results}->{per_sec}) ? $self->{result_values}->{value_per_sec} : $self->{result_values}->{value},
|
||||||
threshold => [ { label => 'critical-' . $metrics_mapping{$self->{result_values}->{metric}}->{label}, exit_litteral => 'critical' },
|
threshold => [ { label => 'critical-' . $metrics_mapping{$self->{result_values}->{metric}}->{label}, exit_litteral => 'critical' },
|
||||||
{ label => 'warning-' . $metrics_mapping{$self->{result_values}->{metric}}->{label}, exit_litteral => 'warning' } ]);
|
{ label => 'warning-' . $metrics_mapping{$self->{result_values}->{metric}}->{label}, exit_litteral => 'warning' } ]
|
||||||
|
);
|
||||||
return $exit;
|
return $exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,13 +135,13 @@ sub custom_metric_output {
|
||||||
|
|
||||||
sub prefix_metric_output {
|
sub prefix_metric_output {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
return "'" . $options{instance_value}->{display} . "' ";
|
return "'" . $options{instance_value}->{display} . "' ";
|
||||||
}
|
}
|
||||||
|
|
||||||
sub prefix_statistics_output {
|
sub prefix_statistics_output {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
return "Statistic '" . $options{instance_value}->{display} . "' Metrics ";
|
return "Statistic '" . $options{instance_value}->{display} . "' Metrics ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,7 +153,7 @@ sub long_output {
|
||||||
|
|
||||||
sub set_counters {
|
sub set_counters {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
$self->{maps_counters_type} = [
|
$self->{maps_counters_type} = [
|
||||||
{ name => 'metrics', type => 3, cb_prefix_output => 'prefix_metric_output', cb_long_output => 'long_output',
|
{ name => 'metrics', type => 3, cb_prefix_output => 'prefix_metric_output', cb_long_output => 'long_output',
|
||||||
message_multiple => 'All FS metrics are ok', indent_long_output => ' ',
|
message_multiple => 'All FS metrics are ok', indent_long_output => ' ',
|
||||||
|
@ -183,12 +184,12 @@ sub new {
|
||||||
my ($class, %options) = @_;
|
my ($class, %options) = @_;
|
||||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
$options{options}->add_options(arguments => {
|
$options{options}->add_options(arguments => {
|
||||||
"type:s" => { name => 'type' },
|
'type:s' => { name => 'type' },
|
||||||
"name:s@" => { name => 'name' },
|
'name:s@' => { name => 'name' },
|
||||||
"per-sec" => { name => 'per_sec' },
|
'per-sec' => { name => 'per_sec' },
|
||||||
"filter-metric:s" => { name => 'filter_metric' },
|
'filter-metric:s' => { name => 'filter_metric' },
|
||||||
});
|
});
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
|
@ -211,7 +212,7 @@ sub check_options {
|
||||||
|
|
||||||
$self->{aws_timeframe} = defined($self->{option_results}->{timeframe}) ? $self->{option_results}->{timeframe} : 600;
|
$self->{aws_timeframe} = defined($self->{option_results}->{timeframe}) ? $self->{option_results}->{timeframe} : 600;
|
||||||
$self->{aws_period} = defined($self->{option_results}->{period}) ? $self->{option_results}->{period} : 60;
|
$self->{aws_period} = defined($self->{option_results}->{period}) ? $self->{option_results}->{period} : 60;
|
||||||
|
|
||||||
$self->{aws_statistics} = ['Average'];
|
$self->{aws_statistics} = ['Average'];
|
||||||
if (defined($self->{option_results}->{statistic})) {
|
if (defined($self->{option_results}->{statistic})) {
|
||||||
$self->{aws_statistics} = [];
|
$self->{aws_statistics} = [];
|
|
@ -30,11 +30,11 @@ sub new {
|
||||||
my ($class, %options) = @_;
|
my ($class, %options) = @_;
|
||||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
$options{options}->add_options(arguments => {
|
$options{options}->add_options(arguments => {
|
||||||
"prettify" => { name => 'prettify' },
|
'prettify' => { name => 'prettify' }
|
||||||
});
|
});
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ sub run {
|
||||||
if ($@) {
|
if ($@) {
|
||||||
$encoded_data = '{"code":"encode_error","message":"Cannot encode discovered data into JSON format"}';
|
$encoded_data = '{"code":"encode_error","message":"Cannot encode discovered data into JSON format"}';
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->{output}->output_add(short_msg => $encoded_data);
|
$self->{output}->output_add(short_msg => $encoded_data);
|
||||||
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1);
|
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1);
|
||||||
$self->{output}->exit();
|
$self->{output}->exit();
|
|
@ -31,9 +31,9 @@ sub new {
|
||||||
|
|
||||||
$self->{version} = '1.0';
|
$self->{version} = '1.0';
|
||||||
%{ $self->{modes} } = (
|
%{ $self->{modes} } = (
|
||||||
'connections' => 'cloud::aws::efs::mode::connections',
|
'connections' => 'cloud::aws::efs::mode::connections',
|
||||||
'datausage' => 'cloud::aws::efs::mode::datausage',
|
'datausage' => 'cloud::aws::efs::mode::datausage',
|
||||||
'discovery' => 'cloud::aws::efs::mode::discovery'
|
'discovery' => 'cloud::aws::efs::mode::discovery'
|
||||||
);
|
);
|
||||||
|
|
||||||
$self->{custom_modes}{paws} = 'cloud::aws::custom::paws';
|
$self->{custom_modes}{paws} = 'cloud::aws::custom::paws';
|
|
@ -235,7 +235,7 @@ sub filter_networks {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scalar(@$network_ids) > 5) {
|
if (scalar(@$network_ids) > 5) {
|
||||||
$self->{output}->add_option_msg(short_msg => 'cannot check than 5 networks at once');
|
$self->{output}->add_option_msg(short_msg => 'cannot check than 5 networks at once (api rate limit)');
|
||||||
$self->{output}->option_exit();
|
$self->{output}->option_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue