Update memory.pm
This commit is contained in:
parent
cbeaf931ac
commit
b274a0e509
|
@ -43,8 +43,7 @@ sub set_counters {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
$self->{maps_counters_type} = [
|
$self->{maps_counters_type} = [
|
||||||
{ name => 'memory', type => 0, cb_prefix_output => 'prefix_memory_output' },
|
{ name => 'memory', type => 0, cb_prefix_output => 'prefix_memory_output' }
|
||||||
{ name => 'flash', type => 0, cb_prefix_output => 'prefix_flash_output' }
|
|
||||||
];
|
];
|
||||||
|
|
||||||
$self->{maps_counters}->{memory} = [
|
$self->{maps_counters}->{memory} = [
|
||||||
|
@ -59,18 +58,6 @@ sub set_counters {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
$self->{maps_counters}->{flash} = [
|
|
||||||
{ label => 'flash', set => {
|
|
||||||
key_values => [ { name => 'prct_used' }, { name => 'used' }, { name => 'free' }, { name => 'total' } ],
|
|
||||||
closure_custom_output => $self->can('custom_usage_output'),
|
|
||||||
threshold_use => 'prct_used_absolute',
|
|
||||||
perfdatas => [
|
|
||||||
{ label => 'flash', value => 'used_absolute', template => '%.2f', threshold_total => 'total_absolute', cast_int => 1,
|
|
||||||
min => 0, max => 'total_absolute', unit => 'B' },
|
|
||||||
],
|
|
||||||
}
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub prefix_memory_output {
|
sub prefix_memory_output {
|
||||||
|
@ -79,12 +66,6 @@ sub prefix_memory_output {
|
||||||
return "Memory ";
|
return "Memory ";
|
||||||
}
|
}
|
||||||
|
|
||||||
sub prefix_flash_output {
|
|
||||||
my ($self, %options) = @_;
|
|
||||||
|
|
||||||
return "Flash ";
|
|
||||||
}
|
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my ($class, %options) = @_;
|
my ($class, %options) = @_;
|
||||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||||
|
@ -103,29 +84,16 @@ sub manage_selection {
|
||||||
|
|
||||||
my ($total_bytes, $used_bytes, $free_bytes);
|
my ($total_bytes, $used_bytes, $free_bytes);
|
||||||
|
|
||||||
# TRAPEZE-NETWORKS-SYSTEM-MIB
|
# RAISECOM-SYSTEM-MIB
|
||||||
my $oid_trpzSysFlashMemoryUsedBytes = '.1.3.6.1.4.1.14525.4.8.1.1.3.0';
|
my $oid_raisecomAvailableMemory = '.1.3.6.1.4.1.8886.1.1.3.2.0';
|
||||||
my $oid_trpzSysFlashMemoryTotalBytes = '.1.3.6.1.4.1.14525.4.8.1.1.4.0';
|
my $oid_raisecomTotalMemory = '.1.3.6.1.4.1.8886.1.1.3.1.0';
|
||||||
my $oid_trpzSysCpuMemoryInstantUsage = '.1.3.6.1.4.1.14525.4.8.1.1.12.1.0';
|
|
||||||
my $oid_trpzSysCpuMemoryUsedBytes = '.1.3.6.1.4.1.14525.4.8.1.1.1.0';
|
|
||||||
my $oid_trpzSysCpuMemoryTotalBytes = '.1.3.6.1.4.1.14525.4.8.1.1.2.0';
|
|
||||||
my $oid_trpzSysCpuMemorySize = '.1.3.6.1.4.1.14525.4.8.1.1.6.0';
|
|
||||||
|
|
||||||
my $results = $options{snmp}->get_leef(oids => [$oid_trpzSysFlashMemoryUsedBytes, $oid_trpzSysFlashMemoryTotalBytes, $oid_trpzSysCpuMemoryUsedBytes,
|
my $results = $options{snmp}->get_leef(oids => [$oid_raisecomAvailableMemory, $oid_raisecomTotalMemory ],
|
||||||
$oid_trpzSysCpuMemoryInstantUsage, $oid_trpzSysCpuMemorySize, $oid_trpzSysCpuMemoryTotalBytes ],
|
|
||||||
nothing_quit => 1);
|
nothing_quit => 1);
|
||||||
|
|
||||||
if (defined($results->{$oid_trpzSysCpuMemorySize}) || $results->{$oid_trpzSysCpuMemorySize} != 0) {
|
$total_bytes = $results->{$oid_raisecomTotalMemory};
|
||||||
$total_bytes = $results->{$oid_trpzSysCpuMemorySize} * 1024;
|
$free_bytes = $results->{$oid_raisecomAvailableMemory};
|
||||||
$used_bytes = $results->{$oid_trpzSysCpuMemoryInstantUsage} * 1024;
|
$used_bytes = $total_bytes - $free_bytes;
|
||||||
$free_bytes = $total_bytes - $used_bytes;
|
|
||||||
} else {
|
|
||||||
$total_bytes = $results->{$oid_trpzSysCpuMemoryTotalBytes};
|
|
||||||
$used_bytes = $results->{$oid_trpzSysCpuMemoryUsedBytes};
|
|
||||||
$free_bytes = $total_bytes - $used_bytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
my $free_bytes_flash = $results->{$oid_trpzSysFlashMemoryTotalBytes} - $results->{$oid_trpzSysFlashMemoryUsedBytes};
|
|
||||||
|
|
||||||
$self->{memory} = {display => 'memory',
|
$self->{memory} = {display => 'memory',
|
||||||
prct_used => $used_bytes * 100 / $total_bytes,
|
prct_used => $used_bytes * 100 / $total_bytes,
|
||||||
|
@ -133,13 +101,6 @@ sub manage_selection {
|
||||||
free => $free_bytes,
|
free => $free_bytes,
|
||||||
total => $total_bytes,
|
total => $total_bytes,
|
||||||
};
|
};
|
||||||
|
|
||||||
$self->{flash} = {display => 'flash',
|
|
||||||
prct_used => $results->{$oid_trpzSysFlashMemoryUsedBytes} * 100 / $results->{$oid_trpzSysFlashMemoryTotalBytes},
|
|
||||||
used => $results->{$oid_trpzSysFlashMemoryUsedBytes},
|
|
||||||
free => $free_bytes_flash,
|
|
||||||
total => $results->{$oid_trpzSysFlashMemoryTotalBytes},
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
@ -160,12 +121,12 @@ Example: --filter-counters='^(memory)$'
|
||||||
=item B<--warning-*>
|
=item B<--warning-*>
|
||||||
|
|
||||||
Threshold warning.
|
Threshold warning.
|
||||||
Can be: 'memory', 'flash'
|
Can be: 'memory'
|
||||||
|
|
||||||
=item B<--critical-*>
|
=item B<--critical-*>
|
||||||
|
|
||||||
Threshold critical.
|
Threshold critical.
|
||||||
Can be: 'memory', 'flash'
|
Can be: 'memory'
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue