Skip to content
This repository was archived by the owner on Jul 31, 2025. It is now read-only.

Commit 37b80e7

Browse files
ngarrattNeil Garratt - bastionwt1
authored andcommitted
add performance data for snapmirror, and linefeed option for output
1 parent 6c85ef8 commit 37b80e7

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

check_netapp_ontap.pl

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
if ($verbose || $debug || $trace) {
3333
use Data::Dumper;
3434
}
35+
my $lineFeed = undef;
3536

3637
##############################################
3738
## DISK HEALTH
@@ -1144,6 +1145,7 @@ sub calc_snapmirror_health {
11441145
my $intState = 0;
11451146
my $intObjectCount = 0;
11461147
my $strOutput;
1148+
my %perfOutput = ();
11471149

11481150
foreach my $strSM (keys %$hrefSMInfo) {
11491151
$intObjectCount = $intObjectCount + 1;
@@ -1172,13 +1174,18 @@ sub calc_snapmirror_health {
11721174
$intState = get_nagios_state($intState, 1);
11731175
}
11741176
}
1177+
$perfOutput{"snapmirror-$strSM"} = "'" . $strSM . "_snapmirror'=" . $hrefSMInfo->{$strSM}->{'lag'} . "s;" . $hrefWarnThresholds->{'lag-time'} . ";" . $hrefCritThresholds->{'lag-time'} . ";;";
11751178
}
11761179

11771180
# If everything looks ok and no output has been defined then set the message to display OK.
11781181
if (!(defined($strOutput))) {
11791182
$strOutput = "OK - No problem found ($intObjectCount checked)";
11801183
}
11811184

1185+
if (keys(%perfOutput) > 0) {
1186+
$strOutput .= ("\n| " . join(' ', values(%perfOutput)));
1187+
}
1188+
11821189
return $intState, $strOutput;
11831190
}
11841191

@@ -1943,6 +1950,8 @@ sub help {
19431950
This modifier is used to set an inclusive or exclusive filter on what you want to monitor.
19441951
--report, -r
19451952
The output format. Can be "short", "long" (default), or "html"
1953+
--linefeed, -l
1954+
Use linefeed for object separation instead of comma (requires nagios 3.x or later)
19461955
--verbose, --debug, --trace
19471956
Debug output options
19481957
--help, -h
@@ -2077,7 +2086,7 @@ sub get_nagios_description {
20772086
if (!(defined($strOutput))) {
20782087
$strOutput = $strNewMessage;
20792088
} else {
2080-
$strOutput .= ", " . $strNewMessage;
2089+
$strOutput .= (defined $lineFeed ? "\n" : ", ") . $strNewMessage;
20812090
}
20822091

20832092
return $strOutput;
@@ -2187,6 +2196,7 @@ sub filter_object {
21872196
"c=s" => \$strCritical, "critical=s" => \$strCritical,
21882197
"m=s" => \$strModifier, "modifier=s" => \$strModifier,
21892198
"r=s" => \$strReport, "report=s" => \$strReport,
2199+
"l" => \$lineFeed, "linefeed" => \$lineFeed,
21902200
"verbose" => \$verbose,
21912201
"debug" => \$debug,
21922202
"trace" => \$trace,

0 commit comments

Comments
 (0)