diff --git a/network/arista/snmp/mode/memory.pm b/network/arista/snmp/mode/memory.pm index a94d354b7..a5731ede3 100644 --- a/network/arista/snmp/mode/memory.pm +++ b/network/arista/snmp/mode/memory.pm @@ -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);