diff --git a/network/riverbed/steelhead/snmp/mode/bwoptimization.pm b/network/riverbed/steelhead/snmp/mode/bwoptimization.pm index 97ebadaf2..5bd7a437a 100644 --- a/network/riverbed/steelhead/snmp/mode/bwoptimization.pm +++ b/network/riverbed/steelhead/snmp/mode/bwoptimization.pm @@ -20,112 +20,117 @@ package network::riverbed::steelhead::snmp::mode::bwoptimization; -use base qw(centreon::plugins::mode); +use base qw(centreon::plugins::templates::counter); use strict; use warnings; -use POSIX; -use centreon::plugins::statefile; +use Digest::MD5 qw(md5_hex); + +sub set_counters { + my ($self, %options) = @_; + + $self->{maps_counters_type} = [ + { name => 'global', type => 0, cb_prefix_output => 'prefix_output' } + ]; + + $self->{maps_counters}->{global} = [ + { label => 'wan2lan-lan', set => { + key_values => [ { name => 'bwHCAggInLan', diff => 1 } ], + output_template => 'Wan2Lan on Lan: %s %s/s', + output_change_bytes => 1, + perfdatas => [ + { label => 'wan2lan_lan', value => 'bwHCAggInLan_absolute', + template => '%s', min => 0, unit => 'B/s' }, + ], + } + }, + { label => 'wan2lan-wan', set => { + key_values => [ { name => 'bwHCAggInWan', diff => 1 } ], + output_template => 'Wan2Lan on Wan: %s %s/s', + output_change_bytes => 1, + perfdatas => [ + { label => 'wan2lan_wan', value => 'bwHCAggInWan_absolute', + template => '%s', min => 0, unit => 'B/s' }, + ], + } + }, + { label => 'lan2wan-lan', set => { + key_values => [ { name => 'bwHCAggOutLan', diff => 1 } ], + output_template => 'Lan2Wan on Lan: %s %s/s', + output_change_bytes => 1, + perfdatas => [ + { label => 'lan2wan_lan', value => 'bwHCAggOutLan_absolute', + template => '%s', min => 0, unit => 'B/s' }, + ], + } + }, + { label => 'wan2lan-lan', set => { + key_values => [ { name => 'bwHCAggOutWan', diff => 1 } ], + output_template => 'Lan2Wan on Wan: %s %s/s', + output_change_bytes => 1, + perfdatas => [ + { label => 'wan2lan_lan', value => 'bwHCAggOutWan_absolute', + template => '%s', min => 0, unit => 'B/s' }, + ], + } + }, + ]; +} + +sub prefix_output { + my ($self, %options) = @_; + + return "Optimized: "; +} sub new { my ($class, %options) = @_; - my $self = $class->SUPER::new(package => __PACKAGE__, %options); + my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1); bless $self, $class; $self->{version} = '0.1'; + $options{options}->add_options(arguments => + { + }); - $self->{statefile_value} = centreon::plugins::statefile->new(%options); return $self; } -sub check_options { - my ($self, %options) = @_; - $self->SUPER::init(%options); - $self->{statefile_value}->check_options(%options); -} - -sub run { +sub manage_selection { my ($self, %options) = @_; - $self->{snmp} = $options{snmp}; - $self->{hostname} = $self->{snmp}->get_hostname(); - $self->{snmp_port} = $self->{snmp}->get_port(); + # STEELHEAD-MIB + my $oids = { + bwHCAggInLan => '.1.3.6.1.4.1.17163.1.1.5.6.1.1.0', + bwHCAggInWan => '.1.3.6.1.4.1.17163.1.1.5.6.1.2.0', + bwHCAggOutLan => '.1.3.6.1.4.1.17163.1.1.5.6.1.3.0', + bwHCAggOutWan => '.1.3.6.1.4.1.17163.1.1.5.6.1.4.0', + }; - my $oid_bwHCAggInLan = '.1.3.6.1.4.1.17163.1.1.5.6.1.1.0'; # in bytes, 64 bits - my $oid_bwHCAggInWan = '.1.3.6.1.4.1.17163.1.1.5.6.1.2.0'; # in bytes, 64 bits - my $oid_bwHCAggOutLan = '.1.3.6.1.4.1.17163.1.1.5.6.1.3.0'; # in bytes, 64 bits - my $oid_bwHCAggOutWan = '.1.3.6.1.4.1.17163.1.1.5.6.1.4.0'; # in bytes, 64 bits - my ($result, $bw_in_lan, $bw_out_lan, $bw_in_wan, $bw_out_wan); + # STEELHEAD-EX-MIB + my $oids_ex = { + bwHCAggInLan => '.1.3.6.1.4.1.17163.1.51.5.6.1.1.0', + bwHCAggInWan => '.1.3.6.1.4.1.17163.1.51.5.6.1.2.0', + bwHCAggOutLan => '.1.3.6.1.4.1.17163.1.51.5.6.1.3.0', + bwHCAggOutWan => '.1.3.6.1.4.1.17163.1.51.5.6.1.4.0', + }; - $result = $self->{snmp}->get_leef(oids => [ $oid_bwHCAggInLan, $oid_bwHCAggInWan, $oid_bwHCAggOutLan, $oid_bwHCAggOutWan ], nothing_quit => 1); - $bw_in_lan = $result->{$oid_bwHCAggInLan}; - $bw_in_wan = $result->{$oid_bwHCAggInWan}; - $bw_out_lan = $result->{$oid_bwHCAggOutLan}; - $bw_out_wan = $result->{$oid_bwHCAggOutWan}; + my $result = $options{snmp}->get_leef(oids => [ values %{$oids}, values %{$oids_ex} ], nothing_quit => 1); - $self->{statefile_value}->read(statefile => 'steelhead_' . $self->{hostname} . '_' . $self->{snmp_port} . '_' . $self->{mode}); - my $old_timestamp = $self->{statefile_value}->get(name => 'last_timestamp'); - my $old_bwHCAggInLan = $self->{statefile_value}->get(name => 'bwHCAggInLan'); - my $old_bwHCAggInWan = $self->{statefile_value}->get(name => 'bwHCAggInWan'); - my $old_bwHCAggOutLan = $self->{statefile_value}->get(name => 'bwHCAggOutLan'); - my $old_bwHCAggOutWan = $self->{statefile_value}->get(name => 'bwHCAggOutWan'); + $self->{cache_name} = "riverbed_" . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . + '_' . $self->{mode} . '_' . md5_hex('all'); + + $self->{global} = {}; - my $new_datas = {}; - $new_datas->{last_timestamp} = time(); - $new_datas->{bwHCAggInLan} = $bw_in_lan; - $new_datas->{bwHCAggInWan} = $bw_in_wan; - $new_datas->{bwHCAggOutLan} = $bw_out_lan; - $new_datas->{bwHCAggOutWan} = $bw_out_wan; - - $self->{statefile_value}->write(data => $new_datas); - - if (!defined($old_timestamp) || !defined($old_bwHCAggInLan) || !defined($old_bwHCAggInWan) || !defined($old_bwHCAggOutLan) || !defined($old_bwHCAggOutWan)) { - $self->{output}->output_add(severity => 'OK', - short_msg => "Buffer creation..."); - $self->{output}->display(); - $self->{output}->exit(); + if (defined($result->{$oids->{bwHCAggInLan}})) { + foreach (keys %{$oids}) { + $self->{global}->{$_} = $result->{$oids->{$_}}; + } + } else { + foreach (keys %{$oids_ex}) { + $self->{global}->{$_} = $result->{$oids_ex->{$_}}; + } } - - $old_bwHCAggInLan = 0 if ($old_bwHCAggInLan > $new_datas->{bwHCAggInLan}); - $old_bwHCAggInWan = 0 if ($old_bwHCAggInWan > $new_datas->{bwHCAggInWan}); - $old_bwHCAggOutLan = 0 if ($old_bwHCAggOutLan > $new_datas->{bwHCAggOutLan}); - $old_bwHCAggOutWan = 0 if ($old_bwHCAggOutWan > $new_datas->{bwHCAggOutWan}); - - my $delta_time = $new_datas->{last_timestamp} - $old_timestamp; - $delta_time = 1 if ($delta_time == 0); - - my $bwHCAggInLanPerSec = int(($new_datas->{bwHCAggInLan} - $old_bwHCAggInLan) / $delta_time); - my $bwHCAggInWanPerSec = int(($new_datas->{bwHCAggInWan} - $old_bwHCAggInWan) / $delta_time); - my $bwHCAggOutLanPerSec = int(($new_datas->{bwHCAggOutLan} - $old_bwHCAggOutLan) / $delta_time); - my $bwHCAggOutWanPerSec = int(($new_datas->{bwHCAggOutWan} - $old_bwHCAggOutWan) / $delta_time); - - $self->{output}->perfdata_add(label => 'wan2lan_lan', unit => 'B/s', - value => $bwHCAggInLanPerSec, - min => 0); - $self->{output}->perfdata_add(label => 'wan2lan_wan', unit => 'B/s', - value => $bwHCAggInWanPerSec, - min => 0); - $self->{output}->perfdata_add(label => 'lan2wan_lan', unit => 'B/s', - value => $bwHCAggOutLanPerSec, - min => 0); - $self->{output}->perfdata_add(label => 'lan2wan_wan', unit => 'B/s', - value => $bwHCAggOutWanPerSec, - min => 0); - - my ($bwHCAggInLanPerSec_value, $bwHCAggInLanPerSec_unit) = $self->{perfdata}->change_bytes(value => $bwHCAggInLanPerSec); - my ($bwHCAggInWanPerSec_value, $bwHCAggInWanPerSec_unit) = $self->{perfdata}->change_bytes(value => $bwHCAggInWanPerSec); - my ($bwHCAggOutLanPerSec_value, $bwHCAggOutLanPerSec_unit) = $self->{perfdata}->change_bytes(value => $bwHCAggOutLanPerSec); - my ($bwHCAggOutWanPerSec_value, $bwHCAggOutWanPerSec_unit) = $self->{perfdata}->change_bytes(value => $bwHCAggOutWanPerSec); - $self->{output}->output_add(severity => 'OK', - short_msg => sprintf("Optimized: Wan2Lan on Lan %s/s, Wan2Lan on Wan %s/s, Lan2Wan on Lan %s/s, Lan2Wan on Wan %s/s", - $bwHCAggInLanPerSec_value . " " . $bwHCAggInLanPerSec_unit, - $bwHCAggInWanPerSec_value . " " . $bwHCAggInWanPerSec_unit, - $bwHCAggOutLanPerSec_value . " " . $bwHCAggOutLanPerSec_unit, - $bwHCAggOutWanPerSec_value . " " . $bwHCAggOutWanPerSec_unit - )); - - $self->{output}->display(); - $self->{output}->exit(); } 1; @@ -134,7 +139,20 @@ __END__ =head1 MODE -Total optimized bytes across all application ports in both directions and on both sides, in bytes per second (STEELHEAD-MIB). +Total optimized bytes across all application ports in both directions and on both sides, +in bytes per second (STEELHEAD-MIB and STEELHEAD-EX-MIB). + +=over 8 + +=item B<--warning-*> + +Threshold warning (Can be: 'wan2lan-lan', 'wan2lan-wan', +'lan2wan-lan', 'lan2wan-wan') + +=item B<--critical-*> + +Threshold critical (Can be: 'wan2lan-lan', 'wan2lan-wan', +'lan2wan-lan', 'lan2wan-wan') =over 8 diff --git a/network/riverbed/steelhead/snmp/mode/bwpassthrough.pm b/network/riverbed/steelhead/snmp/mode/bwpassthrough.pm index be51fd6a1..79fbfaa8d 100644 --- a/network/riverbed/steelhead/snmp/mode/bwpassthrough.pm +++ b/network/riverbed/steelhead/snmp/mode/bwpassthrough.pm @@ -20,124 +20,93 @@ package network::riverbed::steelhead::snmp::mode::bwpassthrough; -use base qw(centreon::plugins::mode); +use base qw(centreon::plugins::templates::counter); use strict; use warnings; -use POSIX; -use centreon::plugins::statefile; +use Digest::MD5 qw(md5_hex); + +sub set_counters { + my ($self, %options) = @_; + + $self->{maps_counters_type} = [ + { name => 'global', type => 0, cb_prefix_output => 'prefix_output' } + ]; + + $self->{maps_counters}->{global} = [ + { label => 'traffic-in', set => { + key_values => [ { name => 'bwPassThroughIn', diff => 1 } ], + output_template => 'Traffic In (Wan2Lan): %s %s/s', + output_change_bytes => 1, + perfdatas => [ + { label => 'traffic_in', value => 'bwPassThroughIn_absolute', + template => '%s', min => 0, unit => 'B/s' }, + ], + } + }, + { label => 'traffic-out', set => { + key_values => [ { name => 'bwPassThroughOut', diff => 1 } ], + output_template => 'Traffic Out (Lan2Wan): %s %s/s', + output_change_bytes => 1, + perfdatas => [ + { label => 'traffic_out', value => 'bwPassThroughOut_absolute', + template => '%s', min => 0, unit => 'B/s' }, + ], + } + }, + ]; +} + +sub prefix_output { + my ($self, %options) = @_; + + return "Passthrough: "; +} sub new { my ($class, %options) = @_; - my $self = $class->SUPER::new(package => __PACKAGE__, %options); + my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1); bless $self, $class; $self->{version} = '0.1'; - $options{options}->add_options(arguments => - { - "warning-in:s" => { name => 'warning_in', }, - "critical-in:s" => { name => 'critical_in', }, - "warning-out:s" => { name => 'warning_out', }, - "critical-out:s" => { name => 'critical_out', }, - }); + { + }); - $self->{statefile_value} = centreon::plugins::statefile->new(%options); return $self; } -sub check_options { - my ($self, %options) = @_; - $self->SUPER::init(%options); - - if (($self->{perfdata}->threshold_validate(label => 'warning_in', value => $self->{option_results}->{warning_in})) == 0) { - $self->{output}->add_option_msg(short_msg => "Wrong warning threshold for Wan2Lan'" . $self->{option_results}->{warning} . "'."); - $self->{output}->option_exit(); - } - if (($self->{perfdata}->threshold_validate(label => 'critical_in', value => $self->{option_results}->{critical_in})) == 0) { - $self->{output}->add_option_msg(short_msg => "Wrong critical threshold for Wan2Lan'" . $self->{option_results}->{critical} . "'."); - $self->{output}->option_exit(); - } - if (($self->{perfdata}->threshold_validate(label => 'warning_out', value => $self->{option_results}->{warning_in})) == 0) { - $self->{output}->add_option_msg(short_msg => "Wrong warning threshold for Wan2Lan'" . $self->{option_results}->{warning} . "'."); - $self->{output}->option_exit(); - } - if (($self->{perfdata}->threshold_validate(label => 'critical_in', value => $self->{option_results}->{critical_in})) == 0) { - $self->{output}->add_option_msg(short_msg => "Wrong critical threshold for Wan2Lan'" . $self->{option_results}->{critical} . "'."); - $self->{output}->option_exit(); - } - $self->{statefile_value}->check_options(%options); -} - -sub run { +sub manage_selection { my ($self, %options) = @_; - $self->{snmp} = $options{snmp}; - $self->{hostname} = $self->{snmp}->get_hostname(); - $self->{snmp_port} = $self->{snmp}->get_port(); + # STEELHEAD-MIB + my $oids = { + bwPassThroughIn => '.1.3.6.1.4.1.17163.1.1.5.3.3.1.0', + bwPassThroughOut => '.1.3.6.1.4.1.17163.1.1.5.3.3.2.0', + }; - my $oid_bwPassThroughIn = '.1.3.6.1.4.1.17163.1.1.5.3.3.1.0'; - my $oid_bwPassThroughOut = '.1.3.6.1.4.1.17163.1.1.5.3.3.2.0'; - my ($result, $bw_inn, $bw_out); + # STEELHEAD-EX-MIB + my $oids_ex = { + bwPassThroughIn => '.1.3.6.1.4.1.17163.1.51.5.3.3.1.0', + bwPassThroughOut => '.1.3.6.1.4.1.17163.1.51.5.3.3.2.0', + }; - $result = $self->{snmp}->get_leef(oids => [ $oid_bwPassThroughIn, $oid_bwPassThroughOut ], nothing_quit => 1); - $bw_inn = $result->{$oid_bwPassThroughIn}; - $bw_out = $result->{$oid_bwPassThroughOut}; + my $result = $options{snmp}->get_leef(oids => [ values %{$oids}, values %{$oids_ex} ], nothing_quit => 1); - $self->{statefile_value}->read(statefile => 'steelhead_' . $self->{hostname} . '_' . $self->{snmp_port} . '_' . $self->{mode}); - my $old_timestamp = $self->{statefile_value}->get(name => 'last_timestamp'); - my $old_bwPassThroughIn = $self->{statefile_value}->get(name => 'bwPassThroughIn'); - my $old_bwPassThroughOut = $self->{statefile_value}->get(name => 'bwPassThroughOut'); + $self->{cache_name} = "riverbed_" . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . + '_' . $self->{mode} . '_' . md5_hex('all'); + + $self->{global} = {}; - my $new_datas = {}; - $new_datas->{last_timestamp} = time(); - $new_datas->{bwPassThroughIn} = $bw_inn; - $new_datas->{bwPassThroughOut} = $bw_out; - - $self->{statefile_value}->write(data => $new_datas); - - if (!defined($old_timestamp) || !defined($old_bwPassThroughIn) || !defined($old_bwPassThroughOut)) { - $self->{output}->output_add(severity => 'OK', - short_msg => "Buffer creation..."); - $self->{output}->display(); - $self->{output}->exit(); + if (defined($result->{$oids->{bwPassThroughIn}})) { + foreach (keys %{$oids}) { + $self->{global}->{$_} = $result->{$oids->{$_}}; + } + } else { + foreach (keys %{$oids_ex}) { + $self->{global}->{$_} = $result->{$oids_ex->{$_}}; + } } - - $old_bwPassThroughIn = 0 if ($old_bwPassThroughIn > $new_datas->{bwPassThroughIn}); - $old_bwPassThroughOut = 0 if ($old_bwPassThroughOut > $new_datas->{bwPassThroughOut}); - - my $delta_time = $new_datas->{last_timestamp} - $old_timestamp; - $delta_time = 1 if ($delta_time == 0); - - my $bwPassThroughInPerSec = int(($new_datas->{bwPassThroughIn} - $old_bwPassThroughIn) / $delta_time); - my $bwPassThroughOutPerSec = int(($new_datas->{bwPassThroughOut} - $old_bwPassThroughOut) / $delta_time); - - my $exit1 = $self->{perfdata}->threshold_check(value => $bwPassThroughInPerSec, - threshold => [ { label => 'critical_in', exit_litteral => 'critical' }, { label => 'warning_in', exit_litteral => 'warning' } ]); - my $exit2 = $self->{perfdata}->threshold_check(value => $bwPassThroughOutPerSec, - threshold => [ { label => 'critical_out', exit_litteral => 'critical' }, { label => 'warning_out', exit_litteral => 'warning' } ]); - my $exit_code = $self->{output}->get_most_critical(status => [ $exit1, $exit2 ]); - - $self->{output}->perfdata_add(label => 'Traffic_In', unit => 'B/s', - value => $bwPassThroughInPerSec, - warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning_in'), - critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical_in'), - min => 0); - $self->{output}->perfdata_add(label => 'Traffic_Out', unit => 'B/s', - value => $bwPassThroughOutPerSec, - warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning_out'), - critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical_out'), - min => 0); - - my ($bwPassThroughInPerSec_value, $bwPassThroughInPerSec_unit) = $self->{perfdata}->change_bytes(value => $bwPassThroughInPerSec); - my ($bwPassThroughOutPerSec_value, $bwPassThroughOutPerSec_unit) = $self->{perfdata}->change_bytes(value => $bwPassThroughOutPerSec); - $self->{output}->output_add(severity => $exit_code, - short_msg => sprintf("Passthrough: Wan2Lan %s/s, Lan2Wan %s/s", - $bwPassThroughInPerSec_value . " " . $bwPassThroughInPerSec_unit, - $bwPassThroughOutPerSec_value . " " . $bwPassThroughOutPerSec_unit)); - - $self->{output}->display(); - $self->{output}->exit(); } 1; @@ -146,25 +115,19 @@ __END__ =head1 MODE -Check passthrough bandwidth in both directions (STEELHEAD-MIB). +Check passthrough bandwidth in both directions (STEELHEAD-MIB and STEELHEAD-EX-MIB). =over 8 -=item B<--warning-in> +=item B<--warning-traffic-*> -Threshold warning for Wan2Lan passthrough in bytes per second. +Threshold warning (Can be: 'in' (Wan2Lan), 'out' (Lan2Wan)) -=item B<--critical-in> +=item B<--critical-traffic-*> -Threshold critical for Wan2Lan passthrough in bytes per second. +Threshold critical (Can be: 'in' (Wan2Lan), 'out' (Lan2Wan)) -=item B<--warning-out> - -Threshold warning for Lan2Wan passthrough in bytes per second. - -=item B<--critical-out> - -Threshold critical for Lan2Wan passthrough in bytes per second. +=over 8 =back diff --git a/network/riverbed/steelhead/snmp/mode/connections.pm b/network/riverbed/steelhead/snmp/mode/connections.pm index acbde2d78..736bae7c5 100644 --- a/network/riverbed/steelhead/snmp/mode/connections.pm +++ b/network/riverbed/steelhead/snmp/mode/connections.pm @@ -113,6 +113,7 @@ sub new { sub manage_selection { my ($self, %options) = @_; + # STEELHEAD-MIB my $oids = { optimizedConnections => '.1.3.6.1.4.1.17163.1.1.5.2.1.0', passthroughConnections => '.1.3.6.1.4.1.17163.1.1.5.2.2.0', @@ -123,13 +124,29 @@ sub manage_selection { totalConnections => '.1.3.6.1.4.1.17163.1.1.5.2.7.0', }; - my $snmp_result = $options{snmp}->get_leef(oids => [ - values %$oids - ], nothing_quit => 1); + # STEELHEAD-EX-MIB + my $oids_ex = { + optimizedConnections => '.1.3.6.1.4.1.17163.1.51.5.2.1.0', + passthroughConnections => '.1.3.6.1.4.1.17163.1.51.5.2.2.0', + halfOpenedConnections => '.1.3.6.1.4.1.17163.1.51.5.2.3.0', + halfClosedConnections => '.1.3.6.1.4.1.17163.1.51.5.2.4.0', + establishedConnections => '.1.3.6.1.4.1.17163.1.51.5.2.5.0', + activeConnections => '.1.3.6.1.4.1.17163.1.51.5.2.6.0', + totalConnections => '.1.3.6.1.4.1.17163.1.51.5.2.7.0', + }; + + my $snmp_result = $options{snmp}->get_leef(oids => [ values %{$oids}, values %{$oids_ex} ], nothing_quit => 1); $self->{global} = {}; - foreach (keys %$oids) { - $self->{global}->{$_} = $snmp_result->{$oids->{$_}}; + + if (defined($snmp_result->{$oids->{optimizedConnections}})) { + foreach (keys %{$oids}) { + $self->{global}->{$_} = $snmp_result->{$oids->{$_}}; + } + } else { + foreach (keys %{$oids_ex}) { + $self->{global}->{$_} = $snmp_result->{$oids_ex->{$_}}; + } } } @@ -139,7 +156,8 @@ __END__ =head1 MODE -Current connections: total, established, active, optimized, passthrough, half opened and half closed ones (STEELHEAD-MIB). +Current connections: total, established, active, optimized, passthrough, +half opened and half closed ones (STEELHEAD-MIB and STEELHEAD-EX-MIB). =over 8 diff --git a/network/riverbed/steelhead/snmp/mode/diskutilization.pm b/network/riverbed/steelhead/snmp/mode/diskutilization.pm index 59cdc50f2..e9ed09107 100644 --- a/network/riverbed/steelhead/snmp/mode/diskutilization.pm +++ b/network/riverbed/steelhead/snmp/mode/diskutilization.pm @@ -57,10 +57,13 @@ sub run { my ($self, %options) = @_; $self->{snmp} = $options{snmp}; + # STEELHEAD-MIB my $oid_dsAveDiskUtilization = '.1.3.6.1.4.1.17163.1.1.5.4.4.0'; # in % + # STEELHEAD-EX-MIB + my $oid_ex_dsAveDiskUtilization = '.1.3.6.1.4.1.17163.1.51.5.4.4.0'; # in % - my $result = $self->{snmp}->get_leef(oids => [$oid_dsAveDiskUtilization], nothing_quit => 1); - my $disk_usage = $result->{$oid_dsAveDiskUtilization}; + my $result = $self->{snmp}->get_leef(oids => [$oid_dsAveDiskUtilization, $oid_ex_dsAveDiskUtilization], nothing_quit => 1); + my $disk_usage = defined($result->{$oid_dsAveDiskUtilization}) ? $result->{$oid_dsAveDiskUtilization} : $result->{$oid_ex_dsAveDiskUtilization}; my $exit = $self->{perfdata}->threshold_check(value => $disk_usage, threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]); @@ -85,7 +88,8 @@ __END__ =head1 MODE -Average disk utilization, a more accurate measurement of the underlying disk activities, and correlates directly to disk pressure (STEELHEAD-MIB). +Average disk utilization, a more accurate measurement of the underlying disk activities, +and correlates directly to disk pressure (STEELHEAD-MIB & STEELHEAD-EX-MIB). =over 8 diff --git a/network/riverbed/steelhead/snmp/mode/health.pm b/network/riverbed/steelhead/snmp/mode/health.pm index 1a1073e9d..2ba52df1b 100644 --- a/network/riverbed/steelhead/snmp/mode/health.pm +++ b/network/riverbed/steelhead/snmp/mode/health.pm @@ -20,17 +20,64 @@ package network::riverbed::steelhead::snmp::mode::health; -use base qw(centreon::plugins::mode); +use base qw(centreon::plugins::templates::counter); use strict; use warnings; -my %states = ( - 10000 => ['healthy', 'OK'], - 30000 => ['degraded', 'WARNING'], - 31000 => ['admissionControl', 'OK'], - 50000 => ['critical', 'CRITICAL'] -); +my $instance_mode; + +sub custom_status_threshold { + my ($self, %options) = @_; + my $status = 'ok'; + my $message; + eval { + local $SIG{__WARN__} = sub { $message = $_[0]; }; + local $SIG{__DIE__} = sub { $message = $_[0]; }; + if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' && + eval "$instance_mode->{option_results}->{critical_status}") { + $status = 'critical'; + } elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' && + eval "$instance_mode->{option_results}->{warning_status}") { + $status = 'warning'; + } + }; + if (defined($message)) { + $self->{output}->output_add(long_msg => 'filter status issue: ' . $message); + } + + return $status; +} + +sub custom_status_output { + my ($self, %options) = @_; + my $msg = "System health: '" . $self->{result_values}->{state} . "' "; + return $msg; +} + +sub custom_status_calc { + my ($self, %options) = @_; + $self->{result_values}->{state} = $options{new_datas}->{$self->{instance} . '_state'}; + return 0; +} + +sub set_counters { + my ($self, %options) = @_; + + $self->{maps_counters_type} = [ + { name => 'health', type => 0 }, + ]; + $self->{maps_counters}->{health} = [ + { label => 'status', threshold => 0, set => { + key_values => [ { name => 'state' } ], + closure_custom_calc => $self->can('custom_status_calc'), + closure_custom_output => $self->can('custom_status_output'), + closure_custom_perfdata => sub { return 0; }, + closure_custom_threshold_check => $self->can('custom_status_threshold'), + } + }, + ]; +} sub new { my ($class, %options) = @_; @@ -38,29 +85,54 @@ sub new { bless $self, $class; $self->{version} = '1.0'; + $options{options}->add_options(arguments => + { + "warning-status:s" => { name => 'warning_status', default => '%{state} =~ /degraded/' }, + "critical-status:s" => { name => 'critical_status', default => '%{state} =~ /(critical|admission)/' }, + }); return $self; } -sub check_options { +sub change_macros { my ($self, %options) = @_; - $self->SUPER::init(%options); + + foreach ('warning_status', 'critical_status') { + if (defined($self->{option_results}->{$_})) { + $self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g; + } + } } -sub run { +sub check_options { my ($self, %options) = @_; - $self->{snmp} = $options{snmp}; + $self->SUPER::check_options(%options); - my $oid_systemHealth = '.1.3.6.1.4.1.17163.1.1.2.7.0'; + $instance_mode = $self; + $self->change_macros(); +} - my $result = $self->{snmp}->get_leef(oids => [ $oid_systemHealth ], nothing_quit => 1); +my %map_status = ( + 10000 => 'healthy', + 30000 => 'degraded', + 31000 => 'admissionControl', + 50000 => 'critical', +); - $self->{output}->output_add(severity => ${$states{$result->{$oid_systemHealth}}}[1], - short_msg => sprintf("System health is '%s'", - ${$states{$result->{$oid_systemHealth}}}[0])); +sub manage_selection { + my ($self, %options) = @_; - $self->{output}->display(); - $self->{output}->exit(); + $self->{health} = {}; + + # STEELHEAD-MIB + my $oid_optSystemHealth = '.1.3.6.1.4.1.17163.1.1.2.7.0'; + # STEELHEAD-EX-MIB + my $oid_ex_optSystemHealth = '.1.3.6.1.4.1.17163.1.51.2.7.0'; + + my $result = $options{snmp}->get_leef(oids => [ $oid_optSystemHealth, $oid_ex_optSystemHealth ], nothing_quit => 1); + my $status = defined($result->{$oid_optSystemHealth}) ? $result->{$oid_optSystemHealth} : $result->{$oid_ex_optSystemHealth} ; + + $self->{health} = { state => $map_status{$status} }; } 1; @@ -69,10 +141,20 @@ __END__ =head1 MODE -Check the current health of the system. The value is one amongst Healthy, Admission Control, Degraded or Critical (STEELHEAD-MIB). +Check the global system health (STEELHEAD-MIB and STEELHEAD-EX-MIB). =over 8 +=item B<--warning-status> + +Set warning threshold for status (Default: '%{state} =~ /degraded/'). +Special var is %{state} + +=item B<--critical-status> + +Set critical threshold for status (Default: '%{state} !~ /(critical|admission)/'). +Special var is %{state} + =back =cut diff --git a/network/riverbed/steelhead/snmp/mode/loadaverage.pm b/network/riverbed/steelhead/snmp/mode/loadaverage.pm index 06139e9c4..c704edc35 100644 --- a/network/riverbed/steelhead/snmp/mode/loadaverage.pm +++ b/network/riverbed/steelhead/snmp/mode/loadaverage.pm @@ -18,105 +18,130 @@ # limitations under the License. # +# +# Copyright 2018 Centreon (http://www.centreon.com/) +# +# Centreon is a full-fledged industry-strength solution that meets +# the needs in IT infrastructure and application monitoring for +# service performance. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + package network::riverbed::steelhead::snmp::mode::loadaverage; -use base qw(centreon::plugins::mode); +use base qw(centreon::plugins::templates::counter); use strict; use warnings; +sub set_counters { + my ($self, %options) = @_; + + $self->{maps_counters_type} = [ + { name => 'load', type => 0, cb_prefix_output => 'prefix_load_output' }, + ]; + + $self->{maps_counters}->{load} = [ + { label => 'average', set => { + key_values => [ { name => 'cpuUtil1' } ], + output_template => 'average: %d%%', + perfdatas => [ + { label => 'total_cpu_avg', value => 'cpuUtil1_absolute', template => '%d', + min => 0, max => 100, unit => '%' }, + ], + } + }, + { label => '1min', set => { + key_values => [ { name => 'cpuLoad1' } ], + output_template => '1 min: %d%%', + perfdatas => [ + { label => 'load1', value => 'cpuLoad1_absolute', template => '%d', + min => 0, max => 100, unit => '%' }, + ], + } + }, + { label => '5min', set => { + key_values => [ { name => 'cpuLoad5' } ], + output_template => '5 min: %d%%', + perfdatas => [ + { label => 'load5', value => 'cpuLoad5_absolute', template => '%d', + min => 0, max => 100, unit => "%" }, + ], + } + }, + { label => '15min', set => { + key_values => [ { name => 'cpuLoad15' } ], + output_template => '15 min: %d%%', + perfdatas => [ + { label => 'load15', value => 'cpuLoad15_absolute', template => '%d', + min => 0, max => 100, unit => '%' }, + ], + } + }, + ]; +} + +sub prefix_load_output { + my ($self, %options) = @_; + + return "Load "; +} + sub new { my ($class, %options) = @_; my $self = $class->SUPER::new(package => __PACKAGE__, %options); bless $self, $class; - $self->{version} = '1.0'; + $self->{version} = '0.1'; $options{options}->add_options(arguments => { - "warning:s" => { name => 'warning', default => '' }, - "critical:s" => { name => 'critical', default => '' } }); - return $self; } -sub check_options { +sub manage_selection { my ($self, %options) = @_; - $self->SUPER::init(%options); - ($self->{warn1}, $self->{warn5}, $self->{warn15}) = split /,/, $self->{option_results}->{warning}; - ($self->{crit1}, $self->{crit5}, $self->{crit15}) = split /,/, $self->{option_results}->{critical}; + # STEELHEAD-MIB + my $oids = { + cpuUtil1 => '.1.3.6.1.4.1.17163.1.1.5.1.1.0', + cpuLoad1 => '.1.3.6.1.4.1.17163.1.1.5.1.2.0', + cpuLoad5 => '.1.3.6.1.4.1.17163.1.1.5.1.3.0', + cpuLoad15 => '.1.3.6.1.4.1.17163.1.1.5.1.4.0', + }; - if (($self->{perfdata}->threshold_validate(label => 'warn1', value => $self->{warn1})) == 0) { - $self->{output}->add_option_msg(short_msg => "Wrong warning (1min) threshold '" . $self->{warn1} . "'."); - $self->{output}->option_exit(); + # STEELHEAD-EX-MIB + my $oids_ex = { + cpuUtil1 => '.1.3.6.1.4.1.17163.1.51.5.1.1.0', + cpuLoad1 => '.1.3.6.1.4.1.17163.1.51.5.1.2.0', + cpuLoad5 => '.1.3.6.1.4.1.17163.1.51.5.1.3.0', + cpuLoad15 => '.1.3.6.1.4.1.17163.1.51.5.1.4.0', + }; + + my $snmp_result = $options{snmp}->get_leef(oids => [ values %{$oids}, values %{$oids_ex} ], nothing_quit => 1); + + $self->{load} = {}; + + if (defined($snmp_result->{$oids->{cpuUtil1}})) { + foreach (keys %{$oids}) { + $self->{load}->{$_} = $snmp_result->{$oids->{$_}}; + } + } else { + foreach (keys %{$oids}) { + $self->{load}->{$_} = $snmp_result->{$oids_ex->{$_}}; + } } - if (($self->{perfdata}->threshold_validate(label => 'warn5', value => $self->{warn5})) == 0) { - $self->{output}->add_option_msg(short_msg => "Wrong warning (5min) threshold '" . $self->{warn5} . "'."); - $self->{output}->option_exit(); - } - if (($self->{perfdata}->threshold_validate(label => 'warn15', value => $self->{warn15})) == 0) { - $self->{output}->add_option_msg(short_msg => "Wrong warning (15min) threshold '" . $self->{warn15} . "'."); - $self->{output}->option_exit(); - } - if (($self->{perfdata}->threshold_validate(label => 'crit1', value => $self->{crit1})) == 0) { - $self->{output}->add_option_msg(short_msg => "Wrong critical (1min) threshold '" . $self->{crit1} . "'."); - $self->{output}->option_exit(); - } - if (($self->{perfdata}->threshold_validate(label => 'crit5', value => $self->{crit5})) == 0) { - $self->{output}->add_option_msg(short_msg => "Wrong critical (5min) threshold '" . $self->{crit5} . "'."); - $self->{output}->option_exit(); - } - if (($self->{perfdata}->threshold_validate(label => 'crit15', value => $self->{crit15})) == 0) { - $self->{output}->add_option_msg(short_msg => "Wrong critical (15min) threshold '" . $self->{crit15} . "'."); - $self->{output}->option_exit(); - } -} - -sub run { - my ($self, %options) = @_; - $self->{snmp} = $options{snmp}; - - my $oid_cpuLoad1 = '.1.3.6.1.4.1.17163.1.1.5.1.1.0'; - my $oid_cpuLoad5 = '.1.3.6.1.4.1.17163.1.1.5.1.2.0'; - my $oid_cpuLoad15 = '.1.3.6.1.4.1.17163.1.1.5.1.3.0'; - - my $result = $self->{snmp}->get_leef(oids => [$oid_cpuLoad1, $oid_cpuLoad5, $oid_cpuLoad15], nothing_quit => 1); - - my $cpu_load1 = $result->{$oid_cpuLoad1} / 100; - my $cpu_load5 = $result->{$oid_cpuLoad5} / 100; - my $cpu_load15 = $result->{$oid_cpuLoad15} / 100; - - my $msg = sprintf("Load average: %.2f (1min), %.2f (5min), %.2f (15min)", $cpu_load1, $cpu_load5, $cpu_load15); - - $self->{output}->perfdata_add(label => 'load1', - value => sprintf("%.2f", $cpu_load1), - warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn1'), - critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit1'), - min => 0); - $self->{output}->perfdata_add(label => 'load5', - value => sprintf("%.2f", $cpu_load5), - warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn5'), - critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit5'), - min => 0); - $self->{output}->perfdata_add(label => 'load15', - value => sprintf("%.2f", $cpu_load15), - warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn15'), - critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit15'), - min => 0); - - my $exit1 = $self->{perfdata}->threshold_check(value => $cpu_load1, - threshold => [ { label => 'crit1', exit_litteral => 'critical' }, { label => 'warn1', exit_litteral => 'warning' } ]); - my $exit2 = $self->{perfdata}->threshold_check(value => $cpu_load5, - threshold => [ { label => 'crit5', exit_litteral => 'critical' }, { label => 'warn5', exit_litteral => 'warning' } ]); - my $exit3 = $self->{perfdata}->threshold_check(value => $cpu_load15, - threshold => [ { label => 'crit15', exit_litteral => 'critical' }, { label => 'warn15', exit_litteral => 'warning' } ]); - my $exit = $self->{output}->get_most_critical(status => [ $exit1, $exit2, $exit3 ]); - $self->{output}->output_add(severity => $exit, - short_msg => $msg); - - $self->{output}->display(); - $self->{output}->exit(); } 1; @@ -129,13 +154,15 @@ Check system load-average. =over 8 -=item B<--warning> +=item B<--warning-*> -Threshold warning (1min,5min,15min). +Warning thresholds +Can be --warning-(average|1m|5m|15m) -=item B<--critical> +=item B<--critical-*> -Threshold critical (1min,5min,15min). +Critical thresholds +Can be --critical-(average|1m|5m|15m) =back diff --git a/network/riverbed/steelhead/snmp/mode/servicestatus.pm b/network/riverbed/steelhead/snmp/mode/servicestatus.pm index 7430fa02a..301b2e920 100644 --- a/network/riverbed/steelhead/snmp/mode/servicestatus.pm +++ b/network/riverbed/steelhead/snmp/mode/servicestatus.pm @@ -20,52 +20,124 @@ package network::riverbed::steelhead::snmp::mode::servicestatus; -use base qw(centreon::plugins::mode); +use base qw(centreon::plugins::templates::counter); use strict; use warnings; -my %states = ( - 0 => ['none', 'CRITICAL'], - 1 => ['unmanaged', 'CRITICAL'], - 2 => ['running', 'OK'], - 3 => ['sentCom1', 'CRITICAL'], - 4 => ['sentTerm1', 'CRITICAL'], - 5 => ['sentTerm2', 'CRITICAL'], - 6 => ['sentTerm3', 'CRITICAL'], - 7 => ['pending', 'CRITICAL'], - 8 => ['stopped', 'CRITICAL'], -); +my $instance_mode; + +sub custom_status_threshold { + my ($self, %options) = @_; + my $status = 'ok'; + my $message; + eval { + local $SIG{__WARN__} = sub { $message = $_[0]; }; + local $SIG{__DIE__} = sub { $message = $_[0]; }; + if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' && + eval "$instance_mode->{option_results}->{critical_status}") { + $status = 'critical'; + } elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' && + eval "$instance_mode->{option_results}->{warning_status}") { + $status = 'warning'; + } + }; + if (defined($message)) { + $self->{output}->output_add(long_msg => 'filter status issue: ' . $message); + } + + return $status; +} + +sub custom_status_output { + my ($self, %options) = @_; + my $msg = "Optimization service state: '" . $self->{result_values}->{state} . "' "; + return $msg; +} + +sub custom_status_calc { + my ($self, %options) = @_; + $self->{result_values}->{state} = $options{new_datas}->{$self->{instance} . '_state'}; + return 0; +} + +sub set_counters { + my ($self, %options) = @_; + + $self->{maps_counters_type} = [ + { name => 'opt_service', type => 0 }, + ]; + $self->{maps_counters}->{opt_service} = [ + { label => 'status', threshold => 0, set => { + key_values => [ { name => 'state' } ], + closure_custom_calc => $self->can('custom_status_calc'), + closure_custom_output => $self->can('custom_status_output'), + closure_custom_perfdata => sub { return 0; }, + closure_custom_threshold_check => $self->can('custom_status_threshold'), + } + }, + ]; +} sub new { my ($class, %options) = @_; my $self = $class->SUPER::new(package => __PACKAGE__, %options); bless $self, $class; - $self->{version} = '0.1'; + $self->{version} = '1.0'; + $options{options}->add_options(arguments => + { + "warning-status:s" => { name => 'warning_status', default => '' }, + "critical-status:s" => { name => 'critical_status', default => '%{status} !~ /running/' }, + }); return $self; } -sub check_options { +sub change_macros { my ($self, %options) = @_; - $self->SUPER::init(%options); + + foreach ('warning_status', 'critical_status') { + if (defined($self->{option_results}->{$_})) { + $self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g; + } + } } -sub run { +sub check_options { my ($self, %options) = @_; - $self->{snmp} = $options{snmp}; + $self->SUPER::check_options(%options); + $instance_mode = $self; + $self->change_macros(); +} + +my %map_status = ( + 0 => 'none', + 1 => 'unmanaged', + 2 => 'running', + 3 => 'sentCom1', + 4 => 'sentTerm1', + 5 => 'sentTerm2', + 6 => 'sentTerm3', + 7 => 'pending', + 8 => 'stopped', +); + +sub manage_selection { + my ($self, %options) = @_; + + $self->{opt_service} = {}; + + # STEELHEAD-MIB my $oid_optServiceStatus = '.1.3.6.1.4.1.17163.1.1.2.8.0'; + # STEELHEAD-EX-MIB + my $oid_ex_optServiceStatus = '.1.3.6.1.4.1.17163.1.51.2.8.0'; - my $result = $self->{snmp}->get_leef(oids => [ $oid_optServiceStatus ], nothing_quit => 1); + my $result = $options{snmp}->get_leef(oids => [ $oid_optServiceStatus, $oid_ex_optServiceStatus ], nothing_quit => 1); + my $status = defined($result->{$oid_optServiceStatus}) ? $result->{$oid_optServiceStatus} : $result->{$oid_ex_optServiceStatus} ; - $self->{output}->output_add(severity => ${$states{$result->{$oid_optServiceStatus}}}[1], - short_msg => sprintf("Optimization service status is '%s'", - ${$states{$result->{$oid_optServiceStatus}}}[0])); - - $self->{output}->display(); - $self->{output}->exit(); + $self->{opt_service} = { state => $map_status{$status} }; } 1; @@ -74,10 +146,20 @@ __END__ =head1 MODE -Check the current status of the optimization service (STEELHEAD-MIB). +Check the current status of the optimization service (STEELHEAD-MIB and STEELHEAD-EX-MIB). =over 8 +=item B<--warning-status> + +Set warning threshold for status (Default: ''). +Special var is %{state} + +=item B<--critical-status> + +Set critical threshold for status (Default: '%{state} !~ /running/'). +Special var is %{state} + =back =cut diff --git a/network/riverbed/steelhead/snmp/mode/serviceuptime.pm b/network/riverbed/steelhead/snmp/mode/serviceuptime.pm index 938f23a97..6fd239419 100644 --- a/network/riverbed/steelhead/snmp/mode/serviceuptime.pm +++ b/network/riverbed/steelhead/snmp/mode/serviceuptime.pm @@ -24,7 +24,7 @@ use base qw(centreon::plugins::mode); use strict; use warnings; -use POSIX; +use centreon::plugins::misc; sub new { my ($class, %options) = @_; @@ -60,23 +60,24 @@ sub run { my ($self, %options) = @_; $self->{snmp} = $options{snmp}; + # STEELHEAD-MIB my $oid_serviceUptime = '.1.3.6.1.4.1.17163.1.1.2.4.0'; - my ($result, $value); + # STEELHEAD-EX-MIB + my $oid_ex_serviceUptime = '.1.3.6.1.4.1.17163.1.51.2.4.0'; - $result = $self->{snmp}->get_leef(oids => [ $oid_serviceUptime ], nothing_quit => 1); - $value = $result->{$oid_serviceUptime}; + my $result = $self->{snmp}->get_leef(oids => [ $oid_serviceUptime, $oid_ex_serviceUptime ], nothing_quit => 1); + my $value = defined($result->{$oid_serviceUptime}) ? $result->{$oid_serviceUptime} : $result->{$oid_ex_serviceUptime}; - my $exit_code = $self->{perfdata}->threshold_check(value => floor($value / 100), + my $exit_code = $self->{perfdata}->threshold_check(value => sprintf("%d", $value / 100), threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]); $self->{output}->perfdata_add(label => 'uptime', unit => 's', - value => floor($value / 100), + value => sprintf("%d", $value / 100), warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'), critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'), min => 0); $self->{output}->output_add(severity => $exit_code, - short_msg => sprintf("Service uptime is: %s", - defined($self->{option_results}->{seconds}) ? floor($value / 100) . " seconds" : floor($value / 86400 / 100) . " days" )); + short_msg => sprintf("Service uptime is: %s", centreon::plugins::misc::change_seconds(value => $value / 100))); $self->{output}->display(); $self->{output}->exit(); @@ -88,7 +89,7 @@ __END__ =head1 MODE -Uptime of the optimization service (STEELHEAD-MIB). +Uptime of the optimization service (STEELHEAD-MIB and STEELHEAD-EX-MIB). =over 8 diff --git a/network/riverbed/steelhead/snmp/mode/temperature.pm b/network/riverbed/steelhead/snmp/mode/temperature.pm index deac1d38f..dfc05ac41 100644 --- a/network/riverbed/steelhead/snmp/mode/temperature.pm +++ b/network/riverbed/steelhead/snmp/mode/temperature.pm @@ -57,10 +57,13 @@ sub run { my ($self, %options) = @_; $self->{snmp} = $options{snmp}; + # STEELHEAD-MIB my $oid_systemTemperature = '.1.3.6.1.4.1.17163.1.1.2.9.0'; # in Celsius + # STEELHEAD-EX-MIB + my $oid_ex_systemTemperature = '.1.3.6.1.4.1.17163.1.51.2.9.0'; # in Celsius - my $result = $self->{snmp}->get_leef(oids => [$oid_systemTemperature], nothing_quit => 1); - my $temp = $result->{$oid_systemTemperature}; + my $result = $self->{snmp}->get_leef(oids => [$oid_systemTemperature, $oid_ex_systemTemperature], nothing_quit => 1); + my $temp = defined($result->{$oid_systemTemperature}) ? $result->{$oid_systemTemperature} : $result->{$oid_ex_systemTemperature}; my $exit = $self->{perfdata}->threshold_check(value => $temp, threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]); @@ -84,7 +87,7 @@ __END__ =head1 MODE -Check the temperature of the system in Celcius (STEELHEAD-MIB). +Check the temperature of the system in Celcius (STEELHEAD-MIB AND STEELHEAD-EX-MIB). =over 8