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

Commit 55bb5a0

Browse files
committed
add performance data for snapmirror, and linefeed option for output
1 parent ff81fa4 commit 55bb5a0

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
@@ -1161,6 +1162,7 @@ sub calc_snapmirror_health {
11611162
my $intState = 0;
11621163
my $intObjectCount = 0;
11631164
my $strOutput;
1165+
my %perfOutput = ();
11641166

11651167
foreach my $strSM (keys %$hrefSMInfo) {
11661168
$intObjectCount = $intObjectCount + 1;
@@ -1189,13 +1191,18 @@ sub calc_snapmirror_health {
11891191
$intState = get_nagios_state($intState, 1);
11901192
}
11911193
}
1194+
$perfOutput{"snapmirror-$strSM"} = "'" . $strSM . "_snapmirror'=" . $hrefSMInfo->{$strSM}->{'lag'} . "s;" . $hrefWarnThresholds->{'lag-time'} . ";" . $hrefCritThresholds->{'lag-time'} . ";;";
11921195
}
11931196

11941197
# If everything looks ok and no output has been defined then set the message to display OK.
11951198
if (!(defined($strOutput))) {
11961199
$strOutput = "OK - No problem found ($intObjectCount checked)";
11971200
}
11981201

1202+
if (keys(%perfOutput) > 0) {
1203+
$strOutput .= ("\n| " . join(' ', values(%perfOutput)));
1204+
}
1205+
11991206
return $intState, $strOutput;
12001207
}
12011208

@@ -1970,6 +1977,8 @@ sub help {
19701977
This modifier is used to set an inclusive or exclusive filter on what you want to monitor.
19711978
--report, -r
19721979
The output format. Can be "short", "long" (default), or "html"
1980+
--linefeed, -l
1981+
Use linefeed for object separation instead of comma (requires nagios 3.x or later)
19731982
--verbose, --debug, --trace
19741983
Debug output options
19751984
--help, -h
@@ -2104,7 +2113,7 @@ sub get_nagios_description {
21042113
if (!(defined($strOutput))) {
21052114
$strOutput = $strNewMessage;
21062115
} else {
2107-
$strOutput .= ", " . $strNewMessage;
2116+
$strOutput .= (defined $lineFeed ? "\n" : ", ") . $strNewMessage;
21082117
}
21092118

21102119
return $strOutput;
@@ -2214,6 +2223,7 @@ sub filter_object {
22142223
"c=s" => \$strCritical, "critical=s" => \$strCritical,
22152224
"m=s" => \$strModifier, "modifier=s" => \$strModifier,
22162225
"r=s" => \$strReport, "report=s" => \$strReport,
2226+
"l" => \$lineFeed, "linefeed" => \$lineFeed,
22172227
"verbose" => \$verbose,
22182228
"debug" => \$debug,
22192229
"trace" => \$trace,

0 commit comments

Comments
 (0)