From 0639d52061f9fd485241e4906dacbbdffc6cb8f4 Mon Sep 17 00:00:00 2001 From: dgalloway Date: Wed, 16 Sep 2015 10:51:17 -0400 Subject: [PATCH] Some useful comments explaining functions --- roles/testnode/files/libexec/smart.pl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/roles/testnode/files/libexec/smart.pl b/roles/testnode/files/libexec/smart.pl index 351bd6a..23b0818 100644 --- a/roles/testnode/files/libexec/smart.pl +++ b/roles/testnode/files/libexec/smart.pl @@ -8,8 +8,8 @@ my $warn; my $crit; my $out; -my @out; -my @failedout; +my @out; # array of output messages +my @failedout; # array of failed drive numbers my $drives; my $pci; my $type; @@ -28,6 +28,7 @@ our $realloc = '50'; our $pend = '1'; our $uncorrect = '1'; +# output in human readable and nagios multiline format if ($ARGV[0] =~ /-m/) { $multiline = 1; } @@ -244,6 +245,7 @@ foreach my $keys (keys %counts) { $uniquedrives++; } +# print multiline/nagios output if -m flag used if ($ARGV[0] =~ /-m/) { if (@out) { print "$uniquedrives of $drives drives failing/missing |\n"; @@ -256,6 +258,8 @@ if ($ARGV[0] =~ /-m/) { } else { if (@out) { + # this outputs all messages to one line presumably + # because nagios < v3.0 couldn't handle multiline output $out = join('; ', @out); } -- 2.39.5