+ Enhance riverbed check

This commit is contained in:
garnier-quentin 2015-06-17 12:09:36 +02:00
parent 1c718848d7
commit 7aed778063
6 changed files with 35 additions and 26 deletions

View File

@ -47,8 +47,8 @@ sub new {
$self->{version} = '0.5'; $self->{version} = '0.5';
%{$self->{modes}} = ( %{$self->{modes}} = (
'sessions' => 'network::cisco::WaaS::mode::sessions', 'sessions' => 'network::cisco::WaaS::mode::sessions',
); );
return $self; return $self;
} }

View File

@ -115,22 +115,30 @@ sub run {
my $bwHCAggOutLanPerSec = int(($new_datas->{bwHCAggOutLan} - $old_bwHCAggOutLan) / $delta_time); my $bwHCAggOutLanPerSec = int(($new_datas->{bwHCAggOutLan} - $old_bwHCAggOutLan) / $delta_time);
my $bwHCAggOutWanPerSec = int(($new_datas->{bwHCAggOutWan} - $old_bwHCAggOutWan) / $delta_time); my $bwHCAggOutWanPerSec = int(($new_datas->{bwHCAggOutWan} - $old_bwHCAggOutWan) / $delta_time);
$self->{output}->perfdata_add(label => 'wan2lan_lan', $self->{output}->perfdata_add(label => 'wan2lan_lan', unit => 'B/s',
value => $bwHCAggInLanPerSec, value => $bwHCAggInLanPerSec,
min => 0); min => 0);
$self->{output}->perfdata_add(label => 'wan2lan_wan', $self->{output}->perfdata_add(label => 'wan2lan_wan', unit => 'B/s',
value => $bwHCAggInWanPerSec, value => $bwHCAggInWanPerSec,
min => 0); min => 0);
$self->{output}->perfdata_add(label => 'lan2wan_lan', $self->{output}->perfdata_add(label => 'lan2wan_lan', unit => 'B/s',
value => $bwHCAggOutLanPerSec, value => $bwHCAggOutLanPerSec,
min => 0); min => 0);
$self->{output}->perfdata_add(label => 'lan2wan_wan', $self->{output}->perfdata_add(label => 'lan2wan_wan', unit => 'B/s',
value => $bwHCAggOutWanPerSec, value => $bwHCAggOutWanPerSec,
min => 0); 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', $self->{output}->output_add(severity => 'OK',
short_msg => sprintf("Optimized: Wan2Lan on Lan - %s bytes/sec, Wan2Lan on Wan - %s bytes/sec, Lan2Wan on Lan - %s bytes/sec, Lan2Wan on Wan - %s bytes/sec.", 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, $bwHCAggInWanPerSec, $bwHCAggOutLanPerSec, $bwHCAggOutWanPerSec)); $bwHCAggInLanPerSec_value . " " . $bwHCAggInLanPerSec_unit,
$bwHCAggInWanPerSec_value . " " . $bwHCAggInWanPerSec_unit,
$bwHCAggOutLanPerSec_value . " " . $bwHCAggOutLanPerSec_unit,
$bwHCAggOutWanPerSec_value . " " . $bwHCAggOutWanPerSec_unit
));
$self->{output}->display(); $self->{output}->display();
$self->{output}->exit(); $self->{output}->exit();

View File

@ -134,20 +134,23 @@ sub run {
threshold => [ { label => 'critical_out', exit_litteral => 'critical' }, { label => 'warning_out', exit_litteral => 'warning' } ]); threshold => [ { label => 'critical_out', exit_litteral => 'critical' }, { label => 'warning_out', exit_litteral => 'warning' } ]);
my $exit_code = $self->{output}->get_most_critical(status => [ $exit1, $exit2 ]); my $exit_code = $self->{output}->get_most_critical(status => [ $exit1, $exit2 ]);
$self->{output}->perfdata_add(label => 'Traffic_In', $self->{output}->perfdata_add(label => 'Traffic_In', unit => 'B/s',
value => $bwPassThroughInPerSec, value => $bwPassThroughInPerSec,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning_in'), warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning_in'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical_in'), critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical_in'),
min => 0); min => 0);
$self->{output}->perfdata_add(label => 'Traffic_Out', $self->{output}->perfdata_add(label => 'Traffic_Out', unit => 'B/s',
value => $bwPassThroughOutPerSec, value => $bwPassThroughOutPerSec,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning_out'), warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning_out'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical_out'), critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical_out'),
min => 0); 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, $self->{output}->output_add(severity => $exit_code,
short_msg => sprintf("Passthrough: Wan2Lan - %s bytes/sec, Lan2Wan - %s bytes/sec.", short_msg => sprintf("Passthrough: Wan2Lan %s/s, Lan2Wan %s/s",
$bwPassThroughInPerSec, $bwPassThroughOutPerSec)); $bwPassThroughInPerSec_value . " " . $bwPassThroughInPerSec_unit,
$bwPassThroughOutPerSec_value . " " . $bwPassThroughOutPerSec_unit));
$self->{output}->display(); $self->{output}->display();
$self->{output}->exit(); $self->{output}->exit();

View File

@ -88,6 +88,7 @@ sub run {
value => $disk_usage, value => $disk_usage,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'), warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'), critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
min => 0, max => 100
); );
$self->{output}->display(); $self->{output}->display();

View File

@ -99,30 +99,27 @@ sub run {
my $result = $self->{snmp}->get_leef(oids => [$oid_cpuLoad1, $oid_cpuLoad5, $oid_cpuLoad15], nothing_quit => 1); my $result = $self->{snmp}->get_leef(oids => [$oid_cpuLoad1, $oid_cpuLoad5, $oid_cpuLoad15], nothing_quit => 1);
my $cpu_load1 = $result->{$oid_cpuLoad1}; my $cpu_load1 = $result->{$oid_cpuLoad1} / 100;
my $cpu_load5 = $result->{$oid_cpuLoad5}; my $cpu_load5 = $result->{$oid_cpuLoad5} / 100;
my $cpu_load15 = $result->{$oid_cpuLoad15}; my $cpu_load15 = $result->{$oid_cpuLoad15} / 100;
my $msg = sprintf("Load averages: %s %% (1min), %s %% (5min), %s %% (15min)", $cpu_load1, $cpu_load5, $cpu_load15); my $msg = sprintf("Load average: %.2f (1min), %.2f (5min), %.2f (15min)", $cpu_load1, $cpu_load5, $cpu_load15);
$self->{output}->perfdata_add(label => 'load1', $self->{output}->perfdata_add(label => 'load1',
value => $cpu_load1, value => sprintf("%.2f", $cpu_load1),
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn1'), warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn1'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit1'), critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit1'),
min => 0, min => 0);
max => 100);
$self->{output}->perfdata_add(label => 'load5', $self->{output}->perfdata_add(label => 'load5',
value => $cpu_load5, value => sprintf("%.2f", $cpu_load5),
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn5'), warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn5'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit5'), critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit5'),
min => 0, min => 0);
max => 100);
$self->{output}->perfdata_add(label => 'load15', $self->{output}->perfdata_add(label => 'load15',
value => $cpu_load15, value => sprintf("%.2f", $cpu_load15),
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn15'), warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn15'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit15'), critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit15'),
min => 0, min => 0);
max => 100);
my $exit1 = $self->{perfdata}->threshold_check(value => $cpu_load1, my $exit1 = $self->{perfdata}->threshold_check(value => $cpu_load1,
threshold => [ { label => 'crit1', exit_litteral => 'critical' }, { label => 'warn1', exit_litteral => 'warning' } ]); threshold => [ { label => 'crit1', exit_litteral => 'critical' }, { label => 'warn1', exit_litteral => 'warning' } ]);

View File

@ -84,7 +84,7 @@ sub run {
my $exit_code = $self->{perfdata}->threshold_check(value => floor($value / 100), my $exit_code = $self->{perfdata}->threshold_check(value => floor($value / 100),
threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]); threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
$self->{output}->perfdata_add(label => 'uptime', $self->{output}->perfdata_add(label => 'uptime', unit => 's',
value => floor($value / 100), value => floor($value / 100),
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'), warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'), critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),