change output for human and add filter metric for fsquota (#4009)

This commit is contained in:
lchrdn 2022-10-21 14:49:03 +02:00 committed by GitHub
parent 7f8ec50903
commit e7c65871b2
1 changed files with 6 additions and 2 deletions

View File

@ -43,10 +43,11 @@ sub set_counters {
my $metric_label = lc($metric);
my $entry = { label => 'filesharequota' . '-' . $aggregation, set => {
key_values => [ { name => $metric_label . '_' . $aggregation }, { name => 'display' }, { name => 'stat' } ],
output_template => $metric . ': %s',
output_template => $metric . ': %s %s',
output_change_bytes => 1,
perfdatas => [
{ label => $metric_label . '_' . $aggregation, value => $metric_label . '_' . $aggregation ,
template => '%s', label_extra_instance => 1, instance_use => 'display',
template => '%s', unit => 'B', label_extra_instance => 1, instance_use => 'display',
min => 0 },
],
}
@ -63,6 +64,7 @@ sub new {
$options{options}->add_options(arguments =>
{
"filter-dimension:s" => { name => 'filter_dimension' },
"resource:s@" => { name => 'resource' },
"resource-group:s" => { name => 'resource_group' },
"resource-namespace:s" => { name => 'resource_namespace' }
@ -84,6 +86,7 @@ sub check_options {
$self->{az_resource_group} = $self->{option_results}->{resource_group} if (defined($self->{option_results}->{resource_group}));
$self->{az_resource_type} = 'storageAccounts';
$self->{az_resource_namespace} = defined($self->{option_results}->{resource_namespace}) ? $self->{option_results}->{resource_namespace} : 'Microsoft.Storage';
$self->{az_dimension} = $self->{option_results}->{filter_dimension} if (defined($self->{option_results}->{filter_dimension}));
$self->{az_timeframe} = defined($self->{option_results}->{timeframe}) ? $self->{option_results}->{timeframe} : 3600;
$self->{az_interval} = defined($self->{option_results}->{interval}) ? $self->{option_results}->{interval} : "PT1H";
$self->{az_aggregations} = ['Average'];
@ -125,6 +128,7 @@ sub manage_selection {
resource_group => $resource_group,
resource_type => $self->{az_resource_type},
resource_namespace => $self->{az_resource_namespace},
dimension => $self->{az_dimension},
metrics => $self->{az_metrics},
aggregations => $self->{az_aggregations},
timeframe => $self->{az_timeframe},