fix arista memory output (#1048)

This commit is contained in:
Colin Gagnaire 2018-07-12 12:01:33 +02:00 committed by GitHub
parent 97672a5339
commit 4c3e1dce93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 0 deletions

View File

@ -31,6 +31,31 @@ sub default_storage_type {
return '^(hrStorageRam|hrStorageFlashMemory)';
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'storage', type => 1, cb_prefix_output => 'prefix_storage_output', message_multiple => 'All memory spaces are ok' },
];
$self->{maps_counters}->{storage} = [
{ label => 'usage', set => {
key_values => [ { name => 'display' }, { name => 'used' }, { name => 'size' }, { name => 'allocation_units' } ],
closure_custom_calc => $self->can('custom_usage_calc'),
closure_custom_output => $self->can('custom_usage_output'),
closure_custom_perfdata => $self->can('custom_usage_perfdata'),
closure_custom_threshold_check => $self->can('custom_usage_threshold'),
}
},
];
}
sub prefix_storage_output {
my ($self, %options) = @_;
return "Memory space '" . $options{instance_value}->{display} . "' ";
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);