From 075bd2e20bfdb2d4af7da4292fb1b6091a40b6c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1ll=20Gu=C3=B0j=C3=B3n=20Sigur=C3=B0sson?= Date: Fri, 13 Aug 2010 13:14:35 +0000 Subject: [PATCH] IP address added to output --- check_disks.pl/trunk/check_disks.pl | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/check_disks.pl/trunk/check_disks.pl b/check_disks.pl/trunk/check_disks.pl index 54327b5..e974d98 100755 --- a/check_disks.pl/trunk/check_disks.pl +++ b/check_disks.pl/trunk/check_disks.pl @@ -338,26 +338,29 @@ my $cmp_warn=0; # compteur de disques en avertissement my $cmp_crit=0; # compteur de disques critiques my $perf_data=""; # Donnees de perf +my $critical_disks = ""; +my $warning_disks = ""; +my $ok_disks = ""; + # Tests Warn et Crit de tous les fs et creation de l'output foreach my $f (keys %checkdisks) { + if ($opt_v) { $output .= "\n"; } if($checkdisks{$f}->{pfree} < $checkdisks{$f}->{critical}) { + $critical_disks .= " " . $f ; $cmp_crit++; - $output .= "[$f " . byte2human($checkdisks{$f}->{free}) . - " (" . $checkdisks{$f}->{pfree} . '% free)] '; - $output .= "
" if ($opt_html); } elsif ($checkdisks{$f}->{pfree} < $checkdisks{$f}->{warning}) { + $warning_disks .= " " . $f ; $cmp_warn++; - $output .= "[$f " . byte2human($checkdisks{$f}->{free}) . - " (" . $checkdisks{$f}->{pfree} . '% free)] '; - $output .= "
" if ($opt_html); } else { - if ($opt_v) { - $output .= "\n[$f " . byte2human($checkdisks{$f}->{free}) . - " (" . $checkdisks{$f}->{pfree} . '% free)] ' ; - $output .= "
" if ($opt_html); - } + $ok_disks .= " " . $f ; } + $output .= "[$f " . byte2human($checkdisks{$f}->{free}) . + " (" . $checkdisks{$f}->{pfree} . '% free) ;' . + "warning=" . $checkdisks{$f}->{warning} . "% " . + "critical=" . $checkdisks{$f}->{critical} . "% " . + '] ' ; + $output .= "
" if ($opt_html); #$output .= "\n"; # Donnees de Perfs @@ -403,7 +406,7 @@ if (-d $opt_srvperf) { # Sortie du plugin : sans donnees de perfs qui sont stockes # dans d'autres fichiers -print "DISK $retour $output | $perf_data\n"; +print "DISK $retour $critical_disks $warning_disks ... $output | $perf_data\n"; exit $EXIT_CODES{$retour}; ##########################################################################