mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-29 16:45:04 +02:00
add aws ec2 ebs metrics (#2489)
This commit is contained in:
parent
d5019bff5f
commit
7ab3665059
@ -26,47 +26,83 @@ use strict;
|
|||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
my %metrics_mapping = (
|
my %metrics_mapping = (
|
||||||
'DiskReadBytes' => {
|
DiskReadBytes => {
|
||||||
'output' => 'Disk Read Bytes',
|
output => 'Disk Read Bytes',
|
||||||
'label' => 'disk-bytes-read',
|
label => 'disk-bytes-read',
|
||||||
'nlabel' => {
|
nlabel => {
|
||||||
'absolute' => 'ec2.disk.bytes.read.bytes',
|
absolute => 'ec2.disk.bytes.read.bytes',
|
||||||
'per_second' => 'ec2.disk.bytes.read.bytespersecond',
|
per_second => 'ec2.disk.bytes.read.bytespersecond'
|
||||||
},
|
},
|
||||||
'unit' => 'B',
|
unit => 'B'
|
||||||
},
|
},
|
||||||
'DiskWriteBytes' => {
|
DiskWriteBytes => {
|
||||||
'output' => 'Disk Write Bytes',
|
output => 'Disk Write Bytes',
|
||||||
'label' => 'disk-bytes-write',
|
label => 'disk-bytes-write',
|
||||||
'nlabel' => {
|
nlabel => {
|
||||||
'absolute' => 'ec2.disk.bytes.write.bytes',
|
absolute => 'ec2.disk.bytes.write.bytes',
|
||||||
'per_second' => 'ec2.disk.bytes.write.bytespersecond',
|
per_second => 'ec2.disk.bytes.write.bytespersecond'
|
||||||
},
|
},
|
||||||
'unit' => 'B',
|
unit => 'B'
|
||||||
},
|
},
|
||||||
'DiskReadOps' => {
|
DiskReadOps => {
|
||||||
'output' => 'Disk Read Ops',
|
output => 'Disk Read Ops',
|
||||||
'label' => 'disk-ops-read',
|
label => 'disk-ops-read',
|
||||||
'nlabel' => {
|
nlabel => {
|
||||||
'absolute' => 'ec2.disk.ops.read.count',
|
absolute => 'ec2.disk.ops.read.count',
|
||||||
'per_second' => 'ec2.disk.ops.read.persecond',
|
per_second => 'ec2.disk.ops.read.persecond'
|
||||||
},
|
},
|
||||||
'unit' => 'ops',
|
unit => 'ops'
|
||||||
},
|
},
|
||||||
'DiskWriteOps' => {
|
DiskWriteOps => {
|
||||||
'output' => 'Disk Write Ops',
|
output => 'Disk Write Ops',
|
||||||
'label' => 'disk-ops-write',
|
label => 'disk-ops-write',
|
||||||
'nlabel' => {
|
nlabel => {
|
||||||
'absolute' => 'ec2.disk.ops.write.count',
|
absolute => 'ec2.disk.ops.write.count',
|
||||||
'per_second' => 'ec2.disk.ops.write.persecond',
|
per_second => 'ec2.disk.ops.write.persecond'
|
||||||
},
|
},
|
||||||
'unit' => 'ops',
|
unit => 'ops'
|
||||||
},
|
},
|
||||||
|
EBSReadBytes => {
|
||||||
|
output => 'EBS Read Bytes',
|
||||||
|
label => 'ebs-bytes-read',
|
||||||
|
nlabel => {
|
||||||
|
absolute => 'ec2.disk.bytes.read.bytes',
|
||||||
|
per_second => 'ec2.disk.bytes.read.bytespersecond'
|
||||||
|
},
|
||||||
|
unit => 'B'
|
||||||
|
},
|
||||||
|
EBSWriteBytes => {
|
||||||
|
output => 'EBS Write Bytes',
|
||||||
|
label => 'ebs-bytes-write',
|
||||||
|
nlabel => {
|
||||||
|
absolute => 'ec2.ebs.bytes.write.bytes',
|
||||||
|
per_second => 'ec2.ebs.bytes.write.bytespersecond'
|
||||||
|
},
|
||||||
|
unit => 'B'
|
||||||
|
},
|
||||||
|
EBSReadOps => {
|
||||||
|
output => 'EBS Read Ops',
|
||||||
|
label => 'ebs-ops-read',
|
||||||
|
nlabel => {
|
||||||
|
absolute => 'ec2.ebs.ops.read.count',
|
||||||
|
per_second => 'ec2.ebs.ops.read.persecond'
|
||||||
|
},
|
||||||
|
unit => 'ops'
|
||||||
|
},
|
||||||
|
EBSWriteOps => {
|
||||||
|
output => 'EBC Write Ops',
|
||||||
|
label => 'ebs-ops-write',
|
||||||
|
nlabel => {
|
||||||
|
absolute => 'ec2.ebs.ops.write.count',
|
||||||
|
per_second => 'ec2.ebs.ops.write.persecond'
|
||||||
|
},
|
||||||
|
unit => 'ops'
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
my %map_type = (
|
my %map_type = (
|
||||||
"instance" => "InstanceId",
|
instance => "InstanceId",
|
||||||
"asg" => "AutoScalingGroupName",
|
asg => "AutoScalingGroupName"
|
||||||
);
|
);
|
||||||
|
|
||||||
sub prefix_metric_output {
|
sub prefix_metric_output {
|
||||||
@ -102,8 +138,11 @@ 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 => 'warning-' . $metrics_mapping{$self->{result_values}->{metric}}->{label}, exit_litteral => 'warning' } ]);
|
{ label => 'critical-' . $metrics_mapping{$self->{result_values}->{metric}}->{label}, exit_litteral => 'critical' },
|
||||||
|
{ label => 'warning-' . $metrics_mapping{$self->{result_values}->{metric}}->{label}, exit_litteral => 'warning' }
|
||||||
|
]
|
||||||
|
);
|
||||||
return $exit;
|
return $exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,7 +192,7 @@ sub set_counters {
|
|||||||
message_multiple => 'All disks metrics are ok', indent_long_output => ' ',
|
message_multiple => 'All disks metrics are ok', indent_long_output => ' ',
|
||||||
group => [
|
group => [
|
||||||
{ name => 'statistics', display_long => 1, cb_prefix_output => 'prefix_statistics_output',
|
{ name => 'statistics', display_long => 1, cb_prefix_output => 'prefix_statistics_output',
|
||||||
message_multiple => 'All metrics are ok', type => 1, skipped_code => { -10 => 1 } },
|
message_multiple => 'All metrics are ok', type => 1, skipped_code => { -10 => 1 } }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
@ -167,7 +206,7 @@ sub set_counters {
|
|||||||
closure_custom_calc_extra_options => { metric => $metric },
|
closure_custom_calc_extra_options => { metric => $metric },
|
||||||
closure_custom_output => $self->can('custom_metric_output'),
|
closure_custom_output => $self->can('custom_metric_output'),
|
||||||
closure_custom_perfdata => $self->can('custom_metric_perfdata'),
|
closure_custom_perfdata => $self->can('custom_metric_perfdata'),
|
||||||
closure_custom_threshold_check => $self->can('custom_metric_threshold'),
|
closure_custom_threshold_check => $self->can('custom_metric_threshold')
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
push @{$self->{maps_counters}->{statistics}}, $entry;
|
push @{$self->{maps_counters}->{statistics}}, $entry;
|
||||||
@ -180,10 +219,11 @@ sub new {
|
|||||||
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' },
|
||||||
"filter-metric:s" => { name => 'filter_metric' },
|
'filter-metric:s' => { name => 'filter_metric' },
|
||||||
"per-sec" => { name => 'per_sec' },
|
'per-sec' => { name => 'per_sec' },
|
||||||
|
'add-ebs-metrics' => { name => 'add_ebs_metrics' }
|
||||||
});
|
});
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
@ -228,6 +268,7 @@ sub check_options {
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach my $metric (keys %metrics_mapping) {
|
foreach my $metric (keys %metrics_mapping) {
|
||||||
|
next if (!defined($self->{option_results}->{add_ebs_metrics}) && $metric =~ /EBS/);
|
||||||
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}/);
|
||||||
|
|
||||||
@ -297,6 +338,10 @@ Set the instance type (Required) (Can be: 'asg', 'instance').
|
|||||||
|
|
||||||
Set the instance name (Required) (Can be multiple).
|
Set the instance name (Required) (Can be multiple).
|
||||||
|
|
||||||
|
=item B<--add-ebs-metrics>
|
||||||
|
|
||||||
|
Add EBS metrics ('EBSReadOps', 'EBSWriteOps', 'EBSReadBytes', 'EBSWriteBytes').
|
||||||
|
|
||||||
=item B<--filter-metric>
|
=item B<--filter-metric>
|
||||||
|
|
||||||
Filter metrics (Can be: 'DiskReadBytes', 'DiskWriteBytes',
|
Filter metrics (Can be: 'DiskReadBytes', 'DiskWriteBytes',
|
||||||
@ -305,8 +350,8 @@ Filter metrics (Can be: 'DiskReadBytes', 'DiskWriteBytes',
|
|||||||
|
|
||||||
=item B<--warning-*> B<--critical-*>
|
=item B<--warning-*> B<--critical-*>
|
||||||
|
|
||||||
Thresholds warning (Can be 'disk-bytes-read', 'disk-bytes-write',
|
Thresholds (Can be 'disk-bytes-read', 'disk-bytes-write', 'disk-ops-read', 'disk-ops-write',
|
||||||
'disk-ops-read', 'disk-ops-write').
|
'ebs-bytes-read', 'ebs-bytes-write', 'ebs-ops-read', 'ebs-ops-write').
|
||||||
|
|
||||||
=item B<--per-sec>
|
=item B<--per-sec>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user