This commit is contained in:
qgarnier 2021-02-19 14:22:33 +01:00 committed by GitHub
parent bb5f4efcdc
commit 90fa9574ad
8 changed files with 173 additions and 180 deletions

View File

@ -39,8 +39,8 @@ sub set_counters {
output_template => 'Wan2Lan on Lan: %s %s/s', output_template => 'Wan2Lan on Lan: %s %s/s',
output_change_bytes => 1, output_change_bytes => 1,
perfdatas => [ perfdatas => [
{ label => 'wan2lan_lan', template => '%s', min => 0, unit => 'B/s' }, { label => 'wan2lan_lan', template => '%s', min => 0, unit => 'B/s' }
], ]
} }
}, },
{ label => 'wan2lan-wan', set => { { label => 'wan2lan-wan', set => {
@ -48,8 +48,8 @@ sub set_counters {
output_template => 'Wan2Lan on Wan: %s %s/s', output_template => 'Wan2Lan on Wan: %s %s/s',
output_change_bytes => 1, output_change_bytes => 1,
perfdatas => [ perfdatas => [
{ label => 'wan2lan_wan', template => '%s', min => 0, unit => 'B/s' }, { label => 'wan2lan_wan', template => '%s', min => 0, unit => 'B/s' }
], ]
} }
}, },
{ label => 'lan2wan-lan', set => { { label => 'lan2wan-lan', set => {
@ -57,8 +57,8 @@ sub set_counters {
output_template => 'Lan2Wan on Lan: %s %s/s', output_template => 'Lan2Wan on Lan: %s %s/s',
output_change_bytes => 1, output_change_bytes => 1,
perfdatas => [ perfdatas => [
{ label => 'lan2wan_lan', template => '%s', min => 0, unit => 'B/s' }, { label => 'lan2wan_lan', template => '%s', min => 0, unit => 'B/s' }
], ]
} }
}, },
{ label => 'lan2wan-wan', set => { { label => 'lan2wan-wan', set => {
@ -66,17 +66,17 @@ sub set_counters {
output_template => 'Lan2Wan on Wan: %s %s/s', output_template => 'Lan2Wan on Wan: %s %s/s',
output_change_bytes => 1, output_change_bytes => 1,
perfdatas => [ perfdatas => [
{ label => 'lan2wan_wan', template => '%s', min => 0, unit => 'B/s' }, { label => 'lan2wan_wan', template => '%s', min => 0, unit => 'B/s' }
], ]
} }
}, }
]; ];
} }
sub prefix_output { sub prefix_output {
my ($self, %options) = @_; my ($self, %options) = @_;
return "Optimized "; return 'Optimized ';
} }
sub new { sub new {
@ -95,19 +95,19 @@ my $mappings = {
bwHCAggInLan => { oid => '.1.3.6.1.4.1.17163.1.1.5.6.1.1' }, bwHCAggInLan => { oid => '.1.3.6.1.4.1.17163.1.1.5.6.1.1' },
bwHCAggInWan => { oid => '.1.3.6.1.4.1.17163.1.1.5.6.1.2' }, bwHCAggInWan => { oid => '.1.3.6.1.4.1.17163.1.1.5.6.1.2' },
bwHCAggOutLan => { oid => '.1.3.6.1.4.1.17163.1.1.5.6.1.3' }, bwHCAggOutLan => { oid => '.1.3.6.1.4.1.17163.1.1.5.6.1.3' },
bwHCAggOutWan => { oid => '.1.3.6.1.4.1.17163.1.1.5.6.1.4' }, bwHCAggOutWan => { oid => '.1.3.6.1.4.1.17163.1.1.5.6.1.4' }
}, },
ex => { ex => {
bwHCAggInLan => { oid => '.1.3.6.1.4.1.17163.1.51.5.6.1.1' }, bwHCAggInLan => { oid => '.1.3.6.1.4.1.17163.1.51.5.6.1.1' },
bwHCAggInWan => { oid => '.1.3.6.1.4.1.17163.1.51.5.6.1.2' }, bwHCAggInWan => { oid => '.1.3.6.1.4.1.17163.1.51.5.6.1.2' },
bwHCAggOutLan => { oid => '.1.3.6.1.4.1.17163.1.51.5.6.1.3' }, bwHCAggOutLan => { oid => '.1.3.6.1.4.1.17163.1.51.5.6.1.3' },
bwHCAggOutWan => { oid => '.1.3.6.1.4.1.17163.1.51.5.6.1.4' }, bwHCAggOutWan => { oid => '.1.3.6.1.4.1.17163.1.51.5.6.1.4' }
}, }
}; };
my $oids = { my $oids = {
common => '.1.3.6.1.4.1.17163.1.1.5.6.1', common => '.1.3.6.1.4.1.17163.1.1.5.6.1',
ex => '.1.3.6.1.4.1.17163.1.51.5.6.1', ex => '.1.3.6.1.4.1.17163.1.51.5.6.1'
}; };
sub manage_selection { sub manage_selection {
@ -123,13 +123,10 @@ sub manage_selection {
foreach my $equipment (keys %{$oids}) { foreach my $equipment (keys %{$oids}) {
next if (!%{$results->{$oids->{$equipment}}}); next if (!%{$results->{$oids->{$equipment}}});
my $result = $options{snmp}->map_instance(mapping => $mappings->{$equipment}, $self->{global} = $options{snmp}->map_instance(mapping => $mappings->{$equipment}, results => $results->{$oids->{$equipment}}, instance => 0);
results => $results->{$oids->{$equipment}}, instance => 0);
$self->{global} = { %$result };
} }
$self->{cache_name} = "riverbed_steelhead_" . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . $self->{cache_name} = 'riverbed_steelhead_' . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() .
'_' . $self->{mode} . '_' . md5_hex('all'); '_' . $self->{mode} . '_' . md5_hex('all');
} }

View File

@ -39,8 +39,8 @@ sub set_counters {
output_template => 'Traffic In (Wan2Lan): %s %s/s', output_template => 'Traffic In (Wan2Lan): %s %s/s',
output_change_bytes => 1, output_change_bytes => 1,
perfdatas => [ perfdatas => [
{ label => 'traffic_in', template => '%s', min => 0, unit => 'B/s' }, { label => 'traffic_in', template => '%s', min => 0, unit => 'B/s' }
], ]
} }
}, },
{ label => 'traffic-out', set => { { label => 'traffic-out', set => {
@ -48,33 +48,33 @@ sub set_counters {
output_template => 'Traffic Out (Lan2Wan): %s %s/s', output_template => 'Traffic Out (Lan2Wan): %s %s/s',
output_change_bytes => 1, output_change_bytes => 1,
perfdatas => [ perfdatas => [
{ label => 'traffic_out', template => '%s', min => 0, unit => 'B/s' }, { label => 'traffic_out', template => '%s', min => 0, unit => 'B/s' }
], ]
} }
}, }
]; ];
} }
sub prefix_output { sub prefix_output {
my ($self, %options) = @_; my ($self, %options) = @_;
return "Passthrough "; return 'Passthrough ';
} }
my $mappings = { my $mappings = {
common => { common => {
bwPassThroughIn => { oid => '.1.3.6.1.4.1.17163.1.1.5.3.3.1' }, bwPassThroughIn => { oid => '.1.3.6.1.4.1.17163.1.1.5.3.3.1' },
bwPassThroughOut => { oid => '.1.3.6.1.4.1.17163.1.1.5.3.3.2' }, bwPassThroughOut => { oid => '.1.3.6.1.4.1.17163.1.1.5.3.3.2' }
}, },
ex => { ex => {
bwPassThroughIn => { oid => '.1.3.6.1.4.1.17163.1.51.5.3.3.1' }, bwPassThroughIn => { oid => '.1.3.6.1.4.1.17163.1.51.5.3.3.1' },
bwPassThroughOut => { oid => '.1.3.6.1.4.1.17163.1.51.5.3.3.2' }, bwPassThroughOut => { oid => '.1.3.6.1.4.1.17163.1.51.5.3.3.2' }
}, }
}; };
my $oids = { my $oids = {
common => '.1.3.6.1.4.1.17163.1.1.5.3.3', common => '.1.3.6.1.4.1.17163.1.1.5.3.3',
ex => '.1.3.6.1.4.1.17163.1.51.5.3.3', ex => '.1.3.6.1.4.1.17163.1.51.5.3.3'
}; };
sub new { sub new {
@ -101,13 +101,10 @@ sub manage_selection {
foreach my $equipment (keys %{$oids}) { foreach my $equipment (keys %{$oids}) {
next if (!%{$results->{$oids->{$equipment}}}); next if (!%{$results->{$oids->{$equipment}}});
my $result = $options{snmp}->map_instance(mapping => $mappings->{$equipment}, $self->{global} = $options{snmp}->map_instance(mapping => $mappings->{$equipment}, results => $results->{$oids->{$equipment}}, instance => 0);
results => $results->{$oids->{$equipment}}, instance => 0);
$self->{global} = { %$result };
} }
$self->{cache_name} = "riverbed_steelhead_" . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . $self->{cache_name} = 'riverbed_steelhead_' . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() .
'_' . $self->{mode} . '_' . md5_hex('all'); '_' . $self->{mode} . '_' . md5_hex('all');
} }

View File

@ -25,6 +25,19 @@ use base qw(centreon::plugins::templates::counter);
use strict; use strict;
use warnings; use warnings;
sub custom_optimized_output {
my ($self, %options) = @_;
return sprintf(
"optimized total: %s used: %s (%.2f%%) free: %s (%.2f%%)",
$self->{result_values}->{max_optimized},
$self->{result_values}->{optimized},
$self->{result_values}->{prct_optimized},
$self->{result_values}->{optimized_free},
$self->{result_values}->{prct_optimized_free}
);
}
sub set_counters { sub set_counters {
my ($self, %options) = @_; my ($self, %options) = @_;
@ -33,74 +46,83 @@ sub set_counters {
]; ];
$self->{maps_counters}->{global} = [ $self->{maps_counters}->{global} = [
{ label => 'total', set => { { label => 'total', nlabel => 'connections.total.count', set => {
key_values => [ { name => 'totalConnections' } ], key_values => [ { name => 'total' } ],
output_template => 'total %s', output_template => 'total %s',
perfdatas => [ perfdatas => [
{ label => 'total', value => 'totalConnections', template => '%s', min => 0 }, { template => '%s', min => 0 }
], ]
} }
}, },
{ label => 'established', set => { { label => 'established', nlabel => 'connections.established.count', set => {
key_values => [ { name => 'establishedConnections' } ], key_values => [ { name => 'established' } ],
output_template => 'established %s', output_template => 'established %s',
perfdatas => [ perfdatas => [
{ label => 'established', value => 'establishedConnections', template => '%s', min => 0 }, { template => '%s', min => 0 }
], ]
} }
}, },
{ label => 'active', set => { { label => 'active', nlabel => 'connections.active.count', set => {
key_values => [ { name => 'activeConnections' } ], key_values => [ { name => 'active' } ],
output_template => 'active %s', output_template => 'active %s',
perfdatas => [ perfdatas => [
{ label => 'active', value => 'activeConnections', template => '%s', min => 0 }, { template => '%s', min => 0 }
], ]
} }
}, },
{ label => 'optimized', set => {
key_values => [ { name => 'optimizedConnections' } ], { label => 'optimized', nlabel => 'connections.optimized.count', set => {
output_template => 'optimized %s', key_values => [ { name => 'optimized' }, { name => 'optimized_free' }, { name => 'prct_optimized' }, { name => 'prct_optimized_free' }, { name => 'max_optimized' } ],
closure_custom_output => $self->can('custom_optimized_output'),
perfdatas => [ perfdatas => [
{ label => 'optimized', value => 'optimizedConnections', template => '%s', min => 0 }, { template => '%d', min => 0, max => 'max_optimized' }
], ]
} }
}, },
{ label => 'passthrough', set => { { label => 'optimized-prct', display_ok => 0, nlabel => 'connections.optimized.percentage', set => {
key_values => [ { name => 'passthroughConnections' } ], key_values => [ { name => 'prct_optimized' }, { name => 'optimized_free' }, { name => 'optimized' }, { name => 'prct_optimized_free' }, { name => 'max_optimized' } ],
closure_custom_output => $self->can('custom_optimized_output'),
perfdatas => [
{ template => '%.2f', min => 0, max => 100, unit => '%' }
]
}
},
{ label => 'passthrough', nlabel => 'connections.passthrough.count', set => {
key_values => [ { name => 'passthrough' } ],
output_template => 'passthrough %s', output_template => 'passthrough %s',
perfdatas => [ perfdatas => [
{ label => 'passthrough', value => 'passthroughConnections', template => '%s', min => 0 }, { template => '%s', min => 0 }
], ]
} }
}, },
{ label => 'half-opened', set => { { label => 'half-opened', nlabel => 'connections.half_opened.count', set => {
key_values => [ { name => 'halfOpenedConnections' } ], key_values => [ { name => 'half_opened' } ],
output_template => 'half opened %s', output_template => 'half opened %s',
perfdatas => [ perfdatas => [
{ label => 'half_opened', value => 'halfOpenedConnections', template => '%s', min => 0 }, { template => '%s', min => 0 }
], ]
} }
}, },
{ label => 'half-closed', set => { { label => 'half-closed', nlabel => 'connections.half_closed.count', set => {
key_values => [ { name => 'halfClosedConnections' } ], key_values => [ { name => 'half_closed' } ],
output_template => 'half closed %s', output_template => 'half closed %s',
perfdatas => [ perfdatas => [
{ label => 'half_closed', value => 'halfClosedConnections', template => '%s', min => 0 }, { template => '%s', min => 0 }
], ]
} }
}, }
]; ];
} }
sub prefix_connection_output { sub prefix_connection_output {
my ($self, %options) = @_; my ($self, %options) = @_;
return "Connections: "; return 'Connections: ';
} }
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, force_new_perfdata => 1);
bless $self, $class; bless $self, $class;
$options{options}->add_options(arguments => { $options{options}->add_options(arguments => {
@ -111,48 +133,47 @@ sub new {
my $mappings = { my $mappings = {
common => { common => {
optimizedConnections => { oid => '.1.3.6.1.4.1.17163.1.1.5.2.1' }, max_optimized => { oid => '.1.3.6.1.4.1.17163.1.1.2.13.1' }, # shMaxConnections
passthroughConnections => { oid => '.1.3.6.1.4.1.17163.1.1.5.2.2' }, optimized => { oid => '.1.3.6.1.4.1.17163.1.1.5.2.1' }, # optimizedConnections
halfOpenedConnections => { oid => '.1.3.6.1.4.1.17163.1.1.5.2.3' }, passthrough => { oid => '.1.3.6.1.4.1.17163.1.1.5.2.2' }, # passthroughConnections
halfClosedConnections => { oid => '.1.3.6.1.4.1.17163.1.1.5.2.4' }, half_opened => { oid => '.1.3.6.1.4.1.17163.1.1.5.2.3' }, # halfOpenedConnections
establishedConnections => { oid => '.1.3.6.1.4.1.17163.1.1.5.2.5' }, half_closed => { oid => '.1.3.6.1.4.1.17163.1.1.5.2.4' }, # halfClosedConnections
activeConnections => { oid => '.1.3.6.1.4.1.17163.1.1.5.2.6' }, established => { oid => '.1.3.6.1.4.1.17163.1.1.5.2.5' }, # establishedConnections
totalConnections => { oid => '.1.3.6.1.4.1.17163.1.1.5.2.7' }, active => { oid => '.1.3.6.1.4.1.17163.1.1.5.2.6' }, # activeConnections
total => { oid => '.1.3.6.1.4.1.17163.1.1.5.2.7' } # totalConnections
}, },
ex => { ex => {
optimizedConnections => { oid => '.1.3.6.1.4.1.17163.1.51.5.2.1' }, max_optimized => { oid => '.1.3.6.1.4.1.17163.1.51.2.13.1' }, # shMaxConnections
passthroughConnections => { oid => '.1.3.6.1.4.1.17163.1.51.5.2.2' }, optimized => { oid => '.1.3.6.1.4.1.17163.1.51.5.2.1' }, # optimizedConnections
halfOpenedConnections => { oid => '.1.3.6.1.4.1.17163.1.51.5.2.3' }, passthrough => { oid => '.1.3.6.1.4.1.17163.1.51.5.2.2' }, # passthroughConnections
halfClosedConnections => { oid => '.1.3.6.1.4.1.17163.1.51.5.2.4' }, half_opened => { oid => '.1.3.6.1.4.1.17163.1.51.5.2.3' }, # halfOpenedConnections
establishedConnections => { oid => '.1.3.6.1.4.1.17163.1.51.5.2.5' }, half_closed => { oid => '.1.3.6.1.4.1.17163.1.51.5.2.4' }, # halfClosedConnections
activeConnections => { oid => '.1.3.6.1.4.1.17163.1.51.5.2.6' }, established => { oid => '.1.3.6.1.4.1.17163.1.51.5.2.5' }, # establishedConnections
totalConnections => { oid => '.1.3.6.1.4.1.17163.1.51.5.2.7' }, active => { oid => '.1.3.6.1.4.1.17163.1.51.5.2.6' }, # activeConnections
}, total => { oid => '.1.3.6.1.4.1.17163.1.51.5.2.7' } # totalConnections
}; }
my $oids = {
common => '.1.3.6.1.4.1.17163.1.1.5.2',
ex => '.1.3.6.1.4.1.17163.1.51.5.2',
}; };
sub manage_selection { sub manage_selection {
my ($self, %options) = @_; my ($self, %options) = @_;
my $results = $options{snmp}->get_multiple_table( my $snmp_result = $options{snmp}->get_leef(
oids => [ oids => [
{ oid => $oids->{common}, start => $mappings->{common}->{optimizedConnections}->{oid}, end => $mappings->{common}->{totalConnections}->{oid} }, map($_->{oid} . '.0', values(%{$mappings->{common}})),
{ oid => $oids->{ex}, start => $mappings->{ex}->{optimizedConnections}->{oid}, end => $mappings->{ex}->{totalConnections}->{oid} } map($_->{oid} . '.0', values(%{$mappings->{ex}}))
] ],
nothing_quit => 1
); );
foreach my $equipment (keys %{$oids}) { my $result = $options{snmp}->map_instance(mapping => $mappings->{common}, results => $snmp_result, instance => 0);
next if (!%{$results->{$oids->{$equipment}}}); if (!defined($result->{optimized})) {
$result = $options{snmp}->map_instance(mapping => $mappings->{ex}, results => $snmp_result, instance => 0);
my $result = $options{snmp}->map_instance(mapping => $mappings->{$equipment},
results => $results->{$oids->{$equipment}}, instance => 0);
$self->{global} = { %$result };
} }
$self->{global} = $result;
$self->{global}->{optimized_free} = $result->{max_optimized} - $result->{optimized};
$self->{global}->{prct_optimized} = $result->{optimized} * 100 / $result->{max_optimized};
$self->{global}->{prct_optimized_free} = 100 - $self->{global}->{prct_optimized};
} }
1; 1;
@ -171,16 +192,10 @@ half opened and half closed ones (STEELHEAD-MIB and STEELHEAD-EX-MIB).
Only display some counters (regexp can be used). Only display some counters (regexp can be used).
Example: --filter-counters='^(total)$' Example: --filter-counters='^(total)$'
=item B<--warning-*> =item B<--warning-*> B<--critical-*>
Threshold warning. Thresholds.
Can be: 'total', 'established', 'active', 'optimized', Can be: 'total', 'established', 'active', 'optimized', 'optimized-prct',
'passthrough', 'half-opened', 'half-closed'.
=item B<--critical-*>
Threshold critical.
Can be: 'total', 'established', 'active', 'optimized',
'passthrough', 'half-opened', 'half-closed'. 'passthrough', 'half-opened', 'half-closed'.
=back =back

View File

@ -30,7 +30,7 @@ sub set_counters {
my ($self, %options) = @_; my ($self, %options) = @_;
$self->{maps_counters_type} = [ $self->{maps_counters_type} = [
{ name => 'global', type => 0 }, { name => 'global', type => 0 }
]; ];
$self->{maps_counters}->{global} = [ $self->{maps_counters}->{global} = [
@ -38,26 +38,26 @@ sub set_counters {
key_values => [ { name => 'dsAveDiskUtilization' } ], key_values => [ { name => 'dsAveDiskUtilization' } ],
output_template => 'Datastore Usage: %.2f%%', output_template => 'Datastore Usage: %.2f%%',
perfdatas => [ perfdatas => [
{ label => 'used', template => '%.2f', min => 0, max => 100, unit => '%' }, { label => 'used', template => '%.2f', min => 0, max => 100, unit => '%' }
], ]
} }
}, },
{ label => 'hits', set => { { label => 'hits', set => {
key_values => [ { name => 'dsHitsTotal', per_second => 1 } ], key_values => [ { name => 'dsHitsTotal', per_second => 1 } ],
output_template => 'Hits: %s/s', output_template => 'Hits: %s/s',
perfdatas => [ perfdatas => [
{ label => 'hits', template => '%.2f', min => 0, unit => 'hits/s' }, { label => 'hits', template => '%.2f', min => 0, unit => 'hits/s' }
], ]
} }
}, },
{ label => 'misses', set => { { label => 'misses', set => {
key_values => [ { name => 'dsMissTotal', per_second => 1 } ], key_values => [ { name => 'dsMissTotal', per_second => 1 } ],
output_template => 'Misses: %s/s', output_template => 'Misses: %s/s',
perfdatas => [ perfdatas => [
{ label => 'misses', template => '%.2f', min => 0, unit => 'misses/s' }, { label => 'misses', template => '%.2f', min => 0, unit => 'misses/s' }
], ]
} }
}, }
]; ];
} }
@ -77,14 +77,14 @@ my $mappings = {
dsHitsTotal => { oid => '.1.3.6.1.4.1.17163.1.1.5.4.1' }, dsHitsTotal => { oid => '.1.3.6.1.4.1.17163.1.1.5.4.1' },
dsMissTotal => { oid => '.1.3.6.1.4.1.17163.1.1.5.4.2' }, dsMissTotal => { oid => '.1.3.6.1.4.1.17163.1.1.5.4.2' },
dsCostPerSegment => { oid => '.1.3.6.1.4.1.17163.1.1.5.4.3' }, dsCostPerSegment => { oid => '.1.3.6.1.4.1.17163.1.1.5.4.3' },
dsAveDiskUtilization => { oid => '.1.3.6.1.4.1.17163.1.1.5.4.4' }, dsAveDiskUtilization => { oid => '.1.3.6.1.4.1.17163.1.1.5.4.4' }
}, },
ex => { ex => {
dsHitsTotal => { oid => '.1.3.6.1.4.1.17163.1.51.5.4.1' }, dsHitsTotal => { oid => '.1.3.6.1.4.1.17163.1.51.5.4.1' },
dsMissTotal => { oid => '.1.3.6.1.4.1.17163.1.51.5.4.2' }, dsMissTotal => { oid => '.1.3.6.1.4.1.17163.1.51.5.4.2' },
dsCostPerSegment => { oid => '.1.3.6.1.4.1.17163.1.51.5.4.3' }, dsCostPerSegment => { oid => '.1.3.6.1.4.1.17163.1.51.5.4.3' },
dsAveDiskUtilization => { oid => '.1.3.6.1.4.1.17163.1.51.5.4.4' }, dsAveDiskUtilization => { oid => '.1.3.6.1.4.1.17163.1.51.5.4.4' }
}, }
}; };
my $oids = { my $oids = {
@ -106,15 +106,15 @@ sub manage_selection {
next if (!%{$results->{$oids->{$equipment}}}); next if (!%{$results->{$oids->{$equipment}}});
my $result = $options{snmp}->map_instance(mapping => $mappings->{$equipment}, results => $results->{$oids->{$equipment}}, instance => 0); my $result = $options{snmp}->map_instance(mapping => $mappings->{$equipment}, results => $results->{$oids->{$equipment}}, instance => 0);
$self->{global} = { $self->{global} = {
dsHitsTotal => $result->{dsHitsTotal}, dsHitsTotal => $result->{dsHitsTotal},
dsMissTotal => $result->{dsMissTotal}, dsMissTotal => $result->{dsMissTotal},
dsAveDiskUtilization => $result->{dsAveDiskUtilization}, dsAveDiskUtilization => $result->{dsAveDiskUtilization}
}; };
} }
$self->{cache_name} = "riverbed_steelhead_" . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . $self->{cache_name} = 'riverbed_steelhead_' . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() .
'_' . $self->{mode} . '_' . md5_hex('all'); '_' . $self->{mode} . '_' . md5_hex('all');
} }

View File

@ -29,7 +29,7 @@ sub set_counters {
my ($self, %options) = @_; my ($self, %options) = @_;
$self->{maps_counters_type} = [ $self->{maps_counters_type} = [
{ name => 'global', type => 0 }, { name => 'global', type => 0 }
]; ];
$self->{maps_counters}->{global} = [ $self->{maps_counters}->{global} = [
@ -37,38 +37,35 @@ sub set_counters {
key_values => [ { name => 'cpuUtil1' } ], key_values => [ { name => 'cpuUtil1' } ],
output_template => 'CPU Average: %.2f%%', output_template => 'CPU Average: %.2f%%',
perfdatas => [ perfdatas => [
{ label => 'total_cpu_avg', value => 'cpuUtil1', template => '%.2f', { label => 'total_cpu_avg', template => '%.2f',
min => 0, max => 100, unit => '%' }, min => 0, max => 100, unit => '%' }
], ]
} }
}, },
{ label => '1min', nlabel => 'cpu.1m.usage.percentage', set => { { label => '1min', nlabel => 'cpu.1m.usage.percentage', set => {
key_values => [ { name => 'cpuLoad1' } ], key_values => [ { name => 'cpuLoad1' } ],
output_template => 'Load 1 min: %.2f', output_template => 'Load 1 min: %.2f',
perfdatas => [ perfdatas => [
{ label => 'load1', value => 'cpuLoad1', template => '%.2f', { label => 'load1', template => '%.2f', min => 0 }
min => 0 }, ]
],
} }
}, },
{ label => '5min', nlabel => 'cpu.5m.usage.percentage', set => { { label => '5min', nlabel => 'cpu.5m.usage.percentage', set => {
key_values => [ { name => 'cpuLoad5' } ], key_values => [ { name => 'cpuLoad5' } ],
output_template => 'Load 5 min: %.2f', output_template => 'Load 5 min: %.2f',
perfdatas => [ perfdatas => [
{ label => 'load5', value => 'cpuLoad5', template => '%.2f', { label => 'load5', template => '%.2f', min => 0 }
min => 0 }, ]
],
} }
}, },
{ label => '15min', nlabel => 'cpu.15m.usage.percentage', set => { { label => '15min', nlabel => 'cpu.15m.usage.percentage', set => {
key_values => [ { name => 'cpuLoad15' } ], key_values => [ { name => 'cpuLoad15' } ],
output_template => 'Load 15 min: %.2f', output_template => 'Load 15 min: %.2f',
perfdatas => [ perfdatas => [
{ label => 'load15', value => 'cpuLoad15', template => '%.2f', { label => 'load15', template => '%.2f', min => 0 }
min => 0 }, ]
],
} }
}, }
]; ];
} }
@ -87,26 +84,26 @@ my $mappings = {
cpuLoad1 => { oid => '.1.3.6.1.4.1.17163.1.1.5.1.1' }, cpuLoad1 => { oid => '.1.3.6.1.4.1.17163.1.1.5.1.1' },
cpuLoad5 => { oid => '.1.3.6.1.4.1.17163.1.1.5.1.2' }, cpuLoad5 => { oid => '.1.3.6.1.4.1.17163.1.1.5.1.2' },
cpuLoad15 => { oid => '.1.3.6.1.4.1.17163.1.1.5.1.3' }, cpuLoad15 => { oid => '.1.3.6.1.4.1.17163.1.1.5.1.3' },
cpuUtil1 => { oid => '.1.3.6.1.4.1.17163.1.1.5.1.4' }, cpuUtil1 => { oid => '.1.3.6.1.4.1.17163.1.1.5.1.4' }
}, },
ex => { ex => {
cpuLoad1 => { oid => '.1.3.6.1.4.1.17163.1.51.5.1.1' }, cpuLoad1 => { oid => '.1.3.6.1.4.1.17163.1.51.5.1.1' },
cpuLoad5 => { oid => '.1.3.6.1.4.1.17163.1.51.5.1.2' }, cpuLoad5 => { oid => '.1.3.6.1.4.1.17163.1.51.5.1.2' },
cpuLoad15 => { oid => '.1.3.6.1.4.1.17163.1.51.5.1.3' }, cpuLoad15 => { oid => '.1.3.6.1.4.1.17163.1.51.5.1.3' },
cpuUtil1 => { oid => '.1.3.6.1.4.1.17163.1.51.5.1.4' }, cpuUtil1 => { oid => '.1.3.6.1.4.1.17163.1.51.5.1.4' }
}, },
interceptor => { interceptor => {
cpuLoad1 => { oid => '.1.3.6.1.4.1.17163.1.3.5.1.1' }, cpuLoad1 => { oid => '.1.3.6.1.4.1.17163.1.3.5.1.1' },
cpuLoad5 => { oid => '.1.3.6.1.4.1.17163.1.3.5.1.2' }, cpuLoad5 => { oid => '.1.3.6.1.4.1.17163.1.3.5.1.2' },
cpuLoad15 => { oid => '.1.3.6.1.4.1.17163.1.3.5.1.3' }, cpuLoad15 => { oid => '.1.3.6.1.4.1.17163.1.3.5.1.3' },
cpuUtil1 => { oid => '.1.3.6.1.4.1.17163.1.3.5.1.4' }, cpuUtil1 => { oid => '.1.3.6.1.4.1.17163.1.3.5.1.4' }
}, },
}; };
my $oids = { my $oids = {
common => '.1.3.6.1.4.1.17163.1.1.5.1', common => '.1.3.6.1.4.1.17163.1.1.5.1',
ex => '.1.3.6.1.4.1.17163.1.51.5.1', ex => '.1.3.6.1.4.1.17163.1.51.5.1',
interceptor => '.1.3.6.1.4.1.17163.1.3.5.1', interceptor => '.1.3.6.1.4.1.17163.1.3.5.1'
}; };
sub manage_selection { sub manage_selection {
@ -123,8 +120,7 @@ sub manage_selection {
foreach my $equipment (keys %{$oids}) { foreach my $equipment (keys %{$oids}) {
next if (!%{$results->{$oids->{$equipment}}}); next if (!%{$results->{$oids->{$equipment}}});
my $result = $options{snmp}->map_instance(mapping => $mappings->{$equipment}, my $result = $options{snmp}->map_instance(mapping => $mappings->{$equipment}, results => $results->{$oids->{$equipment}}, instance => 0);
results => $results->{$oids->{$equipment}}, instance => 0);
$self->{global} = { $self->{global} = {
cpuLoad1 => $result->{cpuLoad1} / 100, cpuLoad1 => $result->{cpuLoad1} / 100,

View File

@ -24,15 +24,16 @@ use base qw(centreon::plugins::templates::counter);
use strict; use strict;
use warnings; use warnings;
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold); use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
sub custom_status_output { sub custom_status_output {
my ($self, %options) = @_; my ($self, %options) = @_;
my $msg = sprintf("Health is '%s', Status is '%s'", return sprintf(
"Health is '%s', Status is '%s'",
$self->{result_values}->{health}, $self->{result_values}->{health},
$self->{result_values}->{status}); $self->{result_values}->{status}
return $msg; );
} }
sub custom_status_calc { sub custom_status_calc {
@ -50,23 +51,22 @@ sub set_counters {
{ name => 'global', type => 0, cb_prefix_output => 'prefix_status_output' }, { name => 'global', type => 0, cb_prefix_output => 'prefix_status_output' },
]; ];
$self->{maps_counters}->{global} = [ $self->{maps_counters}->{global} = [
{ label => 'status', threshold => 0, set => { { label => 'status', type => 2, critical_default => '%{health} !~ /Healthy/ || %{status} !~ /running/', set => {
key_values => [ { name => 'health' }, { name => 'serviceStatus' } ], key_values => [ { name => 'health' }, { name => 'serviceStatus' } ],
closure_custom_calc => $self->can('custom_status_calc'), closure_custom_calc => $self->can('custom_status_calc'),
closure_custom_output => $self->can('custom_status_output'), closure_custom_output => $self->can('custom_status_output'),
closure_custom_perfdata => sub { return 0; }, closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => \&catalog_status_threshold, closure_custom_threshold_check => \&catalog_status_threshold_ng
} }
}, },
{ label => 'uptime', set => { { label => 'uptime', set => {
key_values => [ { name => 'serviceUptime' }, { name => 'serviceUptime_human' } ], key_values => [ { name => 'serviceUptime' }, { name => 'serviceUptime_human' } ],
output_template => 'Uptime: %s', output_use => 'serviceUptime_human', output_template => 'Uptime: %s', output_use => 'serviceUptime_human',
perfdatas => [ perfdatas => [
{ label => 'uptime', value => 'serviceUptime', template => '%d', { label => 'uptime', template => '%d', min => 0, unit => 's' }
min => 0, unit => 's' }, ]
],
} }
}, }
]; ];
} }
@ -82,42 +82,33 @@ sub new {
bless $self, $class; bless $self, $class;
$options{options}->add_options(arguments => { $options{options}->add_options(arguments => {
'warning-status:s' => { name => 'warning_status', default => '' },
'critical-status:s' => { name => 'critical_status', default => '%{health} !~ /Healthy/ || %{status} !~ /running/' },
}); });
return $self; return $self;
} }
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
$self->change_macros(macros => ['warning_status', 'critical_status']);
}
my $mappings = { my $mappings = {
common => { common => {
health => { oid => '.1.3.6.1.4.1.17163.1.1.2.2' }, health => { oid => '.1.3.6.1.4.1.17163.1.1.2.2' },
serviceStatus => { oid => '.1.3.6.1.4.1.17163.1.1.2.3' }, serviceStatus => { oid => '.1.3.6.1.4.1.17163.1.1.2.3' },
serviceUptime => { oid => '.1.3.6.1.4.1.17163.1.1.2.4' }, serviceUptime => { oid => '.1.3.6.1.4.1.17163.1.1.2.4' }
}, },
ex => { ex => {
health => { oid => '.1.3.6.1.4.1.17163.1.51.2.2' }, health => { oid => '.1.3.6.1.4.1.17163.1.51.2.2' },
serviceStatus => { oid => '.1.3.6.1.4.1.17163.1.51.2.3' }, serviceStatus => { oid => '.1.3.6.1.4.1.17163.1.51.2.3' },
serviceUptime => { oid => '.1.3.6.1.4.1.17163.1.51.2.4' }, serviceUptime => { oid => '.1.3.6.1.4.1.17163.1.51.2.4' }
}, },
interceptor => { interceptor => {
health => { oid => '.1.3.6.1.4.1.17163.1.3.2.2' }, health => { oid => '.1.3.6.1.4.1.17163.1.3.2.2' },
serviceStatus => { oid => '.1.3.6.1.4.1.17163.1.3.2.3' }, serviceStatus => { oid => '.1.3.6.1.4.1.17163.1.3.2.3' },
serviceUptime => { oid => '.1.3.6.1.4.1.17163.1.3.2.4' }, serviceUptime => { oid => '.1.3.6.1.4.1.17163.1.3.2.4' }
}, },
}; };
my $oids = { my $oids = {
common => '.1.3.6.1.4.1.17163.1.1.2', common => '.1.3.6.1.4.1.17163.1.1.2',
ex => '.1.3.6.1.4.1.17163.1.51.2', ex => '.1.3.6.1.4.1.17163.1.51.2',
interceptor => '.1.3.6.1.4.1.17163.1.3.2', interceptor => '.1.3.6.1.4.1.17163.1.3.2'
}; };
sub manage_selection { sub manage_selection {
@ -134,9 +125,8 @@ sub manage_selection {
foreach my $equipment (keys %{$oids}) { foreach my $equipment (keys %{$oids}) {
next if (!%{$results->{$oids->{$equipment}}}); next if (!%{$results->{$oids->{$equipment}}});
my $result = $options{snmp}->map_instance(mapping => $mappings->{$equipment}, my $result = $options{snmp}->map_instance(mapping => $mappings->{$equipment}, results => $results->{$oids->{$equipment}}, instance => 0);
results => $results->{$oids->{$equipment}}, instance => 0);
$self->{global} = { $self->{global} = {
health => $result->{health}, health => $result->{health},
serviceStatus => $result->{serviceStatus}, serviceStatus => $result->{serviceStatus},

View File

@ -38,11 +38,10 @@ sub set_counters {
key_values => [ { name => 'systemTemperature' } ], key_values => [ { name => 'systemTemperature' } ],
output_template => 'Temperature: %.2f C', output_template => 'Temperature: %.2f C',
perfdatas => [ perfdatas => [
{ label => 'temperature', value => 'systemTemperature', template => '%.2f', { label => 'temperature', template => '%.2f', min => 0, unit => 'C' }
min => 0, unit => 'C' }, ]
],
} }
}, }
]; ];
} }
@ -63,12 +62,12 @@ my $mappings = {
}, },
ex => { ex => {
systemTemperature => { oid => '.1.3.6.1.4.1.17163.1.51.2.9' }, systemTemperature => { oid => '.1.3.6.1.4.1.17163.1.51.2.9' },
}, }
}; };
my $oids = { my $oids = {
common => '.1.3.6.1.4.1.17163.1.1.2.9', common => '.1.3.6.1.4.1.17163.1.1.2.9',
ex => '.1.3.6.1.4.1.17163.1.51.2.9', ex => '.1.3.6.1.4.1.17163.1.51.2.9'
}; };
sub manage_selection { sub manage_selection {
@ -83,10 +82,10 @@ sub manage_selection {
foreach my $equipment (keys %{$oids}) { foreach my $equipment (keys %{$oids}) {
next if (!%{$results->{$oids->{$equipment}}}); next if (!%{$results->{$oids->{$equipment}}});
my $result = $options{snmp}->map_instance(mapping => $mappings->{$equipment}, my $result = $options{snmp}->map_instance(mapping => $mappings->{$equipment},
results => $results->{$oids->{$equipment}}, instance => 0); results => $results->{$oids->{$equipment}}, instance => 0);
$self->{global} = { $self->{global} = {
systemTemperature => $result->{systemTemperature}, systemTemperature => $result->{systemTemperature},
}; };

View File

@ -31,8 +31,7 @@ sub new {
bless $self, $class; bless $self, $class;
$self->{version} = '0.1'; $self->{version} = '0.1';
$self->{modes} = {
%{$self->{modes}} = (
'bandwidth-optimization' => 'centreon::common::riverbed::steelhead::snmp::mode::bwoptimization', 'bandwidth-optimization' => 'centreon::common::riverbed::steelhead::snmp::mode::bwoptimization',
'bandwidth-passthrough' => 'centreon::common::riverbed::steelhead::snmp::mode::bwpassthrough', 'bandwidth-passthrough' => 'centreon::common::riverbed::steelhead::snmp::mode::bwpassthrough',
'connections' => 'centreon::common::riverbed::steelhead::snmp::mode::connections', 'connections' => 'centreon::common::riverbed::steelhead::snmp::mode::connections',
@ -47,8 +46,8 @@ sub new {
'status' => 'centreon::common::riverbed::steelhead::snmp::mode::status', 'status' => 'centreon::common::riverbed::steelhead::snmp::mode::status',
'storage' => 'snmp_standard::mode::storage', 'storage' => 'snmp_standard::mode::storage',
'temperature' => 'centreon::common::riverbed::steelhead::snmp::mode::temperature', 'temperature' => 'centreon::common::riverbed::steelhead::snmp::mode::temperature',
'uptime' => 'snmp_standard::mode::uptime', 'uptime' => 'snmp_standard::mode::uptime'
); };
return $self; return $self;
} }
@ -61,4 +60,4 @@ __END__
Check Riverbed SteelHead WAN optimizer using SNMP. Check Riverbed SteelHead WAN optimizer using SNMP.
=cut =cut