fix azure plugin typos, helpers and other (#1159)

* fix several typos

* fix several typos, helpers, and other
This commit is contained in:
Colin Gagnaire 2018-09-28 16:56:17 +02:00 committed by GitHub
parent edad8be10e
commit 0b6dc7ccb6
29 changed files with 58 additions and 58 deletions

View File

@ -85,7 +85,7 @@ sub new {
$options{options}->add_options(arguments => $options{options}->add_options(arguments =>
{ {
"resource:s@" => { name => 'resource' }, "resource:s@" => { name => 'resource' },
"resource-group:s" => { name => 'resource_group' }, "resource-group:s" => { name => 'resource_group' },
"filter-metric:s" => { name => 'filter_metric' }, "filter-metric:s" => { name => 'filter_metric' },
}); });

View File

@ -164,9 +164,9 @@ sub new {
$options{options}->add_options(arguments => $options{options}->add_options(arguments =>
{ {
"resource:s@" => { name => 'resource' }, "resource:s@" => { name => 'resource' },
"resource-group:s" => { name => 'resource_group' }, "resource-group:s" => { name => 'resource_group' },
"filter-metric:s" => { name => 'filter_metric' }, "filter-metric:s" => { name => 'filter_metric' },
"per-sec" => { name => 'per_sec' }, "per-sec" => { name => 'per_sec' },
}); });
return $self; return $self;
@ -198,7 +198,7 @@ sub check_options {
$self->{az_timeframe} = defined($self->{option_results}->{timeframe}) ? $self->{option_results}->{timeframe} : 900; $self->{az_timeframe} = defined($self->{option_results}->{timeframe}) ? $self->{option_results}->{timeframe} : 900;
$self->{az_interval} = defined($self->{option_results}->{interval}) ? $self->{option_results}->{interval} : "PT5M"; $self->{az_interval} = defined($self->{option_results}->{interval}) ? $self->{option_results}->{interval} : "PT5M";
$self->{az_aggregations} = ['Total', 'Average']; $self->{az_aggregations} = ['Average'];
if (defined($self->{option_results}->{aggregation})) { if (defined($self->{option_results}->{aggregation})) {
$self->{az_aggregations} = []; $self->{az_aggregations} = [];
foreach my $stat (@{$self->{option_results}->{aggregation}}) { foreach my $stat (@{$self->{option_results}->{aggregation}}) {

View File

@ -33,8 +33,8 @@ sub new {
$self->{version} = '1.0'; $self->{version} = '1.0';
$options{options}->add_options(arguments => $options{options}->add_options(arguments =>
{ {
"resource-group:s" => { name => 'resource_group' }, "resource-group:s" => { name => 'resource_group' },
"filter-name:s" => { name => 'filter_name' }, "filter-name:s" => { name => 'filter_name' },
}); });
return $self; return $self;

View File

@ -123,9 +123,9 @@ sub new {
$options{options}->add_options(arguments => $options{options}->add_options(arguments =>
{ {
"resource:s@" => { name => 'resource' }, "resource:s@" => { name => 'resource' },
"resource-group:s" => { name => 'resource_group' }, "resource-group:s" => { name => 'resource_group' },
"filter-metric:s" => { name => 'filter_metric' }, "filter-metric:s" => { name => 'filter_metric' },
"per-sec" => { name => 'per_sec' }, "per-sec" => { name => 'per_sec' },
}); });
return $self; return $self;

View File

@ -93,8 +93,8 @@ sub new {
$options{options}->add_options(arguments => $options{options}->add_options(arguments =>
{ {
"resource:s" => { name => 'resource' }, "resource:s" => { name => 'resource' },
"resource-group:s" => { name => 'resource_group' }, "resource-group:s" => { name => 'resource_group' },
"resource-type:s" => { name => 'resource_type' }, "resource-type:s" => { name => 'resource_type' },
"resource-namespace:s" => { name => 'resource_namespace' }, "resource-namespace:s" => { name => 'resource_namespace' },
"metric:s@" => { name => 'metric' }, "metric:s@" => { name => 'metric' },
}); });

View File

@ -172,12 +172,12 @@ Filter resource name (Can be a regexp).
=item B<--warning-*> =item B<--warning-*>
Threshold warning. Threshold warning.
Can be: 'items'. Can be: 'total', 'compute', 'storage', 'network'.
=item B<--critical-*> =item B<--critical-*>
Threshold critical. Threshold critical.
Can be: 'items'. Can be: 'total', 'compute', 'storage', 'network'.
=back =back

View File

@ -33,8 +33,8 @@ sub new {
$self->{version} = '1.0'; $self->{version} = '1.0';
$options{options}->add_options(arguments => $options{options}->add_options(arguments =>
{ {
"location:s" => { name => 'location' }, "location:s" => { name => 'location' },
"filter-name:s" => { name => 'filter_name' }, "filter-name:s" => { name => 'filter_name' },
}); });
return $self; return $self;

View File

@ -33,10 +33,10 @@ sub new {
$self->{version} = '1.0'; $self->{version} = '1.0';
$options{options}->add_options(arguments => $options{options}->add_options(arguments =>
{ {
"resource-group:s" => { name => 'resource_group' }, "resource-group:s" => { name => 'resource_group' },
"location:s" => { name => 'location' }, "location:s" => { name => 'location' },
"filter-type:s" => { name => 'filter_type' }, "filter-type:s" => { name => 'filter_type' },
"filter-name:s" => { name => 'filter_name' }, "filter-name:s" => { name => 'filter_name' },
}); });
return $self; return $self;

View File

@ -33,9 +33,9 @@ sub new {
$self->{version} = '1.0'; $self->{version} = '1.0';
$options{options}->add_options(arguments => $options{options}->add_options(arguments =>
{ {
"resource-group:s" => { name => 'resource_group' }, "resource-group:s" => { name => 'resource_group' },
"location:s" => { name => 'location' }, "location:s" => { name => 'location' },
"filter-name:s" => { name => 'filter_name' }, "filter-name:s" => { name => 'filter_name' },
}); });
return $self; return $self;

View File

@ -168,9 +168,9 @@ sub new {
$options{options}->add_options(arguments => $options{options}->add_options(arguments =>
{ {
"resource:s@" => { name => 'resource' }, "resource:s@" => { name => 'resource' },
"resource-group:s" => { name => 'resource_group' }, "resource-group:s" => { name => 'resource_group' },
"filter-metric:s" => { name => 'filter_metric' }, "filter-metric:s" => { name => 'filter_metric' },
"per-sec" => { name => 'per_sec' }, "per-sec" => { name => 'per_sec' },
}); });
return $self; return $self;
@ -187,7 +187,7 @@ sub check_options {
$self->{az_resource_group} = ''; $self->{az_resource_group} = '';
$self->{az_resource_type} = 'networkInterfaces'; $self->{az_resource_type} = 'networkInterfaces';
$self->{az_resource_namespace} = 'Microsoft.Compute'; $self->{az_resource_namespace} = 'Microsoft.Network';
foreach my $resource (@{$self->{option_results}->{resource}}) { foreach my $resource (@{$self->{option_results}->{resource}}) {
push @{$self->{az_resource}}, $resource; push @{$self->{az_resource}}, $resource;

View File

@ -32,7 +32,7 @@ sub new {
$self->{version} = '0.1'; $self->{version} = '0.1';
%{ $self->{modes} } = ( %{ $self->{modes} } = (
'list-resources' => 'cloud::azure::network::networkinterface::mode::listresources', 'list-resources' => 'cloud::azure::network::networkinterface::mode::listresources',
'throughput' => 'cloud::azure::network::networkinterface::mode::traffic', 'traffic' => 'cloud::azure::network::networkinterface::mode::traffic',
); );
$self->{custom_modes}{azcli} = 'cloud::azure::custom::azcli'; $self->{custom_modes}{azcli} = 'cloud::azure::custom::azcli';

View File

@ -66,7 +66,7 @@ sub new {
$options{options}->add_options(arguments => $options{options}->add_options(arguments =>
{ {
"resource:s@" => { name => 'resource' }, "resource:s@" => { name => 'resource' },
"resource-group:s" => { name => 'resource_group' }, "resource-group:s" => { name => 'resource_group' },
}); });
return $self; return $self;

View File

@ -66,7 +66,7 @@ sub new {
$options{options}->add_options(arguments => $options{options}->add_options(arguments =>
{ {
"resource:s@" => { name => 'resource' }, "resource:s@" => { name => 'resource' },
"resource-group:s" => { name => 'resource_group' }, "resource-group:s" => { name => 'resource_group' },
}); });
return $self; return $self;

View File

@ -65,7 +65,7 @@ sub new {
$options{options}->add_options(arguments => $options{options}->add_options(arguments =>
{ {
"resource:s@" => { name => 'resource' }, "resource:s@" => { name => 'resource' },
"resource-group:s" => { name => 'resource_group' }, "resource-group:s" => { name => 'resource_group' },
}); });
return $self; return $self;

View File

@ -65,7 +65,7 @@ sub new {
$options{options}->add_options(arguments => $options{options}->add_options(arguments =>
{ {
"resource:s@" => { name => 'resource' }, "resource:s@" => { name => 'resource' },
"resource-group:s" => { name => 'resource_group' }, "resource-group:s" => { name => 'resource_group' },
}); });
return $self; return $self;
@ -167,13 +167,13 @@ Example:
Using resource name : Using resource name :
perl centreon_plugins.pl --plugin=cloud::azure::storage::storageaccount::plugin --custommode=azcli --mode=blob-capacity 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 --resource=MYFILER --resource-group=MYHOSTGROUP --aggregation='total' --critical-blobcount-total='10' --verbose
Using resource id : Using resource id :
perl centreon_plugins.pl --plugin=cloud::azure::storage::storageaccount::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' --resource='/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Storage/storageAccounts/xxx/blobServices/default'
--aggregation='total' --critical-blobcapacity-total='10' --verbose --aggregation='total' --critical-blobcount-total='10' --verbose
Default aggregation: 'total' / Only total is valid. Default aggregation: 'total' / Only total is valid.
@ -187,11 +187,11 @@ Set resource name or id (Required).
Set resource group (Required if resource's name is used). Set resource group (Required if resource's name is used).
=item B<--warning-blobcapacity-total> =item B<--warning-blobcount-total>
Thresholds warning Thresholds warning
=item B<--critical-blobcapacity-total> =item B<--critical-blobcount-total>
Thresholds critical Thresholds critical

View File

@ -66,7 +66,7 @@ sub new {
$options{options}->add_options(arguments => $options{options}->add_options(arguments =>
{ {
"resource:s@" => { name => 'resource' }, "resource:s@" => { name => 'resource' },
"resource-group:s" => { name => 'resource_group' }, "resource-group:s" => { name => 'resource_group' },
}); });
return $self; return $self;
@ -176,7 +176,7 @@ perl centreon_plugins.pl --plugin=cloud::azure::storage::storageaccount::plugin
--resource='/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Storage/storageAccounts/xxx/fileServices/default' --resource='/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Storage/storageAccounts/xxx/fileServices/default'
--aggregation='average' --critical-filecapacity-average='10' --verbose --aggregation='average' --critical-filecapacity-average='10' --verbose
Default aggregation: 'average' /Total and average are valid. Default aggregation: 'average' / Total and average are valid.
=over 8 =over 8

View File

@ -65,7 +65,7 @@ sub new {
$options{options}->add_options(arguments => $options{options}->add_options(arguments =>
{ {
"resource:s@" => { name => 'resource' }, "resource:s@" => { name => 'resource' },
"resource-group:s" => { name => 'resource_group' }, "resource-group:s" => { name => 'resource_group' },
}); });
return $self; return $self;

View File

@ -65,7 +65,7 @@ sub new {
$options{options}->add_options(arguments => $options{options}->add_options(arguments =>
{ {
"resource:s@" => { name => 'resource' }, "resource:s@" => { name => 'resource' },
"resource-group:s" => { name => 'resource_group' }, "resource-group:s" => { name => 'resource_group' },
}); });
return $self; return $self;

View File

@ -33,9 +33,9 @@ sub new {
$self->{version} = '1.0'; $self->{version} = '1.0';
$options{options}->add_options(arguments => $options{options}->add_options(arguments =>
{ {
"resource-group:s" => { name => 'resource_group' }, "resource-group:s" => { name => 'resource_group' },
"location:s" => { name => 'location' }, "location:s" => { name => 'location' },
"filter-name:s" => { name => 'filter_name' }, "filter-name:s" => { name => 'filter_name' },
}); });
return $self; return $self;

View File

@ -66,7 +66,7 @@ sub new {
$options{options}->add_options(arguments => $options{options}->add_options(arguments =>
{ {
"resource:s@" => { name => 'resource' }, "resource:s@" => { name => 'resource' },
"resource-group:s" => { name => 'resource_group' }, "resource-group:s" => { name => 'resource_group' },
}); });
return $self; return $self;
@ -176,7 +176,7 @@ perl centreon_plugins.pl --plugin=cloud::azure::storage::storageaccount::plugin
--resource='/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Storage/storageAccounts/xxx/queueServices/default' --resource='/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Storage/storageAccounts/xxx/queueServices/default'
--aggregation='average' --critical-queuecapacity-average='10' --verbose --aggregation='average' --critical-queuecapacity-average='10' --verbose
Default aggregation: 'average' /Total and average are valid. Default aggregation: 'average' / Total and average are valid.
=over 8 =over 8

View File

@ -65,7 +65,7 @@ sub new {
$options{options}->add_options(arguments => $options{options}->add_options(arguments =>
{ {
"resource:s@" => { name => 'resource' }, "resource:s@" => { name => 'resource' },
"resource-group:s" => { name => 'resource_group' }, "resource-group:s" => { name => 'resource_group' },
}); });
return $self; return $self;

View File

@ -65,7 +65,7 @@ sub new {
$options{options}->add_options(arguments => $options{options}->add_options(arguments =>
{ {
"resource:s@" => { name => 'resource' }, "resource:s@" => { name => 'resource' },
"resource-group:s" => { name => 'resource_group' }, "resource-group:s" => { name => 'resource_group' },
}); });
return $self; return $self;

View File

@ -66,7 +66,7 @@ sub new {
$options{options}->add_options(arguments => $options{options}->add_options(arguments =>
{ {
"resource:s@" => { name => 'resource' }, "resource:s@" => { name => 'resource' },
"resource-group:s" => { name => 'resource_group' }, "resource-group:s" => { name => 'resource_group' },
}); });
return $self; return $self;
@ -176,7 +176,7 @@ perl centreon_plugins.pl --plugin=cloud::azure::storage::storageaccount::plugin
--resource='/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Storage/storageAccounts/xxx/tableServices/default' --resource='/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Storage/storageAccounts/xxx/tableServices/default'
--aggregation='average' --critical-tablecapacity-average='10' --verbose --aggregation='average' --critical-tablecapacity-average='10' --verbose
Default aggregation: 'average' /Total and average are valid. Default aggregation: 'average' / Total and average are valid.
=over 8 =over 8

View File

@ -65,7 +65,7 @@ sub new {
$options{options}->add_options(arguments => $options{options}->add_options(arguments =>
{ {
"resource:s@" => { name => 'resource' }, "resource:s@" => { name => 'resource' },
"resource-group:s" => { name => 'resource_group' }, "resource-group:s" => { name => 'resource_group' },
}); });
return $self; return $self;

View File

@ -65,7 +65,7 @@ sub new {
$options{options}->add_options(arguments => $options{options}->add_options(arguments =>
{ {
"resource:s@" => { name => 'resource' }, "resource:s@" => { name => 'resource' },
"resource-group:s" => { name => 'resource_group' }, "resource-group:s" => { name => 'resource_group' },
}); });
return $self; return $self;

View File

@ -47,11 +47,11 @@ sub set_counters {
my $metric_label = lc($metric); my $metric_label = lc($metric);
my $entry = { label => $metric_label . '-' . $aggregation, set => { my $entry = { label => $metric_label . '-' . $aggregation, set => {
key_values => [ { name => $metric_label . '_' . $aggregation }, { name => 'display' }, { name => 'stat' } ], key_values => [ { name => $metric_label . '_' . $aggregation }, { name => 'display' }, { name => 'stat' } ],
output_template => $metric . ': %.2f', output_template => $metric . ': %.2f %%',
perfdatas => [ perfdatas => [
{ label => $metric_label . '_' . $aggregation, value => $metric_label . '_' . $aggregation . '_absolute', { label => $metric_label . '_' . $aggregation, value => $metric_label . '_' . $aggregation . '_absolute',
template => '%.2f', label_extra_instance => 1, instance_use => 'display_absolute', template => '%.2f', label_extra_instance => 1, instance_use => 'display_absolute',
min => 0 }, unit => '%', min => 0, max => 100 },
], ],
} }
}; };
@ -69,7 +69,7 @@ sub new {
$options{options}->add_options(arguments => $options{options}->add_options(arguments =>
{ {
"resource:s@" => { name => 'resource' }, "resource:s@" => { name => 'resource' },
"resource-group:s" => { name => 'resource_group' }, "resource-group:s" => { name => 'resource_group' },
"resource-namespace:s" => { name => 'resource_namespace' }, "resource-namespace:s" => { name => 'resource_namespace' },
}); });

View File

@ -123,9 +123,9 @@ sub new {
$options{options}->add_options(arguments => $options{options}->add_options(arguments =>
{ {
"resource:s@" => { name => 'resource' }, "resource:s@" => { name => 'resource' },
"resource-group:s" => { name => 'resource_group' }, "resource-group:s" => { name => 'resource_group' },
"resource-namespace:s" => { name => 'resource_namespace' }, "resource-namespace:s" => { name => 'resource_namespace' },
"per-sec" => { name => 'per_sec' }, "per-sec" => { name => 'per_sec' },
}); });
return $self; return $self;

View File

@ -71,7 +71,7 @@ sub new {
$options{options}->add_options(arguments => $options{options}->add_options(arguments =>
{ {
"resource:s@" => { name => 'resource' }, "resource:s@" => { name => 'resource' },
"resource-group:s" => { name => 'resource_group' }, "resource-group:s" => { name => 'resource_group' },
"resource-namespace:s" => { name => 'resource_namespace' }, "resource-namespace:s" => { name => 'resource_namespace' },
"filter-metric:s" => { name => 'filter_metric' }, "filter-metric:s" => { name => 'filter_metric' },
}); });

View File

@ -82,10 +82,10 @@ sub custom_usage_output {
if (defined($instance_mode->{option_results}->{per_sec})) { if (defined($instance_mode->{option_results}->{per_sec})) {
my ($value, $unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{value_per_sec}); my ($value, $unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{value_per_sec});
$msg = $self->{result_values}->{metric_name} . ": " . $value . $unit . "/s"; $msg = $self->{result_values}->{metric_name} . ": " . $value . ' ' . $unit . "/s";
} else { } else {
my ($value, $unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{value}); my ($value, $unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{value});
$msg = $self->{result_values}->{metric_name} . ": " . $value . $unit; $msg = $self->{result_values}->{metric_name} . ": " . $value . ' ' . $unit;
} }
return $msg; return $msg;
} }
@ -125,10 +125,10 @@ sub new {
$options{options}->add_options(arguments => $options{options}->add_options(arguments =>
{ {
"resource:s@" => { name => 'resource' }, "resource:s@" => { name => 'resource' },
"resource-group:s" => { name => 'resource_group' }, "resource-group:s" => { name => 'resource_group' },
"resource-namespace:s" => { name => 'resource_namespace' }, "resource-namespace:s" => { name => 'resource_namespace' },
"filter-metric:s" => { name => 'filter_metric' }, "filter-metric:s" => { name => 'filter_metric' },
"per-sec" => { name => 'per_sec' }, "per-sec" => { name => 'per_sec' },
}); });
return $self; return $self;