azure plugin fixes, paths break change (#1154)
* add proxyurl option, update cli installation process * fix label and perfdata names * fix label and perfdata names * change paths to providers/services * fix vm list resources mode path
This commit is contained in:
parent
1298a3606a
commit
2cca01148c
|
@ -1,129 +0,0 @@
|
|||
#
|
||||
# Copyright 2018 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::compute::mode::listresources;
|
||||
|
||||
use base qw(centreon::plugins::mode);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '1.0';
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"resource-group:s" => { name => 'resource_group' },
|
||||
"resource-type:s" => { name => 'resource_type', default => 'virtualMachines' },
|
||||
"location:s" => { name => 'location' },
|
||||
"filter-name:s" => { name => 'filter_name' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::init(%options);
|
||||
}
|
||||
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{resources} = $options{custom}->azure_list_resources(
|
||||
namespace => 'Microsoft.Compute',
|
||||
resource_type => $self->{option_results}->{resource_type},
|
||||
location => $self->{option_results}->{location},
|
||||
resource_group => $self->{option_results}->{resource_group}
|
||||
);
|
||||
}
|
||||
|
||||
sub run {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->manage_selection(%options);
|
||||
foreach my $resource (@{$self->{resources}}) {
|
||||
next if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne ''
|
||||
&& $resource->{name} !~ /$self->{option_results}->{filter_name}/);
|
||||
$resource->{type} =~ s/Microsoft.Compute\///g;
|
||||
$self->{output}->output_add(long_msg => sprintf("[name = %s][resourcegroup = %s][location = %s][id = %s][type = %s]",
|
||||
$resource->{name}, $resource->{resourceGroup}, $resource->{location}, $resource->{id}, $resource->{type}));
|
||||
}
|
||||
|
||||
$self->{output}->output_add(severity => 'OK',
|
||||
short_msg => 'List resources:');
|
||||
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
|
||||
$self->{output}->exit();
|
||||
}
|
||||
|
||||
sub disco_format {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{output}->add_disco_format(elements => ['name', 'resourcegroup', 'location', 'id', 'type']);
|
||||
}
|
||||
|
||||
sub disco_show {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->manage_selection(%options);
|
||||
foreach my $resource (@{$self->{resources}}) {
|
||||
$resource->{type} =~ s/Microsoft.Compute\///g;
|
||||
$self->{output}->add_disco_entry(
|
||||
name => $resource->{name},
|
||||
resourcegroup => $resource->{resourceGroup},
|
||||
location => $resource->{location},
|
||||
id => $resource->{id},
|
||||
type => $resource->{type},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
List compute resources.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--resource-group>
|
||||
|
||||
Set resource group.
|
||||
|
||||
=item B<--resource-type>
|
||||
|
||||
Set resource type (Default: 'virtualMachines').
|
||||
|
||||
=item B<--location>
|
||||
|
||||
Set resource location.
|
||||
|
||||
=item B<--filter-name>
|
||||
|
||||
Filter resource name (Can be a regexp).
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -18,7 +18,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::compute::mode::cpu;
|
||||
package cloud::azure::compute::virtualmachine::mode::cpu;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
|
@ -86,7 +86,6 @@ sub new {
|
|||
{
|
||||
"resource:s@" => { name => 'resource' },
|
||||
"resource-group:s" => { name => 'resource_group' },
|
||||
"resource-type:s" => { name => 'resource_type' },
|
||||
"filter-metric:s" => { name => 'filter_metric' },
|
||||
});
|
||||
|
||||
|
@ -98,21 +97,21 @@ sub check_options {
|
|||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (!defined($self->{option_results}->{resource})) {
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group and --resource-type options or --resource <id>.");
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group option or --resource <id>.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
$self->{az_resource_group} = '';
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_type} = 'virtualMachines';
|
||||
$self->{az_resource_namespace} = 'Microsoft.Compute';
|
||||
|
||||
foreach my $resource (@{$self->{option_results}->{resource}}) {
|
||||
push @{$self->{az_resource}}, $resource;
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Compute\/.*\/.*$/) {
|
||||
$self->{az_resource_namespace} = '';
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Compute\/virtualMachines\/.*$/) {
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_namespace} = '';
|
||||
} else {
|
||||
$self->{az_resource_group} = $self->{option_results}->{resource_group};
|
||||
$self->{az_resource_type} = $self->{option_results}->{resource_type};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -143,7 +142,7 @@ sub manage_selection {
|
|||
my %metric_results;
|
||||
foreach my $resource (@{$self->{az_resource}}) {
|
||||
my $resource_name = $resource;
|
||||
$resource_name = $1 if ($resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Compute\/.*\/(.*)$/);
|
||||
$resource_name = $1 if ($resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Compute\/virtualMachines\/(.*)$/);
|
||||
|
||||
($metric_results{$resource_name}, undef, undef) = $options{custom}->azure_get_metrics(
|
||||
resource => $resource,
|
||||
|
@ -181,19 +180,19 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check compute resources CPU metrics.
|
||||
Check virtual machine resources CPU metrics.
|
||||
|
||||
Example:
|
||||
|
||||
Using resource name :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::compute::plugin --custommode=azcli --mode=cpu
|
||||
--resource=MYSQLINSTANCE --resource-group=MYHOSTGROUP --resource-type=virtualMachines
|
||||
--filter-metric='Credits' --aggregation='average' --critical-cpu-credits-remaining-average='10' --verbose
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::compute::virtualmachine::plugin --custommode=azcli --mode=cpu
|
||||
--resource=MYSQLINSTANCE --resource-group=MYHOSTGROUP --filter-metric='Credits' --aggregation='average'
|
||||
--critical-cpu-credits-remaining-average='10' --verbose
|
||||
|
||||
Using resource id :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::compute::plugin --custommode=azcli --mode=cpu
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::compute::virtualmachine::plugin --custommode=azcli --mode=cpu
|
||||
--resource='/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Compute/virtualMachines/xxx'
|
||||
--filter-metric='Credits' --aggregation='average' --critical-cpu-credits-remaining-average='10' --verbose
|
||||
|
||||
|
@ -209,10 +208,6 @@ Set resource name or id (Required).
|
|||
|
||||
Set resource group (Required if resource's name is used).
|
||||
|
||||
=item B<--resource-type>
|
||||
|
||||
Set resource type (Required if resource's name is used) (Can be: 'virtualMachines', 'xx').
|
||||
|
||||
=item B<--filter-metric>
|
||||
|
||||
Filter metrics (Can be: 'CPU Credits Remaining', 'CPU Credits Consumed',
|
|
@ -18,7 +18,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::compute::mode::diskio;
|
||||
package cloud::azure::compute::virtualmachine::mode::diskio;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
|
@ -44,8 +44,6 @@ sub custom_metric_calc {
|
|||
$self->{result_values}->{value} = $options{new_datas}->{$self->{instance} . '_' . $self->{result_values}->{metric_perf} . '_' . $self->{result_values}->{stat}};
|
||||
$self->{result_values}->{value_per_sec} = $self->{result_values}->{value} / $self->{result_values}->{timeframe};
|
||||
$self->{result_values}->{display} = $options{new_datas}->{$self->{instance} . '_display'};
|
||||
$self->{result_values}->{metric_perf} =~ s/\//_/g;
|
||||
$self->{result_values}->{metric_label} =~ s/\//-/g;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -140,7 +138,7 @@ sub set_counters {
|
|||
my $metric_perf = lc($metric);
|
||||
my $metric_label = lc($metric);
|
||||
$metric_perf =~ s/ /_/g;
|
||||
$metric_label =~ s/ /-/g;
|
||||
$metric_label =~ s/( |\/)/-/g;
|
||||
my $entry = { label => $metric_label . '-' . $aggregation, set => {
|
||||
key_values => [ { name => $metric_perf . '_' . $aggregation }, { name => 'display' },
|
||||
{ name => 'stat' }, { name => 'timeframe' } ],
|
||||
|
@ -167,7 +165,6 @@ sub new {
|
|||
{
|
||||
"resource:s@" => { name => 'resource' },
|
||||
"resource-group:s" => { name => 'resource_group' },
|
||||
"resource-type:s" => { name => 'resource_type' },
|
||||
"filter-metric:s" => { name => 'filter_metric' },
|
||||
"per-sec" => { name => 'per_sec' },
|
||||
});
|
||||
|
@ -180,21 +177,21 @@ sub check_options {
|
|||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (!defined($self->{option_results}->{resource})) {
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group and --resource-type options or --resource <id>.");
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group option or --resource <id>.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
$self->{az_resource_group} = '';
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_type} = 'virtualMachines';
|
||||
$self->{az_resource_namespace} = 'Microsoft.Compute';
|
||||
|
||||
foreach my $resource (@{$self->{option_results}->{resource}}) {
|
||||
push @{$self->{az_resource}}, $resource;
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Compute\/.*\/.*$/) {
|
||||
$self->{az_resource_namespace} = '';
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Compute\/virtualMachines\/.*$/) {
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_namespace} = '';
|
||||
} else {
|
||||
$self->{az_resource_group} = $self->{option_results}->{resource_group};
|
||||
$self->{az_resource_type} = $self->{option_results}->{resource_type};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -267,19 +264,19 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check compute resources disk IO metrics.
|
||||
Check virtual machine resources disk IO metrics.
|
||||
|
||||
Example:
|
||||
|
||||
Using resource name :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::compute::plugin --custommode=azcli --mode=diskio
|
||||
--resource=MYSQLINSTANCE --resource-group=MYHOSTGROUP --resource-type=virtualMachines
|
||||
--aggregation='total' --aggregation='average' --critical-disk-write-bytes-total='10' --verbose
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::compute::virtualmachine::plugin --custommode=azcli --mode=diskio
|
||||
--resource=MYSQLINSTANCE --resource-group=MYHOSTGROUP --aggregation='total' --aggregation='average'
|
||||
--critical-disk-write-bytes-total='10' --verbose
|
||||
|
||||
Using resource id :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::compute::plugin --custommode=azcli --mode=diskio
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::compute::virtualmachine::plugin --custommode=azcli --mode=diskio
|
||||
--resource='/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Compute/virtualMachines/xxx'
|
||||
--aggregation='total' --aggregation='average' --critical-disk-write-bytes-total='10' --verbose
|
||||
|
||||
|
@ -295,10 +292,6 @@ Set resource name or id (Required).
|
|||
|
||||
Set resource group (Required if resource's name is used).
|
||||
|
||||
=item B<--resource-type>
|
||||
|
||||
Set resource type (Required if resource's name is used) (Can be: 'virtualMachines', 'xx').
|
||||
|
||||
=item B<--filter-metric>
|
||||
|
||||
Filter metrics (Can be: 'Disk Read Bytes', 'Disk Write Bytes',
|
|
@ -18,7 +18,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::compute::mode::listvms;
|
||||
package cloud::azure::compute::virtualmachine::mode::listresources;
|
||||
|
||||
use base qw(centreon::plugins::mode);
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::compute::mode::network;
|
||||
package cloud::azure::compute::virtualmachine::mode::network;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
|
@ -124,7 +124,6 @@ sub new {
|
|||
{
|
||||
"resource:s@" => { name => 'resource' },
|
||||
"resource-group:s" => { name => 'resource_group' },
|
||||
"resource-type:s" => { name => 'resource_type' },
|
||||
"filter-metric:s" => { name => 'filter_metric' },
|
||||
"per-sec" => { name => 'per_sec' },
|
||||
});
|
||||
|
@ -137,21 +136,21 @@ sub check_options {
|
|||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (!defined($self->{option_results}->{resource})) {
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group and --resource-type options or --resource <id>.");
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group option or --resource <id>.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
$self->{az_resource_group} = '';
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_type} = 'virtualMachines';
|
||||
$self->{az_resource_namespace} = 'Microsoft.Compute';
|
||||
|
||||
foreach my $resource (@{$self->{option_results}->{resource}}) {
|
||||
push @{$self->{az_resource}}, $resource;
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Compute\/.*\/.*$/) {
|
||||
$self->{az_resource_namespace} = '';
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Compute\/virtualMachines\/.*$/) {
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_namespace} = '';
|
||||
} else {
|
||||
$self->{az_resource_group} = $self->{option_results}->{resource_group};
|
||||
$self->{az_resource_type} = $self->{option_results}->{resource_type};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -184,7 +183,7 @@ sub manage_selection {
|
|||
my %metric_results;
|
||||
foreach my $resource (@{$self->{az_resource}}) {
|
||||
my $resource_name = $resource;
|
||||
$resource_name = $1 if ($resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Compute\/.*\/(.*)$/);
|
||||
$resource_name = $1 if ($resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Compute\/virtualMachines\/(.*)$/);
|
||||
|
||||
($metric_results{$resource_name}, undef, undef) = $options{custom}->azure_get_metrics(
|
||||
resource => $resource,
|
||||
|
@ -223,19 +222,18 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check compute resources network metrics.
|
||||
Check virtual machine resources network metrics.
|
||||
|
||||
Example:
|
||||
|
||||
Using resource name :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::compute::plugin --custommode=azcli --mode=network
|
||||
--resource=MYSQLINSTANCE --resource-group=MYHOSTGROUP --resource-type=virtualMachines
|
||||
--aggregation='total' --critical-network-out-total='10' --verbose
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::compute::virtualmachine::plugin --custommode=azcli --mode=network
|
||||
--resource=MYSQLINSTANCE --resource-group=MYHOSTGROUP --aggregation='total' --critical-network-out-total='10' --verbose
|
||||
|
||||
Using resource id :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::compute::plugin --custommode=azcli --mode=network
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::compute::virtualmachine::plugin --custommode=azcli --mode=network
|
||||
--resource='/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Compute/virtualMachines/xxx'
|
||||
--aggregation='total' --critical-network-out-total='10' --verbose
|
||||
|
||||
|
@ -251,10 +249,6 @@ Set resource name or id (Required).
|
|||
|
||||
Set resource group (Required if resource's name is used).
|
||||
|
||||
=item B<--resource-type>
|
||||
|
||||
Set resource type (Required if resource's name is used) (Can be: 'virtualMachines', 'xx').
|
||||
|
||||
=item B<--filter-metric>
|
||||
|
||||
Filter metrics (Can be: 'Network In', 'Network Out') (Can be a regexp).
|
|
@ -18,7 +18,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::compute::mode::vmsizes;
|
||||
package cloud::azure::compute::virtualmachine::mode::vmsizes;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
|
@ -184,7 +184,7 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
List virtual machines resource sizes.
|
||||
List virtual machine resources sizes.
|
||||
|
||||
=over 8
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::compute::mode::vmsstate;
|
||||
package cloud::azure::compute::virtualmachine::mode::vmsstate;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
|
@ -194,7 +194,7 @@ __END__
|
|||
Check virtual machines status.
|
||||
|
||||
Example:
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::compute::plugin --custommode=azcli --mode=vms-state
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::compute::virtualmachine::plugin --custommode=azcli --mode=vms-state
|
||||
--filter-name='.*' --filter-counters='^total-running$' --critical-total-running='10' --verbose
|
||||
|
||||
=over 8
|
|
@ -18,7 +18,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::compute::plugin;
|
||||
package cloud::azure::compute::virtualmachine::plugin;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
@ -31,13 +31,12 @@ sub new {
|
|||
|
||||
$self->{version} = '0.1';
|
||||
%{ $self->{modes} } = (
|
||||
'cpu' => 'cloud::azure::compute::mode::cpu',
|
||||
'diskio' => 'cloud::azure::compute::mode::diskio',
|
||||
'list-resources' => 'cloud::azure::compute::mode::listresources',
|
||||
'list-vms' => 'cloud::azure::compute::mode::listvms',
|
||||
'network' => 'cloud::azure::compute::mode::network',
|
||||
'vm-sizes' => 'cloud::azure::compute::mode::vmsizes',
|
||||
'vms-state' => 'cloud::azure::compute::mode::vmsstate',
|
||||
'cpu' => 'cloud::azure::compute::virtualmachine::mode::cpu',
|
||||
'diskio' => 'cloud::azure::compute::virtualmachine::mode::diskio',
|
||||
'list-resources' => 'cloud::azure::compute::virtualmachine::mode::listresources',
|
||||
'network' => 'cloud::azure::compute::virtualmachine::mode::network',
|
||||
'vm-sizes' => 'cloud::azure::compute::virtualmachine::mode::vmsizes',
|
||||
'vms-state' => 'cloud::azure::compute::virtualmachine::mode::vmsstate',
|
||||
);
|
||||
|
||||
$self->{custom_modes}{azcli} = 'cloud::azure::custom::azcli';
|
||||
|
@ -50,6 +49,6 @@ __END__
|
|||
|
||||
=head1 PLUGIN DESCRIPTION
|
||||
|
||||
Check Microsoft Azure compute provider.
|
||||
Check Microsoft Azure virtual machine.
|
||||
|
||||
=cut
|
|
@ -51,6 +51,7 @@ sub new {
|
|||
"command:s" => { name => 'command', default => 'az' },
|
||||
"command-path:s" => { name => 'command_path' },
|
||||
"command-options:s" => { name => 'command_options', default => '' },
|
||||
"proxyurl:s" => { name => 'proxyurl' },
|
||||
});
|
||||
}
|
||||
$options{options}->add_help(package => __PACKAGE__, sections => 'AZCLI OPTIONS', once => 1);
|
||||
|
@ -86,6 +87,11 @@ sub set_defaults {
|
|||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
if (defined($self->{option_results}->{proxyurl}) && $self->{option_results}->{proxyurl} ne '') {
|
||||
$ENV{HTTP_PROXY} = $self->{option_results}->{proxyurl};
|
||||
$ENV{HTTPS_PROXY} = $self->{option_results}->{proxyurl};
|
||||
}
|
||||
|
||||
if (defined($self->{option_results}->{aggregation})) {
|
||||
foreach my $aggregation (@{$self->{option_results}->{aggregation}}) {
|
||||
if ($aggregation !~ /average|maximum|minimum|total/i) {
|
||||
|
@ -386,10 +392,12 @@ Microsoft Azure CLI
|
|||
Microsoft Azure CLI 2.0
|
||||
|
||||
To install the Azure CLI 2.0 in a CentOS/RedHat environment :
|
||||
# sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
|
||||
# sudo sh -c 'echo -e "[azure-cli]\nname=Azure CLI\nbaseurl=https://packages.microsoft.com/yumrepos/azure-cli\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/azure-cli.repo'
|
||||
(As root)
|
||||
# rpm --import https://packages.microsoft.com/keys/microsoft.asc
|
||||
# sh -c 'echo -e "[azure-cli]\nname=Azure CLI\nbaseurl=https://packages.microsoft.com/yumrepos/azure-cli\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/azure-cli.repo'
|
||||
# yum install azure-cli
|
||||
# az login -u <username> -p <password>
|
||||
(As centreon-engine)
|
||||
# az login
|
||||
Go to https://aka.ms/devicelogin and enter the code given by the last command.
|
||||
|
||||
For futher informations, visit https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest.
|
||||
|
@ -436,6 +444,10 @@ Command path (Default: none).
|
|||
|
||||
Command options (Default: none).
|
||||
|
||||
=item B<--proxyurl>
|
||||
|
||||
Proxy URL if any
|
||||
|
||||
=back
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::monitor::mode::getmetrics;
|
||||
package cloud::azure::management::monitor::mode::getmetrics;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
|
@ -188,11 +188,11 @@ __END__
|
|||
Check Azure metrics.
|
||||
|
||||
Examples:
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::monitor::plugin --custommode=azcli --mode=get-metrics
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::management::monitor::plugin --custommode=azcli --mode=get-metrics
|
||||
--resource=MYSQLINSTANCE --resource-group=MYHOSTGROUP --resource-namespace='Microsoft.Compute' --resource-type='virtualMachines'
|
||||
--metric='Percentage CPU' --aggregation=average –-interval=PT1M --timeframe=600 --warning-metric= --critical-metric=
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::monitor::plugin --custommode=azcli --mode=get-metrics
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::management::monitor::plugin --custommode=azcli --mode=get-metrics
|
||||
--resource='/subscriptions/d29fe431/resourceGroups/MYHOSTGROUP/providers/Microsoft.Compute/virtualMachines/MYSQLINSTANCE'
|
||||
--metric='Percentage CPU' --aggregation=average –-interval=PT1M --timeframe=600 --warning-metric= --critical-metric=
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::monitor::plugin;
|
||||
package cloud::azure::management::monitor::plugin;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
@ -31,7 +31,7 @@ sub new {
|
|||
|
||||
$self->{version} = '1.0';
|
||||
%{$self->{modes}} = (
|
||||
'get-metrics' => 'cloud::azure::monitor::mode::getmetrics',
|
||||
'get-metrics' => 'cloud::azure::management::monitor::mode::getmetrics',
|
||||
);
|
||||
|
||||
$self->{custom_modes}{azcli} = 'cloud::azure::custom::azcli';
|
||||
|
@ -45,6 +45,6 @@ __END__
|
|||
|
||||
=head1 PLUGIN DESCRIPTION
|
||||
|
||||
Check Microsoft Azure using API.
|
||||
Check Microsoft Azure monitor service using API.
|
||||
|
||||
=cut
|
|
@ -18,7 +18,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::resources::mode::deploymentsstatus;
|
||||
package cloud::azure::management::resource::mode::deploymentsstatus;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
|
@ -184,7 +184,7 @@ sub manage_selection {
|
|||
}
|
||||
|
||||
if (scalar(keys %{$self->{deployments}}) <= 0) {
|
||||
$self->{output}->add_option_msg(short_msg => "No virtual machines found.");
|
||||
$self->{output}->add_option_msg(short_msg => "No deployments found.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
}
|
||||
|
@ -198,7 +198,7 @@ __END__
|
|||
Check deployments status.
|
||||
|
||||
Example:
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::compute::plugin --custommode=azcli --mode=deployments-status
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::management::resource::plugin --custommode=azcli --mode=deployments-status
|
||||
--filter-counters='^total-failed$' --critical-total-failed='1' --verbose
|
||||
|
||||
=over 8
|
|
@ -18,7 +18,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::resources::mode::items;
|
||||
package cloud::azure::management::resource::mode::items;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
|
@ -156,7 +156,7 @@ __END__
|
|||
Check number of items in resource groups.
|
||||
|
||||
Example:
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::resources::plugin --custommode=azcli --mode=items
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::management::resource::plugin --custommode=azcli --mode=items
|
||||
--filter-name='.*' --critical-items='10' --verbose
|
||||
|
||||
=over 8
|
|
@ -18,7 +18,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::resources::mode::listgroups;
|
||||
package cloud::azure::management::resource::mode::listgroups;
|
||||
|
||||
use base qw(centreon::plugins::mode);
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::resources::mode::listresources;
|
||||
package cloud::azure::management::resource::mode::listresources;
|
||||
|
||||
use base qw(centreon::plugins::mode);
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::resources::plugin;
|
||||
package cloud::azure::management::resource::plugin;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
@ -31,10 +31,10 @@ sub new {
|
|||
|
||||
$self->{version} = '0.1';
|
||||
%{ $self->{modes} } = (
|
||||
'deployments-status' => 'cloud::azure::resources::mode::deploymentsstatus',
|
||||
'list-groups' => 'cloud::azure::resources::mode::listgroups',
|
||||
'list-resources' => 'cloud::azure::resources::mode::listresources',
|
||||
'items' => 'cloud::azure::resources::mode::items',
|
||||
'deployments-status' => 'cloud::azure::management::resource::mode::deploymentsstatus',
|
||||
'list-groups' => 'cloud::azure::management::resource::mode::listgroups',
|
||||
'list-resources' => 'cloud::azure::management::resource::mode::listresources',
|
||||
'items' => 'cloud::azure::management::resource::mode::items',
|
||||
);
|
||||
|
||||
$self->{custom_modes}{azcli} = 'cloud::azure::custom::azcli';
|
||||
|
@ -47,6 +47,6 @@ __END__
|
|||
|
||||
=head1 PLUGIN DESCRIPTION
|
||||
|
||||
Check Microsoft Azure resources provider.
|
||||
Check Microsoft Azure resource manager.
|
||||
|
||||
=cut
|
|
@ -18,7 +18,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::network::mode::listresources;
|
||||
package cloud::azure::network::networkinterface::mode::listresources;
|
||||
|
||||
use base qw(centreon::plugins::mode);
|
||||
|
||||
|
@ -34,7 +34,6 @@ sub new {
|
|||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"resource-group:s" => { name => 'resource_group' },
|
||||
"resource-type:s" => { name => 'resource_type', default => 'networkInterfaces' },
|
||||
"location:s" => { name => 'location' },
|
||||
"filter-name:s" => { name => 'filter_name' },
|
||||
});
|
||||
|
@ -52,7 +51,7 @@ sub manage_selection {
|
|||
|
||||
$self->{resources} = $options{custom}->azure_list_resources(
|
||||
namespace => 'Microsoft.Network',
|
||||
resource_type => $self->{option_results}->{resource_type},
|
||||
resource_type => 'networkInterfaces',
|
||||
location => $self->{option_results}->{location},
|
||||
resource_group => $self->{option_results}->{resource_group}
|
||||
);
|
||||
|
@ -65,13 +64,12 @@ sub run {
|
|||
foreach my $resource (@{$self->{resources}}) {
|
||||
next if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne ''
|
||||
&& $resource->{name} !~ /$self->{option_results}->{filter_name}/);
|
||||
$resource->{type} =~ s/Microsoft.Network\///g;
|
||||
$self->{output}->output_add(long_msg => sprintf("[name = %s][resourcegroup = %s][location = %s][id = %s][type = %s]",
|
||||
$resource->{name}, $resource->{resourceGroup}, $resource->{location}, $resource->{id}, $resource->{type}));
|
||||
$self->{output}->output_add(long_msg => sprintf("[name = %s][resourcegroup = %s][location = %s][id = %s]",
|
||||
$resource->{name}, $resource->{resourceGroup}, $resource->{location}, $resource->{id}));
|
||||
}
|
||||
|
||||
$self->{output}->output_add(severity => 'OK',
|
||||
short_msg => 'List resources:');
|
||||
short_msg => 'List network interfaces:');
|
||||
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
|
||||
$self->{output}->exit();
|
||||
}
|
||||
|
@ -79,7 +77,7 @@ sub run {
|
|||
sub disco_format {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{output}->add_disco_format(elements => ['name', 'resourcegroup', 'location', 'id', 'type']);
|
||||
$self->{output}->add_disco_format(elements => ['name', 'resourcegroup', 'location', 'id');
|
||||
}
|
||||
|
||||
sub disco_show {
|
||||
|
@ -87,13 +85,11 @@ sub disco_show {
|
|||
|
||||
$self->manage_selection(%options);
|
||||
foreach my $resource (@{$self->{resources}}) {
|
||||
$resource->{type} =~ s/Microsoft.Network\///g;
|
||||
$self->{output}->add_disco_entry(
|
||||
name => $resource->{name},
|
||||
resourcegroup => $resource->{resourceGroup},
|
||||
location => $resource->{location},
|
||||
id => $resource->{id},
|
||||
type => $resource->{type},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -104,7 +100,7 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
List network resources.
|
||||
List network interface resources.
|
||||
|
||||
=over 8
|
||||
|
||||
|
@ -112,10 +108,6 @@ List network resources.
|
|||
|
||||
Set resource group.
|
||||
|
||||
=item B<--resource-type>
|
||||
|
||||
Set resource type (Default: 'networkInterfaces').
|
||||
|
||||
=item B<--location>
|
||||
|
||||
Set resource location.
|
|
@ -18,7 +18,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::network::mode::traffic;
|
||||
package cloud::azure::network::networkinterface::mode::traffic;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
|
@ -169,7 +169,6 @@ sub new {
|
|||
{
|
||||
"resource:s@" => { name => 'resource' },
|
||||
"resource-group:s" => { name => 'resource_group' },
|
||||
"resource-type:s" => { name => 'resource_type' },
|
||||
"filter-metric:s" => { name => 'filter_metric' },
|
||||
"per-sec" => { name => 'per_sec' },
|
||||
});
|
||||
|
@ -182,21 +181,21 @@ sub check_options {
|
|||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (!defined($self->{option_results}->{resource})) {
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group and --resource-type options or --resource <id>.");
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group option or --resource <id>.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
$self->{az_resource_group} = '';
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_type} = 'networkInterfaces';
|
||||
$self->{az_resource_namespace} = 'Microsoft.Compute';
|
||||
|
||||
foreach my $resource (@{$self->{option_results}->{resource}}) {
|
||||
push @{$self->{az_resource}}, $resource;
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Network\/.*\/.*$/) {
|
||||
$self->{az_resource_namespace} = '';
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Network\/networkInterfaces\/.*$/) {
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_namespace} = '';
|
||||
} else {
|
||||
$self->{az_resource_group} = $self->{option_results}->{resource_group};
|
||||
$self->{az_resource_type} = $self->{option_results}->{resource_type};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -229,7 +228,7 @@ sub manage_selection {
|
|||
my %metric_results;
|
||||
foreach my $resource (@{$self->{az_resource}}) {
|
||||
my $resource_name = $resource;
|
||||
$resource_name = $1 if ($resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Network\/.*\/(.*)$/);
|
||||
$resource_name = $1 if ($resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Network\/networkInterfaces\/(.*)$/);
|
||||
|
||||
($metric_results{$resource_name}, undef, undef) = $options{custom}->azure_get_metrics(
|
||||
resource => $resource,
|
||||
|
@ -268,19 +267,19 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check network resources traffic metrics.
|
||||
Check network interface resources traffic metrics.
|
||||
|
||||
Example:
|
||||
|
||||
Using resource name :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::network::plugin --custommode=azcli --mode=traffic
|
||||
--resource=MYSQLINSTANCE --resource-group=MYHOSTGROUP --resource-type=networkInterfaces
|
||||
--aggregation='total' --critical-bytesreceivedrate-total='10' --verbose
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::network::networkinterface::plugin --custommode=azcli --mode=traffic
|
||||
--resource=MYNIC --resource-group=MYHOSTGROUP --aggregation='total' --critical-bytesreceivedrate-total='10'
|
||||
--verbose
|
||||
|
||||
Using resource id :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::network::plugin --custommode=azcli --mode=traffic
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::network::networkinterface::plugin --custommode=azcli --mode=traffic
|
||||
--resource='/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Network/networkInterfaces/xxx'
|
||||
--aggregation='total' --critical-bytesreceivedrate-total='10' --verbose
|
||||
|
||||
|
@ -296,10 +295,6 @@ Set resource name or id (Required).
|
|||
|
||||
Set resource group (Required if resource's name is used).
|
||||
|
||||
=item B<--resource-type>
|
||||
|
||||
Set resource type (Required if resource's name is used) (Can be: 'networkInterfaces').
|
||||
|
||||
=item B<--filter-metric>
|
||||
|
||||
Filter metrics (Can be: 'BytesReceivedRate', 'BytesSentRate',
|
|
@ -18,7 +18,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::network::plugin;
|
||||
package cloud::azure::network::networkinterface::plugin;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
@ -31,8 +31,8 @@ sub new {
|
|||
|
||||
$self->{version} = '0.1';
|
||||
%{ $self->{modes} } = (
|
||||
'list-resources' => 'cloud::azure::network::mode::listresources',
|
||||
'throughput' => 'cloud::azure::network::mode::traffic',
|
||||
'list-resources' => 'cloud::azure::network::networkinterface::mode::listresources',
|
||||
'throughput' => 'cloud::azure::network::networkinterface::mode::traffic',
|
||||
);
|
||||
|
||||
$self->{custom_modes}{azcli} = 'cloud::azure::custom::azcli';
|
||||
|
@ -45,6 +45,6 @@ __END__
|
|||
|
||||
=head1 PLUGIN DESCRIPTION
|
||||
|
||||
Check Microsoft Azure network provider.
|
||||
Check Microsoft Azure network interface.
|
||||
|
||||
=cut
|
|
@ -1,66 +0,0 @@
|
|||
#
|
||||
# Copyright 2018 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::storage::plugin;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use base qw(centreon::plugins::script_custom);
|
||||
|
||||
sub new {
|
||||
my ( $class, %options ) = @_;
|
||||
my $self = $class->SUPER::new( package => __PACKAGE__, %options );
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '0.1';
|
||||
%{ $self->{modes} } = (
|
||||
'account-used-capacity' => 'cloud::azure::storage::mode::accountusedcapacity',
|
||||
'blob-capacity' => 'cloud::azure::storage::mode::blobcapacity',
|
||||
'blob-container-count' => 'cloud::azure::storage::mode::blobcontainercount',
|
||||
'blob-count' => 'cloud::azure::storage::mode::blobcount',
|
||||
'file-capacity' => 'cloud::azure::storage::mode::filecapacity',
|
||||
'file-count' => 'cloud::azure::storage::mode::filecount',
|
||||
'file-share-count' => 'cloud::azure::storage::mode::filesharecount',
|
||||
'list-resources' => 'cloud::azure::storage::mode::listresources',
|
||||
'queue-capacity' => 'cloud::azure::storage::mode::queuecapacity',
|
||||
'queue-count' => 'cloud::azure::storage::mode::queuecount',
|
||||
'queue-message-count' => 'cloud::azure::storage::mode::queuemessagecount',
|
||||
'table-capacity' => 'cloud::azure::storage::mode::tablecapacity',
|
||||
'table-count' => 'cloud::azure::storage::mode::tablecount',
|
||||
'table-entity-count' => 'cloud::azure::storage::mode::tableentitycount',
|
||||
'transactions-availability' => 'cloud::azure::storage::mode::transactionsavailability',
|
||||
'transactions-count' => 'cloud::azure::storage::mode::transactionscount',
|
||||
'transactions-latency' => 'cloud::azure::storage::mode::transactionslatency',
|
||||
'transactions-throughput' => 'cloud::azure::storage::mode::transactionsthroughput',
|
||||
);
|
||||
|
||||
$self->{custom_modes}{azcli} = 'cloud::azure::custom::azcli';
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 PLUGIN DESCRIPTION
|
||||
|
||||
Check Microsoft Azure storage provider.
|
||||
|
||||
=cut
|
|
@ -18,7 +18,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::storage::mode::accountusedcapacity;
|
||||
package cloud::azure::storage::storageaccount::mode::accountusedcapacity;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
|
@ -67,7 +67,6 @@ sub new {
|
|||
{
|
||||
"resource:s@" => { name => 'resource' },
|
||||
"resource-group:s" => { name => 'resource_group' },
|
||||
"resource-type:s" => { name => 'resource_type' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
|
@ -78,21 +77,21 @@ sub check_options {
|
|||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (!defined($self->{option_results}->{resource})) {
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group and --resource-type options or --resource <id>.");
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group option or --resource <id>.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
$self->{az_resource_group} = '';
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_type} = 'storageAccounts';
|
||||
$self->{az_resource_namespace} = 'Microsoft.Storage';
|
||||
|
||||
foreach my $resource (@{$self->{option_results}->{resource}}) {
|
||||
push @{$self->{az_resource}}, $resource;
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/.*\/.*/) {
|
||||
$self->{az_resource_namespace} = '';
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/storageAccounts\/.*/) {
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_namespace} = '';
|
||||
} else {
|
||||
$self->{az_resource_group} = $self->{option_results}->{resource_group};
|
||||
$self->{az_resource_type} = $self->{option_results}->{resource_type};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,8 +119,8 @@ sub manage_selection {
|
|||
my %metric_results;
|
||||
foreach my $resource (@{$self->{az_resource}}) {
|
||||
my $resource_name = $resource;
|
||||
if ($resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/.*\/(.*)$/) {
|
||||
$resource_name = $1;
|
||||
if ($resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/storageAccounts\/(.*)$/) {
|
||||
$resource_name = $1;
|
||||
}
|
||||
|
||||
($metric_results{$resource_name}, undef, undef) = $options{custom}->azure_get_metrics(
|
||||
|
@ -160,19 +159,18 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check storage resources used capacity metric.
|
||||
Check storage account resources used capacity metric.
|
||||
|
||||
Example:
|
||||
|
||||
Using resource name :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::plugin --custommode=azcli --mode=account-used-capacity
|
||||
--resource=MYFILER --resource-group=MYHOSTGROUP --resource-type=storageAccounts
|
||||
--aggregation='total' --critical-usedcapacity-total='10' --verbose
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::storageaccount::plugin --custommode=azcli --mode=account-used-capacity
|
||||
--resource=MYFILER --resource-group=MYHOSTGROUP --aggregation='total' --critical-usedcapacity-total='10' --verbose
|
||||
|
||||
Using resource id :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::plugin --custommode=azcli --mode=account-used-capacity
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::storageaccount::plugin --custommode=azcli --mode=account-used-capacity
|
||||
--resource='/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Storage/storageAccounts/xxx'
|
||||
--aggregation='total' --critical-usedcapacity-total='10' --verbose
|
||||
|
||||
|
@ -188,10 +186,6 @@ Set resource name or id (Required).
|
|||
|
||||
Set resource group (Required if resource's name is used).
|
||||
|
||||
=item B<--resource-type>
|
||||
|
||||
Set resource type (Required if resource's name is used) (Can be: 'storageAccounts').
|
||||
|
||||
=item B<--warning-usedcapacity-total>
|
||||
|
||||
Thresholds warning
|
|
@ -18,7 +18,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::storage::mode::blobcapacity;
|
||||
package cloud::azure::storage::storageaccount::mode::blobcapacity;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
|
@ -67,7 +67,6 @@ sub new {
|
|||
{
|
||||
"resource:s@" => { name => 'resource' },
|
||||
"resource-group:s" => { name => 'resource_group' },
|
||||
"resource-type:s" => { name => 'resource_type' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
|
@ -78,21 +77,21 @@ sub check_options {
|
|||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (!defined($self->{option_results}->{resource})) {
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group and --resource-type options or --resource <id>.");
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group option or --resource <id>.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
$self->{az_resource_group} = '';
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_type} = 'storageAccounts';
|
||||
$self->{az_resource_namespace} = 'Microsoft.Storage';
|
||||
|
||||
foreach my $resource (@{$self->{option_results}->{resource}}) {
|
||||
push @{$self->{az_resource}}, $resource;
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/.*\/.*/) {
|
||||
$self->{az_resource_namespace} = '';
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/storageAccounts\/.*/) {
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_namespace} = '';
|
||||
} else {
|
||||
$self->{az_resource_group} = $self->{option_results}->{resource_group};
|
||||
$self->{az_resource_type} = $self->{option_results}->{resource_type};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,7 +120,7 @@ sub manage_selection {
|
|||
foreach my $resource (@{$self->{az_resource}}) {
|
||||
my $resource_name = $resource;
|
||||
my $namespace_full = '/blobServices/default';
|
||||
if ($resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/.*\/(.*)\/.*\/default$/) {
|
||||
if ($resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/storageAccounts\/(.*)\/.*\/default$/) {
|
||||
$resource_name = $1;
|
||||
$namespace_full = '';
|
||||
}
|
||||
|
@ -162,19 +161,18 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check storage resources blob capacity metric.
|
||||
Check storage account resources blob capacity metric.
|
||||
|
||||
Example:
|
||||
|
||||
Using resource name :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::plugin --custommode=azcli --mode=blob-capacity
|
||||
--resource=MYFILER --resource-group=MYHOSTGROUP --resource-type=storageAccounts
|
||||
--aggregation='total' --critical-blobcapacity-total='10' --verbose
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::storageaccount::plugin --custommode=azcli --mode=blob-capacity
|
||||
--resource=MYFILER --resource-group=MYHOSTGROUP --aggregation='total' --critical-blobcapacity-total='10' --verbose
|
||||
|
||||
Using resource id :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::plugin --custommode=azcli --mode=blob-capacity
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::storageaccount::plugin --custommode=azcli --mode=blob-capacity
|
||||
--resource='/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Storage/storageAccounts/xxx/blobServices/default'
|
||||
--aggregation='total' --critical-blobcapacity-total='10' --verbose
|
||||
|
||||
|
@ -190,10 +188,6 @@ Set resource name or id (Required).
|
|||
|
||||
Set resource group (Required if resource's name is used).
|
||||
|
||||
=item B<--resource-type>
|
||||
|
||||
Set resource type (Required if resource's name is used) (Can be: 'storageAccounts').
|
||||
|
||||
=item B<--warning-blobcapacity-total>
|
||||
|
||||
Thresholds warning
|
|
@ -18,7 +18,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::storage::mode::blobcontainercount;
|
||||
package cloud::azure::storage::storageaccount::mode::blobcontainercount;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
|
@ -66,7 +66,6 @@ sub new {
|
|||
{
|
||||
"resource:s@" => { name => 'resource' },
|
||||
"resource-group:s" => { name => 'resource_group' },
|
||||
"resource-type:s" => { name => 'resource_type' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
|
@ -77,21 +76,21 @@ sub check_options {
|
|||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (!defined($self->{option_results}->{resource})) {
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group and --resource-type options or --resource <id>.");
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group option or --resource <id>.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
$self->{az_resource_group} = '';
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_type} = 'storageAccounts';
|
||||
$self->{az_resource_namespace} = 'Microsoft.Storage';
|
||||
|
||||
foreach my $resource (@{$self->{option_results}->{resource}}) {
|
||||
push @{$self->{az_resource}}, $resource;
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/.*\/.*/) {
|
||||
$self->{az_resource_namespace} = '';
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/storageAccounts\/.*/) {
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_namespace} = '';
|
||||
} else {
|
||||
$self->{az_resource_group} = $self->{option_results}->{resource_group};
|
||||
$self->{az_resource_type} = $self->{option_results}->{resource_type};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,7 +119,7 @@ sub manage_selection {
|
|||
foreach my $resource (@{$self->{az_resource}}) {
|
||||
my $resource_name = $resource;
|
||||
my $namespace_full = '/blobServices/default';
|
||||
if ($resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/.*\/(.*)\/.*\/default$/) {
|
||||
if ($resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/storageAccounts\/(.*)\/.*\/default$/) {
|
||||
$resource_name = $1;
|
||||
$namespace_full = '';
|
||||
}
|
||||
|
@ -161,19 +160,18 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check storage resources blob container count metric.
|
||||
Check storage account resources blob container count metric.
|
||||
|
||||
Example:
|
||||
|
||||
Using resource name :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::plugin --custommode=azcli --mode=blob-container-count
|
||||
--resource=MYFILER --resource-group=MYHOSTGROUP --resource-type=storageAccounts
|
||||
--aggregation='average' --critical-containercount-average='10' --verbose
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::storageaccount::plugin --custommode=azcli --mode=blob-container-count
|
||||
--resource=MYFILER --resource-group=MYHOSTGROUP --aggregation='average' --critical-containercount-average='10' --verbose
|
||||
|
||||
Using resource id :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::plugin --custommode=azcli --mode=blob-container-count
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::storageaccount::plugin --custommode=azcli --mode=blob-container-count
|
||||
--resource='/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Storage/storageAccounts/xxx/blobServices/default'
|
||||
--aggregation='average' --critical-containercount-average='10' --verbose
|
||||
|
||||
|
@ -189,10 +187,6 @@ Set resource name or id (Required).
|
|||
|
||||
Set resource group (Required if resource's name is used).
|
||||
|
||||
=item B<--resource-type>
|
||||
|
||||
Set resource type (Required if resource's name is used) (Can be: 'storageAccounts').
|
||||
|
||||
=item B<--warning-containercount-$aggregation$>
|
||||
|
||||
Thresholds warning ($aggregation$ can be: 'average', 'total').
|
|
@ -18,7 +18,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::storage::mode::blobcount;
|
||||
package cloud::azure::storage::storageaccount::mode::blobcount;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
|
@ -66,7 +66,6 @@ sub new {
|
|||
{
|
||||
"resource:s@" => { name => 'resource' },
|
||||
"resource-group:s" => { name => 'resource_group' },
|
||||
"resource-type:s" => { name => 'resource_type' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
|
@ -77,21 +76,21 @@ sub check_options {
|
|||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (!defined($self->{option_results}->{resource})) {
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group and --resource-type options or --resource <id>.");
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group option or --resource <id>.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
$self->{az_resource_group} = '';
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_type} = 'storageAccounts';
|
||||
$self->{az_resource_namespace} = 'Microsoft.Storage';
|
||||
|
||||
foreach my $resource (@{$self->{option_results}->{resource}}) {
|
||||
push @{$self->{az_resource}}, $resource;
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/.*\/.*/) {
|
||||
$self->{az_resource_namespace} = '';
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/storageAccounts\/.*/) {
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_namespace} = '';
|
||||
} else {
|
||||
$self->{az_resource_group} = $self->{option_results}->{resource_group};
|
||||
$self->{az_resource_type} = $self->{option_results}->{resource_type};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,7 +119,7 @@ sub manage_selection {
|
|||
foreach my $resource (@{$self->{az_resource}}) {
|
||||
my $resource_name = $resource;
|
||||
my $namespace_full = '/blobServices/default';
|
||||
if ($resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/.*\/(.*)\/.*\/default$/) {
|
||||
if ($resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/storageAccounts\/(.*)\/.*\/default$/) {
|
||||
$resource_name = $1;
|
||||
$namespace_full = '';
|
||||
}
|
||||
|
@ -161,19 +160,18 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check storage resources blob capacity metric.
|
||||
Check storage account resources blob capacity metric.
|
||||
|
||||
Example:
|
||||
|
||||
Using resource name :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::plugin --custommode=azcli --mode=blob-capacity
|
||||
--resource=MYFILER --resource-group=MYHOSTGROUP --resource-type=storageAccounts
|
||||
--aggregation='total' --critical-blobcapacity-total='10' --verbose
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::storageaccount::plugin --custommode=azcli --mode=blob-capacity
|
||||
--resource=MYFILER --resource-group=MYHOSTGROUP --aggregation='total' --critical-blobcapacity-total='10' --verbose
|
||||
|
||||
Using resource id :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::plugin --custommode=azcli --mode=blob-capacity
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::storageaccount::plugin --custommode=azcli --mode=blob-capacity
|
||||
--resource='/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Storage/storageAccounts/xxx/blobServices/default'
|
||||
--aggregation='total' --critical-blobcapacity-total='10' --verbose
|
||||
|
||||
|
@ -189,10 +187,6 @@ Set resource name or id (Required).
|
|||
|
||||
Set resource group (Required if resource's name is used).
|
||||
|
||||
=item B<--resource-type>
|
||||
|
||||
Set resource type (Required if resource's name is used) (Can be: 'storageAccounts').
|
||||
|
||||
=item B<--warning-blobcapacity-total>
|
||||
|
||||
Thresholds warning
|
|
@ -18,7 +18,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::storage::mode::filecapacity;
|
||||
package cloud::azure::storage::storageaccount::mode::filecapacity;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
|
@ -67,7 +67,6 @@ sub new {
|
|||
{
|
||||
"resource:s@" => { name => 'resource' },
|
||||
"resource-group:s" => { name => 'resource_group' },
|
||||
"resource-type:s" => { name => 'resource_type' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
|
@ -78,21 +77,21 @@ sub check_options {
|
|||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (!defined($self->{option_results}->{resource})) {
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group and --resource-type options or --resource <id>.");
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group option or --resource <id>.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
$self->{az_resource_group} = '';
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_type} = 'storageAccounts';
|
||||
$self->{az_resource_namespace} = 'Microsoft.Storage';
|
||||
|
||||
foreach my $resource (@{$self->{option_results}->{resource}}) {
|
||||
push @{$self->{az_resource}}, $resource;
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/.*\/.*/) {
|
||||
$self->{az_resource_namespace} = '';
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/storageAccounts\/.*/) {
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_namespace} = '';
|
||||
} else {
|
||||
$self->{az_resource_group} = $self->{option_results}->{resource_group};
|
||||
$self->{az_resource_type} = $self->{option_results}->{resource_type};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,7 +120,7 @@ sub manage_selection {
|
|||
foreach my $resource (@{$self->{az_resource}}) {
|
||||
my $resource_name = $resource;
|
||||
my $namespace_full = '/fileServices/default';
|
||||
if ($resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/.*\/(.*)\/.*\/default$/) {
|
||||
if ($resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/storageAccounts\/(.*)\/.*\/default$/) {
|
||||
$resource_name = $1;
|
||||
$namespace_full = '';
|
||||
}
|
||||
|
@ -162,19 +161,18 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check storage resources file capacity metric.
|
||||
Check storage account resources file capacity metric.
|
||||
|
||||
Example:
|
||||
|
||||
Using resource name :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::plugin --custommode=azcli --mode=file-capacity
|
||||
--resource=MYFILER --resource-group=MYHOSTGROUP --resource-type=storageAccounts
|
||||
--aggregation='average' --critical-filecapacity-average='10' --verbose
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::storageaccount::plugin --custommode=azcli --mode=file-capacity
|
||||
--resource=MYFILER --resource-group=MYHOSTGROUP --aggregation='average' --critical-filecapacity-average='10' --verbose
|
||||
|
||||
Using resource id :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::plugin --custommode=azcli --mode=file-capacity
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::storageaccount::plugin --custommode=azcli --mode=file-capacity
|
||||
--resource='/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Storage/storageAccounts/xxx/fileServices/default'
|
||||
--aggregation='average' --critical-filecapacity-average='10' --verbose
|
||||
|
||||
|
@ -190,10 +188,6 @@ Set resource name or id (Required).
|
|||
|
||||
Set resource group (Required if resource's name is used).
|
||||
|
||||
=item B<--resource-type>
|
||||
|
||||
Set resource type (Required if resource's name is used) (Can be: 'storageAccounts').
|
||||
|
||||
=item B<--warning-filecapacity-$aggregation$>
|
||||
|
||||
Thresholds warning ($aggregation$ can be: 'average', 'total').
|
|
@ -18,7 +18,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::storage::mode::filecount;
|
||||
package cloud::azure::storage::storageaccount::mode::filecount;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
|
@ -66,7 +66,6 @@ sub new {
|
|||
{
|
||||
"resource:s@" => { name => 'resource' },
|
||||
"resource-group:s" => { name => 'resource_group' },
|
||||
"resource-type:s" => { name => 'resource_type' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
|
@ -77,21 +76,21 @@ sub check_options {
|
|||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (!defined($self->{option_results}->{resource})) {
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group and --resource-type options or --resource <id>.");
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group option or --resource <id>.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
$self->{az_resource_group} = '';
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_type} = 'storageAccounts';
|
||||
$self->{az_resource_namespace} = 'Microsoft.Storage';
|
||||
|
||||
foreach my $resource (@{$self->{option_results}->{resource}}) {
|
||||
push @{$self->{az_resource}}, $resource;
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/.*\/.*/) {
|
||||
$self->{az_resource_namespace} = '';
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/storageAccounts\/.*/) {
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_namespace} = '';
|
||||
} else {
|
||||
$self->{az_resource_group} = $self->{option_results}->{resource_group};
|
||||
$self->{az_resource_type} = $self->{option_results}->{resource_type};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,7 +119,7 @@ sub manage_selection {
|
|||
foreach my $resource (@{$self->{az_resource}}) {
|
||||
my $resource_name = $resource;
|
||||
my $namespace_full = '/fileServices/default';
|
||||
if ($resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/.*\/(.*)\/.*\/default$/) {
|
||||
if ($resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/storageAccounts\/(.*)\/.*\/default$/) {
|
||||
$resource_name = $1;
|
||||
$namespace_full = '';
|
||||
}
|
||||
|
@ -161,19 +160,18 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check storage resources file count metric.
|
||||
Check storage account resources file count metric.
|
||||
|
||||
Example:
|
||||
|
||||
Using resource name :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::plugin --custommode=azcli --mode=file-count
|
||||
--resource=MYFILER --resource-group=MYHOSTGROUP --resource-type=storageAccounts
|
||||
--aggregation='average' --critical-filecount-average='10' --verbose
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::storageaccount::plugin --custommode=azcli --mode=file-count
|
||||
--resource=MYFILER --resource-group=MYHOSTGROUP --aggregation='average' --critical-filecount-average='10' --verbose
|
||||
|
||||
Using resource id :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::plugin --custommode=azcli --mode=file-count
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::storageaccount::plugin --custommode=azcli --mode=file-count
|
||||
--resource='/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Storage/storageAccounts/xxx/fileServices/default'
|
||||
--aggregation='average' --critical-filecount-average='10' --verbose
|
||||
|
||||
|
@ -189,10 +187,6 @@ Set resource name or id (Required).
|
|||
|
||||
Set resource group (Required if resource's name is used).
|
||||
|
||||
=item B<--resource-type>
|
||||
|
||||
Set resource type (Required if resource's name is used) (Can be: 'storageAccounts').
|
||||
|
||||
=item B<--warning-filecount-$aggregation$>
|
||||
|
||||
Thresholds warning ($aggregation$ can be: 'average', 'total').
|
|
@ -18,7 +18,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::storage::mode::filesharecount;
|
||||
package cloud::azure::storage::storageaccount::mode::filesharecount;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
|
@ -66,7 +66,6 @@ sub new {
|
|||
{
|
||||
"resource:s@" => { name => 'resource' },
|
||||
"resource-group:s" => { name => 'resource_group' },
|
||||
"resource-type:s" => { name => 'resource_type' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
|
@ -77,21 +76,21 @@ sub check_options {
|
|||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (!defined($self->{option_results}->{resource})) {
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group and --resource-type options or --resource <id>.");
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group option or --resource <id>.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
$self->{az_resource_group} = '';
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_type} = 'storageAccounts';
|
||||
$self->{az_resource_namespace} = 'Microsoft.Storage';
|
||||
|
||||
foreach my $resource (@{$self->{option_results}->{resource}}) {
|
||||
push @{$self->{az_resource}}, $resource;
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/.*\/.*/) {
|
||||
$self->{az_resource_namespace} = '';
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/storageAccounts\/.*/) {
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_namespace} = '';
|
||||
} else {
|
||||
$self->{az_resource_group} = $self->{option_results}->{resource_group};
|
||||
$self->{az_resource_type} = $self->{option_results}->{resource_type};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,7 +119,7 @@ sub manage_selection {
|
|||
foreach my $resource (@{$self->{az_resource}}) {
|
||||
my $resource_name = $resource;
|
||||
my $namespace_full = '/fileServices/default';
|
||||
if ($resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/.*\/(.*)\/.*\/default$/) {
|
||||
if ($resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/storageAccounts\/(.*)\/.*\/default$/) {
|
||||
$resource_name = $1;
|
||||
$namespace_full = '';
|
||||
}
|
||||
|
@ -161,19 +160,18 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check storage resources file share count metric.
|
||||
Check storage account resources file share count metric.
|
||||
|
||||
Example:
|
||||
|
||||
Using resource name :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::plugin --custommode=azcli --mode=file-share-count
|
||||
--resource=MYFILER --resource-group=MYHOSTGROUP --resource-type=storageAccounts
|
||||
--aggregation='average' --critical-filesharecount-average='10' --verbose
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::storageaccount::plugin --custommode=azcli --mode=file-share-count
|
||||
--resource=MYFILER --resource-group=MYHOSTGROUP --aggregation='average' --critical-filesharecount-average='10' --verbose
|
||||
|
||||
Using resource id :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::plugin --custommode=azcli --mode=file-share-count
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::storageaccount::plugin --custommode=azcli --mode=file-share-count
|
||||
--resource='/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Storage/storageAccounts/xxx/fileServices/default'
|
||||
--aggregation='average' --critical-filesharecount-average='10' --verbose
|
||||
|
||||
|
@ -189,10 +187,6 @@ Set resource name or id (Required).
|
|||
|
||||
Set resource group (Required if resource's name is used).
|
||||
|
||||
=item B<--resource-type>
|
||||
|
||||
Set resource type (Required if resource's name is used) (Can be: 'storageAccounts').
|
||||
|
||||
=item B<--warning-filesharecount-$aggregation$>
|
||||
|
||||
Thresholds warning ($aggregation$ can be: 'average', 'total').
|
|
@ -18,7 +18,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::storage::mode::listresources;
|
||||
package cloud::azure::storage::storageaccount::mode::listresources;
|
||||
|
||||
use base qw(centreon::plugins::mode);
|
||||
|
||||
|
@ -34,7 +34,6 @@ sub new {
|
|||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"resource-group:s" => { name => 'resource_group' },
|
||||
"resource-type:s" => { name => 'resource_type', default => 'storageAccounts' },
|
||||
"location:s" => { name => 'location' },
|
||||
"filter-name:s" => { name => 'filter_name' },
|
||||
});
|
||||
|
@ -52,7 +51,7 @@ sub manage_selection {
|
|||
|
||||
$self->{resources} = $options{custom}->azure_list_resources(
|
||||
namespace => 'Microsoft.Storage',
|
||||
resource_type => $self->{option_results}->{resource_type},
|
||||
resource_type => 'storageAccounts',
|
||||
location => $self->{option_results}->{location},
|
||||
resource_group => $self->{option_results}->{resource_group}
|
||||
);
|
||||
|
@ -65,13 +64,12 @@ sub run {
|
|||
foreach my $resource (@{$self->{resources}}) {
|
||||
next if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne ''
|
||||
&& $resource->{name} !~ /$self->{option_results}->{filter_name}/);
|
||||
$resource->{type} =~ s/Microsoft.Storage\///g;
|
||||
$self->{output}->output_add(long_msg => sprintf("[name = %s][resourcegroup = %s][location = %s][id = %s][type = %s]",
|
||||
$resource->{name}, $resource->{resourceGroup}, $resource->{location}, $resource->{id}, $resource->{type}));
|
||||
$self->{output}->output_add(long_msg => sprintf("[name = %s][resourcegroup = %s][location = %s][id = %s]",
|
||||
$resource->{name}, $resource->{resourceGroup}, $resource->{location}, $resource->{id}));
|
||||
}
|
||||
|
||||
$self->{output}->output_add(severity => 'OK',
|
||||
short_msg => 'List resources:');
|
||||
short_msg => 'List storage accounts:');
|
||||
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
|
||||
$self->{output}->exit();
|
||||
}
|
||||
|
@ -79,7 +77,7 @@ sub run {
|
|||
sub disco_format {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{output}->add_disco_format(elements => ['name', 'resourcegroup', 'location', 'id', 'type']);
|
||||
$self->{output}->add_disco_format(elements => ['name', 'resourcegroup', 'location', 'id']);
|
||||
}
|
||||
|
||||
sub disco_show {
|
||||
|
@ -87,13 +85,11 @@ sub disco_show {
|
|||
|
||||
$self->manage_selection(%options);
|
||||
foreach my $resource (@{$self->{resources}}) {
|
||||
$resource->{type} =~ s/Microsoft.Storage\///g;
|
||||
$self->{output}->add_disco_entry(
|
||||
name => $resource->{name},
|
||||
resourcegroup => $resource->{resourceGroup},
|
||||
location => $resource->{location},
|
||||
id => $resource->{id},
|
||||
type => $resource->{type},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -104,7 +100,7 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
List storage resources.
|
||||
List storage account resources.
|
||||
|
||||
=over 8
|
||||
|
||||
|
@ -112,10 +108,6 @@ List storage resources.
|
|||
|
||||
Set resource group.
|
||||
|
||||
=item B<--resource-type>
|
||||
|
||||
Set resource type (Default: 'storageAccounts').
|
||||
|
||||
=item B<--location>
|
||||
|
||||
Set resource location.
|
|
@ -18,7 +18,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::storage::mode::queuecapacity;
|
||||
package cloud::azure::storage::storageaccount::mode::queuecapacity;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
|
@ -67,7 +67,6 @@ sub new {
|
|||
{
|
||||
"resource:s@" => { name => 'resource' },
|
||||
"resource-group:s" => { name => 'resource_group' },
|
||||
"resource-type:s" => { name => 'resource_type' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
|
@ -78,21 +77,21 @@ sub check_options {
|
|||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (!defined($self->{option_results}->{resource})) {
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group and --resource-type options or --resource <id>.");
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group option or --resource <id>.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
$self->{az_resource_group} = '';
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_type} = 'storageAccounts';
|
||||
$self->{az_resource_namespace} = 'Microsoft.Storage';
|
||||
|
||||
foreach my $resource (@{$self->{option_results}->{resource}}) {
|
||||
push @{$self->{az_resource}}, $resource;
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/.*\/.*/) {
|
||||
$self->{az_resource_namespace} = '';
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/storageAccounts\/.*/) {
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_namespace} = '';
|
||||
} else {
|
||||
$self->{az_resource_group} = $self->{option_results}->{resource_group};
|
||||
$self->{az_resource_type} = $self->{option_results}->{resource_type};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,7 +120,7 @@ sub manage_selection {
|
|||
foreach my $resource (@{$self->{az_resource}}) {
|
||||
my $resource_name = $resource;
|
||||
my $namespace_full = '/queueServices/default';
|
||||
if ($resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/.*\/(.*)\/.*\/default$/) {
|
||||
if ($resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/storageAccounts\/(.*)\/.*\/default$/) {
|
||||
$resource_name = $1;
|
||||
$namespace_full = '';
|
||||
}
|
||||
|
@ -162,19 +161,18 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check storage resources queue capacity metric.
|
||||
Check storage account resources queue capacity metric.
|
||||
|
||||
Example:
|
||||
|
||||
Using resource name :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::plugin --custommode=azcli --mode=queue-capacity
|
||||
--resource=MYFILER --resource-group=MYHOSTGROUP --resource-type=storageAccounts
|
||||
--aggregation='average' --critical-queuecapacity-average='10' --verbose
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::storageaccount::plugin --custommode=azcli --mode=queue-capacity
|
||||
--resource=MYFILER --resource-group=MYHOSTGROUP --aggregation='average' --critical-queuecapacity-average='10' --verbose
|
||||
|
||||
Using resource id :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::plugin --custommode=azcli --mode=queue-capacity
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::storageaccount::plugin --custommode=azcli --mode=queue-capacity
|
||||
--resource='/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Storage/storageAccounts/xxx/queueServices/default'
|
||||
--aggregation='average' --critical-queuecapacity-average='10' --verbose
|
||||
|
||||
|
@ -190,10 +188,6 @@ Set resource name or id (Required).
|
|||
|
||||
Set resource group (Required if resource's name is used).
|
||||
|
||||
=item B<--resource-type>
|
||||
|
||||
Set resource type (Required if resource's name is used) (Can be: 'storageAccounts').
|
||||
|
||||
=item B<--warning-queuecapacity-$aggregation$>
|
||||
|
||||
Thresholds warning ($aggregation$ can be: 'average', 'total').
|
|
@ -18,7 +18,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::storage::mode::queuecount;
|
||||
package cloud::azure::storage::storageaccount::mode::queuecount;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
|
@ -66,7 +66,6 @@ sub new {
|
|||
{
|
||||
"resource:s@" => { name => 'resource' },
|
||||
"resource-group:s" => { name => 'resource_group' },
|
||||
"resource-type:s" => { name => 'resource_type' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
|
@ -77,21 +76,21 @@ sub check_options {
|
|||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (!defined($self->{option_results}->{resource})) {
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group and --resource-type options or --resource <id>.");
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group option or --resource <id>.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
$self->{az_resource_group} = '';
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_type} = 'storageAccounts';
|
||||
$self->{az_resource_namespace} = 'Microsoft.Storage';
|
||||
|
||||
foreach my $resource (@{$self->{option_results}->{resource}}) {
|
||||
push @{$self->{az_resource}}, $resource;
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/.*\/.*/) {
|
||||
$self->{az_resource_namespace} = '';
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/storageAccounts\/.*/) {
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_namespace} = '';
|
||||
} else {
|
||||
$self->{az_resource_group} = $self->{option_results}->{resource_group};
|
||||
$self->{az_resource_type} = $self->{option_results}->{resource_type};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,7 +119,7 @@ sub manage_selection {
|
|||
foreach my $resource (@{$self->{az_resource}}) {
|
||||
my $resource_name = $resource;
|
||||
my $namespace_full = '/queueServices/default';
|
||||
if ($resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/.*\/(.*)\/.*\/default$/) {
|
||||
if ($resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/storageAccounts\/(.*)\/.*\/default$/) {
|
||||
$resource_name = $1;
|
||||
$namespace_full = '';
|
||||
}
|
||||
|
@ -161,19 +160,18 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check storage resources queue count metric.
|
||||
Check storage account resources queue count metric.
|
||||
|
||||
Example:
|
||||
|
||||
Using resource name :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::plugin --custommode=azcli --mode=queue-count
|
||||
--resource=MYFILER --resource-group=MYHOSTGROUP --resource-type=storageAccounts
|
||||
--aggregation='average' --critical-queuecount-average='10' --verbose
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::storageaccount::plugin --custommode=azcli --mode=queue-count
|
||||
--resource=MYFILER --resource-group=MYHOSTGROUP --aggregation='average' --critical-queuecount-average='10' --verbose
|
||||
|
||||
Using resource id :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::plugin --custommode=azcli --mode=queue-count
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::storageaccount::plugin --custommode=azcli --mode=queue-count
|
||||
--resource='/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Storage/storageAccounts/xxx/queueServices/default'
|
||||
--aggregation='average' --critical-queuecount-average='10' --verbose
|
||||
|
||||
|
@ -189,10 +187,6 @@ Set resource name or id (Required).
|
|||
|
||||
Set resource group (Required if resource's name is used).
|
||||
|
||||
=item B<--resource-type>
|
||||
|
||||
Set resource type (Required if resource's name is used) (Can be: 'storageAccounts').
|
||||
|
||||
=item B<--warning-queuecount-$aggregation$>
|
||||
|
||||
Thresholds warning ($aggregation$ can be: 'average', 'total').
|
|
@ -18,7 +18,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::storage::mode::queuemessagecount;
|
||||
package cloud::azure::storage::storageaccount::mode::queuemessagecount;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
|
@ -66,7 +66,6 @@ sub new {
|
|||
{
|
||||
"resource:s@" => { name => 'resource' },
|
||||
"resource-group:s" => { name => 'resource_group' },
|
||||
"resource-type:s" => { name => 'resource_type' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
|
@ -77,21 +76,21 @@ sub check_options {
|
|||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (!defined($self->{option_results}->{resource})) {
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group and --resource-type options or --resource <id>.");
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group option or --resource <id>.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
$self->{az_resource_group} = '';
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_type} = 'storageAccounts';
|
||||
$self->{az_resource_namespace} = 'Microsoft.Storage';
|
||||
|
||||
foreach my $resource (@{$self->{option_results}->{resource}}) {
|
||||
push @{$self->{az_resource}}, $resource;
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/.*\/.*/) {
|
||||
$self->{az_resource_namespace} = '';
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/storageAccounts\/.*/) {
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_namespace} = '';
|
||||
} else {
|
||||
$self->{az_resource_group} = $self->{option_results}->{resource_group};
|
||||
$self->{az_resource_type} = $self->{option_results}->{resource_type};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,7 +119,7 @@ sub manage_selection {
|
|||
foreach my $resource (@{$self->{az_resource}}) {
|
||||
my $resource_name = $resource;
|
||||
my $namespace_full = '/queueServices/default';
|
||||
if ($resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/.*\/(.*)\/.*\/default$/) {
|
||||
if ($resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/storageAccounts\/(.*)\/.*\/default$/) {
|
||||
$resource_name = $1;
|
||||
$namespace_full = '';
|
||||
}
|
||||
|
@ -161,19 +160,18 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check storage resources queue message count metric.
|
||||
Check storage account resources queue message count metric.
|
||||
|
||||
Example:
|
||||
|
||||
Using resource name :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::plugin --custommode=azcli --mode=queue-message-count
|
||||
--resource=MYFILER --resource-group=MYHOSTGROUP --resource-type=storageAccounts
|
||||
--aggregation='average' --critical-queuemessagecount-average='10' --verbose
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::storageaccount::plugin --custommode=azcli --mode=queue-message-count
|
||||
--resource=MYFILER --resource-group=MYHOSTGROUP --aggregation='average' --critical-queuemessagecount-average='10' --verbose
|
||||
|
||||
Using resource id :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::plugin --custommode=azcli --mode=queue-message-count
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::storageaccount::plugin --custommode=azcli --mode=queue-message-count
|
||||
--resource='/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Storage/storageAccounts/xxx/queueServices/default'
|
||||
--aggregation='average' --critical-queuemessagecount-average='10' --verbose
|
||||
|
||||
|
@ -189,10 +187,6 @@ Set resource name or id (Required).
|
|||
|
||||
Set resource group (Required if resource's name is used).
|
||||
|
||||
=item B<--resource-type>
|
||||
|
||||
Set resource type (Required if resource's name is used) (Can be: 'storageAccounts').
|
||||
|
||||
=item B<--warning-queuemessagecount-$aggregation$>
|
||||
|
||||
Thresholds warning ($aggregation$ can be: 'average', 'total').
|
|
@ -18,7 +18,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::storage::mode::tablecapacity;
|
||||
package cloud::azure::storage::storageaccount::mode::tablecapacity;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
|
@ -67,7 +67,6 @@ sub new {
|
|||
{
|
||||
"resource:s@" => { name => 'resource' },
|
||||
"resource-group:s" => { name => 'resource_group' },
|
||||
"resource-type:s" => { name => 'resource_type' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
|
@ -78,21 +77,21 @@ sub check_options {
|
|||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (!defined($self->{option_results}->{resource})) {
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group and --resource-type options or --resource <id>.");
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group option or --resource <id>.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
$self->{az_resource_group} = '';
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_type} = 'storageAccounts';
|
||||
$self->{az_resource_namespace} = 'Microsoft.Storage';
|
||||
|
||||
foreach my $resource (@{$self->{option_results}->{resource}}) {
|
||||
push @{$self->{az_resource}}, $resource;
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/.*\/.*/) {
|
||||
$self->{az_resource_namespace} = '';
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/storageAccounts\/.*/) {
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_namespace} = '';
|
||||
} else {
|
||||
$self->{az_resource_group} = $self->{option_results}->{resource_group};
|
||||
$self->{az_resource_type} = $self->{option_results}->{resource_type};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,7 +120,7 @@ sub manage_selection {
|
|||
foreach my $resource (@{$self->{az_resource}}) {
|
||||
my $resource_name = $resource;
|
||||
my $namespace_full = '/tableServices/default';
|
||||
if ($resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/.*\/(.*)\/.*\/default$/) {
|
||||
if ($resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/storageAccounts\/(.*)\/.*\/default$/) {
|
||||
$resource_name = $1;
|
||||
$namespace_full = '';
|
||||
}
|
||||
|
@ -162,19 +161,18 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check storage resources table capacity metric.
|
||||
Check storage account resources table capacity metric.
|
||||
|
||||
Example:
|
||||
|
||||
Using resource name :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::plugin --custommode=azcli --mode=table-capacity
|
||||
--resource=MYFILER --resource-group=MYHOSTGROUP --resource-type=storageAccounts
|
||||
--aggregation='average' --critical-tablecapacity-average='10' --verbose
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::storageaccount::plugin --custommode=azcli --mode=table-capacity
|
||||
--resource=MYFILER --resource-group=MYHOSTGROUP --aggregation='average' --critical-tablecapacity-average='10' --verbose
|
||||
|
||||
Using resource id :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::plugin --custommode=azcli --mode=table-capacity
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::storageaccount::plugin --custommode=azcli --mode=table-capacity
|
||||
--resource='/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Storage/storageAccounts/xxx/tableServices/default'
|
||||
--aggregation='average' --critical-tablecapacity-average='10' --verbose
|
||||
|
||||
|
@ -190,10 +188,6 @@ Set resource name or id (Required).
|
|||
|
||||
Set resource group (Required if resource's name is used).
|
||||
|
||||
=item B<--resource-type>
|
||||
|
||||
Set resource type (Required if resource's name is used) (Can be: 'storageAccounts').
|
||||
|
||||
=item B<--warning-tablecapacity-$aggregation$>
|
||||
|
||||
Thresholds warning ($aggregation$ can be: 'average', 'total').
|
|
@ -18,7 +18,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::storage::mode::tablecount;
|
||||
package cloud::azure::storage::storageaccount::mode::tablecount;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
|
@ -66,7 +66,6 @@ sub new {
|
|||
{
|
||||
"resource:s@" => { name => 'resource' },
|
||||
"resource-group:s" => { name => 'resource_group' },
|
||||
"resource-type:s" => { name => 'resource_type' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
|
@ -77,21 +76,21 @@ sub check_options {
|
|||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (!defined($self->{option_results}->{resource})) {
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group and --resource-type options or --resource <id>.");
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group option or --resource <id>.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
$self->{az_resource_group} = '';
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_type} = 'storageAccounts';
|
||||
$self->{az_resource_namespace} = 'Microsoft.Storage';
|
||||
|
||||
foreach my $resource (@{$self->{option_results}->{resource}}) {
|
||||
push @{$self->{az_resource}}, $resource;
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/.*\/.*/) {
|
||||
$self->{az_resource_namespace} = '';
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/storageAccounts\/.*/) {
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_namespace} = '';
|
||||
} else {
|
||||
$self->{az_resource_group} = $self->{option_results}->{resource_group};
|
||||
$self->{az_resource_type} = $self->{option_results}->{resource_type};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,7 +119,7 @@ sub manage_selection {
|
|||
foreach my $resource (@{$self->{az_resource}}) {
|
||||
my $resource_name = $resource;
|
||||
my $namespace_full = '/tableServices/default';
|
||||
if ($resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/.*\/(.*)\/.*\/default$/) {
|
||||
if ($resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/storageAccounts\/(.*)\/.*\/default$/) {
|
||||
$resource_name = $1;
|
||||
$namespace_full = '';
|
||||
}
|
||||
|
@ -161,19 +160,18 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check storage resources table count metric.
|
||||
Check storage account resources table count metric.
|
||||
|
||||
Example:
|
||||
|
||||
Using resource name :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::plugin --custommode=azcli --mode=table-count
|
||||
--resource=MYFILER --resource-group=MYHOSTGROUP --resource-type=storageAccounts
|
||||
--aggregation='average' --critical-tablecount-average='10' --verbose
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::storageaccount::plugin --custommode=azcli --mode=table-count
|
||||
--resource=MYFILER --resource-group=MYHOSTGROUP --aggregation='average' --critical-tablecount-average='10' --verbose
|
||||
|
||||
Using resource id :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::plugin --custommode=azcli --mode=table-count
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::storageaccount::plugin --custommode=azcli --mode=table-count
|
||||
--resource='/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Storage/storageAccounts/xxx/tableServices/default'
|
||||
--aggregation='average' --critical-tablecount-average='10' --verbose
|
||||
|
||||
|
@ -189,10 +187,6 @@ Set resource name or id (Required).
|
|||
|
||||
Set resource group (Required if resource's name is used).
|
||||
|
||||
=item B<--resource-type>
|
||||
|
||||
Set resource type (Required if resource's name is used) (Can be: 'storageAccounts').
|
||||
|
||||
=item B<--warning-tablecount-$aggregation$>
|
||||
|
||||
Thresholds warning ($aggregation$ can be: 'average', 'total').
|
|
@ -18,7 +18,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::storage::mode::tableentitycount;
|
||||
package cloud::azure::storage::storageaccount::mode::tableentitycount;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
|
@ -66,7 +66,6 @@ sub new {
|
|||
{
|
||||
"resource:s@" => { name => 'resource' },
|
||||
"resource-group:s" => { name => 'resource_group' },
|
||||
"resource-type:s" => { name => 'resource_type' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
|
@ -77,21 +76,21 @@ sub check_options {
|
|||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (!defined($self->{option_results}->{resource})) {
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group and --resource-type options or --resource <id>.");
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group option or --resource <id>.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
$self->{az_resource_group} = '';
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_type} = 'storageAccounts';
|
||||
$self->{az_resource_namespace} = 'Microsoft.Storage';
|
||||
|
||||
foreach my $resource (@{$self->{option_results}->{resource}}) {
|
||||
push @{$self->{az_resource}}, $resource;
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/.*\/.*/) {
|
||||
$self->{az_resource_namespace} = '';
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/storageAccounts\/.*/) {
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_namespace} = '';
|
||||
} else {
|
||||
$self->{az_resource_group} = $self->{option_results}->{resource_group};
|
||||
$self->{az_resource_type} = $self->{option_results}->{resource_type};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,7 +119,7 @@ sub manage_selection {
|
|||
foreach my $resource (@{$self->{az_resource}}) {
|
||||
my $resource_name = $resource;
|
||||
my $namespace_full = '/tableServices/default';
|
||||
if ($resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/.*\/(.*)\/.*\/default$/) {
|
||||
if ($resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/storageAccounts\/(.*)\/.*\/default$/) {
|
||||
$resource_name = $1;
|
||||
$namespace_full = '';
|
||||
}
|
||||
|
@ -161,19 +160,18 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check storage resources table entity count metric.
|
||||
Check storage account resources table entity count metric.
|
||||
|
||||
Example:
|
||||
|
||||
Using resource name :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::plugin --custommode=azcli --mode=table-entity-count
|
||||
--resource=MYFILER --resource-group=MYHOSTGROUP --resource-type=storageAccounts
|
||||
--aggregation='average' --critical-tableentitycount-average='10' --verbose
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::storageaccount::plugin --custommode=azcli --mode=table-entity-count
|
||||
--resource=MYFILER --resource-group=MYHOSTGROUP --aggregation='average' --critical-tableentitycount-average='10' --verbose
|
||||
|
||||
Using resource id :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::plugin --custommode=azcli --mode=table-entity-count
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::storageaccount::plugin --custommode=azcli --mode=table-entity-count
|
||||
--resource='/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Storage/storageAccounts/xxx/tableServices/default'
|
||||
--aggregation='average' --critical-tableentitycount-average='10' --verbose
|
||||
|
||||
|
@ -189,10 +187,6 @@ Set resource name or id (Required).
|
|||
|
||||
Set resource group (Required if resource's name is used).
|
||||
|
||||
=item B<--resource-type>
|
||||
|
||||
Set resource type (Required if resource's name is used) (Can be: 'storageAccounts').
|
||||
|
||||
=item B<--warning-tableentitycount-$aggregation$>
|
||||
|
||||
Thresholds warning ($aggregation$ can be: 'average', 'total').
|
|
@ -18,7 +18,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::storage::mode::transactionsavailability;
|
||||
package cloud::azure::storage::storageaccount::mode::transactionsavailability;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
|
@ -70,7 +70,6 @@ sub new {
|
|||
{
|
||||
"resource:s@" => { name => 'resource' },
|
||||
"resource-group:s" => { name => 'resource_group' },
|
||||
"resource-type:s" => { name => 'resource_type' },
|
||||
"resource-namespace:s" => { name => 'resource_namespace' },
|
||||
});
|
||||
|
||||
|
@ -82,21 +81,21 @@ sub check_options {
|
|||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (!defined($self->{option_results}->{resource})) {
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group and --resource-type options or --resource <id>.");
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group option or --resource <id>.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
$self->{az_resource_group} = '';
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_type} = 'storageAccounts';
|
||||
$self->{az_resource_namespace} = 'Microsoft.Storage';
|
||||
|
||||
foreach my $resource (@{$self->{option_results}->{resource}}) {
|
||||
push @{$self->{az_resource}}, $resource;
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/.*\/.*$/) {
|
||||
$self->{az_resource_namespace} = '';
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/storageAccounts\/.*/) {
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_namespace} = '';
|
||||
} else {
|
||||
$self->{az_resource_group} = $self->{option_results}->{resource_group};
|
||||
$self->{az_resource_type} = $self->{option_results}->{resource_type};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,8 +126,8 @@ sub manage_selection {
|
|||
my $resource_name = $resource;
|
||||
my $namespace_full = ($self->{az_resource_extra_namespace} ne '') ? '/' . lc($self->{az_resource_extra_namespace}) . 'Services/default' : '';
|
||||
my $namespace_name = ($self->{az_resource_extra_namespace} ne '') ? $self->{az_resource_extra_namespace} : "Account";
|
||||
if ($resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/.*\/(.*)\/(.*)\/default$/ ||
|
||||
$resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/.*\/(.*)$/) {
|
||||
if ($resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/storageAccounts\/(.*)\/(.*)\/default$/ ||
|
||||
$resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/storageAccounts\/(.*)$/) {
|
||||
$resource_name = $1;
|
||||
$namespace_name = $2 if(defined($2));
|
||||
}
|
||||
|
@ -172,19 +171,19 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check storage resources transaction availability metric.
|
||||
Check storage account resources transaction availability metric.
|
||||
|
||||
Example:
|
||||
|
||||
Using resource name :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::plugin --custommode=azcli --mode=transactions-availability
|
||||
--resource=MYFILER --resource-group=MYHOSTGROUP --resource-type=storageAccounts --resource-namespace=Blob
|
||||
--aggregation='average' --critical-availability-average='10' --verbose
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::storageaccount::plugin --custommode=azcli --mode=transactions-availability
|
||||
--resource=MYFILER --resource-group=MYHOSTGROUP --resource-namespace=Blob --aggregation='average'
|
||||
--critical-availability-average='10' --verbose
|
||||
|
||||
Using resource id :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::plugin --custommode=azcli --mode=transactions-availability
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::storageaccount::plugin --custommode=azcli --mode=transactions-availability
|
||||
--resource='/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Storage/storageAccounts/xxx'
|
||||
--aggregation='average' --critical-availability-average='10' --verbose
|
||||
|
||||
|
@ -200,10 +199,6 @@ Set resource name or id (Required).
|
|||
|
||||
Set resource group (Required if resource's name is used).
|
||||
|
||||
=item B<--resource-type>
|
||||
|
||||
Set resource type (Required if resource's name is used) (Can be: 'storageAccounts').
|
||||
|
||||
=item B<--resource-namespace>
|
||||
|
||||
Set resource namespace (Can be: 'Blob', 'File', 'Table', 'Queue').
|
|
@ -18,7 +18,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::storage::mode::transactionscount;
|
||||
package cloud::azure::storage::storageaccount::mode::transactionscount;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
|
@ -124,7 +124,6 @@ sub new {
|
|||
{
|
||||
"resource:s@" => { name => 'resource' },
|
||||
"resource-group:s" => { name => 'resource_group' },
|
||||
"resource-type:s" => { name => 'resource_type' },
|
||||
"resource-namespace:s" => { name => 'resource_namespace' },
|
||||
"per-sec" => { name => 'per_sec' },
|
||||
});
|
||||
|
@ -137,21 +136,21 @@ sub check_options {
|
|||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (!defined($self->{option_results}->{resource})) {
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group and --resource-type options or --resource <id>.");
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group option or --resource <id>.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
$self->{az_resource_group} = '';
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_type} = 'storageAccounts';
|
||||
$self->{az_resource_namespace} = 'Microsoft.Storage';
|
||||
|
||||
foreach my $resource (@{$self->{option_results}->{resource}}) {
|
||||
push @{$self->{az_resource}}, $resource;
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/.*\/.*/) {
|
||||
$self->{az_resource_namespace} = '';
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/storageAccounts\/.*/) {
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_namespace} = '';
|
||||
} else {
|
||||
$self->{az_resource_group} = $self->{option_results}->{resource_group};
|
||||
$self->{az_resource_type} = $self->{option_results}->{resource_type};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -184,8 +183,8 @@ sub manage_selection {
|
|||
my $resource_name = $resource;
|
||||
my $namespace_full = ($self->{az_resource_extra_namespace} ne '') ? '/' . lc($self->{az_resource_extra_namespace}) . 'Services/default' : '';
|
||||
my $namespace_name = ($self->{az_resource_extra_namespace} ne '') ? $self->{az_resource_extra_namespace} : "Account";
|
||||
if ($resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/.*\/(.*)\/(.*)\/default$/ ||
|
||||
$resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/.*\/(.*)$/) {
|
||||
if ($resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/storageAccounts\/(.*)\/(.*)\/default$/ ||
|
||||
$resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/storageAccounts\/(.*)$/) {
|
||||
$resource_name = $1;
|
||||
$namespace_name = $2 if(defined($2));
|
||||
}
|
||||
|
@ -229,19 +228,19 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check storage resources transaction count metric.
|
||||
Check storage account resources transaction count metric.
|
||||
|
||||
Example:
|
||||
|
||||
Using resource name :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::plugin --custommode=azcli --mode=transactions-count
|
||||
--resource=MYFILER --resource-group=MYHOSTGROUP --resource-type=storageAccounts --resource-namespace=Blob
|
||||
--aggregation='total' --critical-transactions-total='10' --verbose
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::storageaccount::plugin --custommode=azcli --mode=transactions-count
|
||||
--resource=MYFILER --resource-group=MYHOSTGROUP --resource-namespace=Blob --aggregation='total'
|
||||
--critical-transactions-total='10' --verbose
|
||||
|
||||
Using resource id :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::plugin --custommode=azcli --mode=transactions-count
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::storageaccount::plugin --custommode=azcli --mode=transactions-count
|
||||
--resource='/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Storage/storageAccounts/xxx'
|
||||
--aggregation='total' --critical-transactions-total='10' --verbose
|
||||
|
||||
|
@ -257,10 +256,6 @@ Set resource name or id (Required).
|
|||
|
||||
Set resource group (Required if resource's name is used).
|
||||
|
||||
=item B<--resource-type>
|
||||
|
||||
Set resource type (Required if resource's name is used) (Can be: 'storageAccounts').
|
||||
|
||||
=item B<--resource-namespace>
|
||||
|
||||
Set resource namespace (Can be: 'Blob', 'File', 'Table', 'Queue').
|
|
@ -18,7 +18,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::storage::mode::transactionslatency;
|
||||
package cloud::azure::storage::storageaccount::mode::transactionslatency;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
|
@ -72,7 +72,6 @@ sub new {
|
|||
{
|
||||
"resource:s@" => { name => 'resource' },
|
||||
"resource-group:s" => { name => 'resource_group' },
|
||||
"resource-type:s" => { name => 'resource_type' },
|
||||
"resource-namespace:s" => { name => 'resource_namespace' },
|
||||
"filter-metric:s" => { name => 'filter_metric' },
|
||||
});
|
||||
|
@ -85,21 +84,21 @@ sub check_options {
|
|||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (!defined($self->{option_results}->{resource})) {
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group and --resource-type options or --resource <id>.");
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group option or --resource <id>.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
$self->{az_resource_group} = '';
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_type} = 'storageAccounts';
|
||||
$self->{az_resource_namespace} = 'Microsoft.Storage';
|
||||
|
||||
foreach my $resource (@{$self->{option_results}->{resource}}) {
|
||||
push @{$self->{az_resource}}, $resource;
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/.*\/.*/) {
|
||||
$self->{az_resource_namespace} = '';
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/storageAccounts\/.*/) {
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_namespace} = '';
|
||||
} else {
|
||||
$self->{az_resource_group} = $self->{option_results}->{resource_group};
|
||||
$self->{az_resource_type} = $self->{option_results}->{resource_type};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -135,8 +134,8 @@ sub manage_selection {
|
|||
my $resource_name = $resource;
|
||||
my $namespace_full = ($self->{az_resource_extra_namespace} ne '') ? '/' . lc($self->{az_resource_extra_namespace}) . 'Services/default' : '';
|
||||
my $namespace_name = ($self->{az_resource_extra_namespace} ne '') ? $self->{az_resource_extra_namespace} : "Account";
|
||||
if ($resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/.*\/(.*)\/(.*)\/default$/ ||
|
||||
$resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/.*\/(.*)$/) {
|
||||
if ($resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/storageAccounts\/(.*)\/(.*)\/default$/ ||
|
||||
$resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/storageAccounts\/(.*)$/) {
|
||||
$resource_name = $1;
|
||||
$namespace_name = $2 if(defined($2));
|
||||
}
|
||||
|
@ -180,19 +179,19 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check storage resources transaction latency metrics.
|
||||
Check storage account resources transaction latency metrics.
|
||||
|
||||
Example:
|
||||
|
||||
Using resource name :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::plugin --custommode=azcli --mode=transactions-latency
|
||||
--resource=MYFILER --resource-group=MYHOSTGROUP --resource-type=storageAccounts --resource-namespace=Blob
|
||||
--aggregation='average' --critical-successserverlatency-average='10' --verbose
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::storageaccount::plugin --custommode=azcli --mode=transactions-latency
|
||||
--resource=MYFILER --resource-group=MYHOSTGROUP --resource-namespace=Blob --aggregation='average'
|
||||
--critical-successserverlatency-average='10' --verbose
|
||||
|
||||
Using resource id :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::plugin --custommode=azcli --mode=transactions-latency
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::storageaccount::plugin --custommode=azcli --mode=transactions-latency
|
||||
--resource='/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Storage/storageAccounts/xxx'
|
||||
--aggregation='average' --critical-successserverlatency-average='10' --verbose
|
||||
|
||||
|
@ -208,10 +207,6 @@ Set resource name or id (Required).
|
|||
|
||||
Set resource group (Required if resource's name is used).
|
||||
|
||||
=item B<--resource-type>
|
||||
|
||||
Set resource type (Required if resource's name is used) (Can be: 'storageAccounts').
|
||||
|
||||
=item B<--resource-namespace>
|
||||
|
||||
Set resource namespace (Can be: 'Blob', 'File', 'Table', 'Queue').
|
|
@ -18,7 +18,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::storage::mode::transactionsthroughput;
|
||||
package cloud::azure::storage::storageaccount::mode::transactionsthroughput;
|
||||
|
||||
use base qw(centreon::plugins::templates::counter);
|
||||
|
||||
|
@ -126,7 +126,6 @@ sub new {
|
|||
{
|
||||
"resource:s@" => { name => 'resource' },
|
||||
"resource-group:s" => { name => 'resource_group' },
|
||||
"resource-type:s" => { name => 'resource_type' },
|
||||
"resource-namespace:s" => { name => 'resource_namespace' },
|
||||
"filter-metric:s" => { name => 'filter_metric' },
|
||||
"per-sec" => { name => 'per_sec' },
|
||||
|
@ -140,21 +139,21 @@ sub check_options {
|
|||
$self->SUPER::check_options(%options);
|
||||
|
||||
if (!defined($self->{option_results}->{resource})) {
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group and --resource-type options or --resource <id>.");
|
||||
$self->{output}->add_option_msg(short_msg => "Need to specify either --resource <name> with --resource-group option or --resource <id>.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
|
||||
$self->{az_resource_group} = '';
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_type} = 'storageAccounts';
|
||||
$self->{az_resource_namespace} = 'Microsoft.Storage';
|
||||
|
||||
foreach my $resource (@{$self->{option_results}->{resource}}) {
|
||||
push @{$self->{az_resource}}, $resource;
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/.*\/.*/) {
|
||||
$self->{az_resource_namespace} = '';
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/storageAccounts\/.*/) {
|
||||
$self->{az_resource_type} = '';
|
||||
$self->{az_resource_namespace} = '';
|
||||
} else {
|
||||
$self->{az_resource_group} = $self->{option_results}->{resource_group};
|
||||
$self->{az_resource_type} = $self->{option_results}->{resource_type};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -190,8 +189,8 @@ sub manage_selection {
|
|||
my $resource_name = $resource;
|
||||
my $namespace_full = ($self->{az_resource_extra_namespace} ne '') ? '/' . lc($self->{az_resource_extra_namespace}) . 'Services/default' : '';
|
||||
my $namespace_name = ($self->{az_resource_extra_namespace} ne '') ? $self->{az_resource_extra_namespace} : "Account";
|
||||
if ($resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/.*\/(.*)\/(.*)\/default$/ ||
|
||||
$resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/.*\/(.*)$/) {
|
||||
if ($resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/storageAccounts\/(.*)\/(.*)\/default$/ ||
|
||||
$resource_name =~ /^\/subscriptions\/.*\/resourceGroups\/.*\/providers\/Microsoft\.Storage\/storageAccounts\/(.*)$/) {
|
||||
$resource_name = $1;
|
||||
$namespace_name = $2 if(defined($2));
|
||||
}
|
||||
|
@ -235,19 +234,18 @@ __END__
|
|||
|
||||
=head1 MODE
|
||||
|
||||
Check storage resources transaction throughput metrics.
|
||||
Check storage account resources transaction throughput metrics.
|
||||
|
||||
Example:
|
||||
|
||||
Using resource name :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::plugin --custommode=azcli --mode=transactions-throughput
|
||||
--resource=MYFILER --resource-group=MYHOSTGROUP --resource-type=storageAccounts --resource-namespace=Blob
|
||||
--aggregation='total' --critical-egress-total='10' --verbose
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::storageaccount::plugin --custommode=azcli --mode=transactions-throughput
|
||||
--resource=MYFILER --resource-group=MYHOSTGROUP--resource-namespace=Blob --aggregation='total' --critical-egress-total='10' --verbose
|
||||
|
||||
Using resource id :
|
||||
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::plugin --custommode=azcli --mode=transactions-throughput
|
||||
perl centreon_plugins.pl --plugin=cloud::azure::storage::storageaccount::plugin --custommode=azcli --mode=transactions-throughput
|
||||
--resource='/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Storage/storageAccounts/xxx'
|
||||
--aggregation='total' --critical-egress-total='10' --verbose
|
||||
|
||||
|
@ -263,10 +261,6 @@ Set resource name or id (Required).
|
|||
|
||||
Set resource group (Required if resource's name is used).
|
||||
|
||||
=item B<--resource-type>
|
||||
|
||||
Set resource type (Required if resource's name is used) (Can be: 'storageAccounts').
|
||||
|
||||
=item B<--resource-namespace>
|
||||
|
||||
Set resource namespace (Can be: 'Blob', 'File', 'Table', 'Queue').
|
|
@ -0,0 +1,66 @@
|
|||
#
|
||||
# Copyright 2018 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::storage::storageaccount::plugin;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use base qw(centreon::plugins::script_custom);
|
||||
|
||||
sub new {
|
||||
my ( $class, %options ) = @_;
|
||||
my $self = $class->SUPER::new( package => __PACKAGE__, %options );
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '0.1';
|
||||
%{ $self->{modes} } = (
|
||||
'account-used-capacity' => 'cloud::azure::storage::storageaccount::mode::accountusedcapacity',
|
||||
'blob-capacity' => 'cloud::azure::storage::storageaccount::mode::blobcapacity',
|
||||
'blob-container-count' => 'cloud::azure::storage::storageaccount::mode::blobcontainercount',
|
||||
'blob-count' => 'cloud::azure::storage::storageaccount::mode::blobcount',
|
||||
'file-capacity' => 'cloud::azure::storage::storageaccount::mode::filecapacity',
|
||||
'file-count' => 'cloud::azure::storage::storageaccount::mode::filecount',
|
||||
'file-share-count' => 'cloud::azure::storage::storageaccount::mode::filesharecount',
|
||||
'list-resources' => 'cloud::azure::storage::storageaccount::mode::listresources',
|
||||
'queue-capacity' => 'cloud::azure::storage::storageaccount::mode::queuecapacity',
|
||||
'queue-count' => 'cloud::azure::storage::storageaccount::mode::queuecount',
|
||||
'queue-message-count' => 'cloud::azure::storage::storageaccount::mode::queuemessagecount',
|
||||
'table-capacity' => 'cloud::azure::storage::storageaccount::mode::tablecapacity',
|
||||
'table-count' => 'cloud::azure::storage::storageaccount::mode::tablecount',
|
||||
'table-entity-count' => 'cloud::azure::storage::storageaccount::mode::tableentitycount',
|
||||
'transactions-availability' => 'cloud::azure::storage::storageaccount::mode::transactionsavailability',
|
||||
'transactions-count' => 'cloud::azure::storage::storageaccount::mode::transactionscount',
|
||||
'transactions-latency' => 'cloud::azure::storage::storageaccount::mode::transactionslatency',
|
||||
'transactions-throughput' => 'cloud::azure::storage::storageaccount::mode::transactionsthroughput',
|
||||
);
|
||||
|
||||
$self->{custom_modes}{azcli} = 'cloud::azure::custom::azcli';
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 PLUGIN DESCRIPTION
|
||||
|
||||
Check Microsoft Azure storage account.
|
||||
|
||||
=cut
|
Loading…
Reference in New Issue