|
32 | 32 | if ($verbose || $debug || $trace) { |
33 | 33 | use Data::Dumper; |
34 | 34 | } |
| 35 | +my $lineFeed = undef; |
35 | 36 |
|
36 | 37 | ############################################## |
37 | 38 | ## DISK HEALTH |
@@ -1161,6 +1162,7 @@ sub calc_snapmirror_health { |
1161 | 1162 | my $intState = 0; |
1162 | 1163 | my $intObjectCount = 0; |
1163 | 1164 | my $strOutput; |
| 1165 | + my %perfOutput = (); |
1164 | 1166 |
|
1165 | 1167 | foreach my $strSM (keys %$hrefSMInfo) { |
1166 | 1168 | $intObjectCount = $intObjectCount + 1; |
@@ -1189,13 +1191,18 @@ sub calc_snapmirror_health { |
1189 | 1191 | $intState = get_nagios_state($intState, 1); |
1190 | 1192 | } |
1191 | 1193 | } |
| 1194 | + $perfOutput{"snapmirror-$strSM"} = "'" . $strSM . "_snapmirror'=" . $hrefSMInfo->{$strSM}->{'lag'} . "s;" . $hrefWarnThresholds->{'lag-time'} . ";" . $hrefCritThresholds->{'lag-time'} . ";;"; |
1192 | 1195 | } |
1193 | 1196 |
|
1194 | 1197 | # If everything looks ok and no output has been defined then set the message to display OK. |
1195 | 1198 | if (!(defined($strOutput))) { |
1196 | 1199 | $strOutput = "OK - No problem found ($intObjectCount checked)"; |
1197 | 1200 | } |
1198 | 1201 |
|
| 1202 | + if (keys(%perfOutput) > 0) { |
| 1203 | + $strOutput .= ("\n| " . join(' ', values(%perfOutput))); |
| 1204 | + } |
| 1205 | + |
1199 | 1206 | return $intState, $strOutput; |
1200 | 1207 | } |
1201 | 1208 |
|
@@ -1970,6 +1977,8 @@ sub help { |
1970 | 1977 | This modifier is used to set an inclusive or exclusive filter on what you want to monitor. |
1971 | 1978 | --report, -r |
1972 | 1979 | 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) |
1973 | 1982 | --verbose, --debug, --trace |
1974 | 1983 | Debug output options |
1975 | 1984 | --help, -h |
@@ -2104,7 +2113,7 @@ sub get_nagios_description { |
2104 | 2113 | if (!(defined($strOutput))) { |
2105 | 2114 | $strOutput = $strNewMessage; |
2106 | 2115 | } else { |
2107 | | - $strOutput .= ", " . $strNewMessage; |
| 2116 | + $strOutput .= (defined $lineFeed ? "\n" : ", ") . $strNewMessage; |
2108 | 2117 | } |
2109 | 2118 |
|
2110 | 2119 | return $strOutput; |
@@ -2214,6 +2223,7 @@ sub filter_object { |
2214 | 2223 | "c=s" => \$strCritical, "critical=s" => \$strCritical, |
2215 | 2224 | "m=s" => \$strModifier, "modifier=s" => \$strModifier, |
2216 | 2225 | "r=s" => \$strReport, "report=s" => \$strReport, |
| 2226 | + "l" => \$lineFeed, "linefeed" => \$lineFeed, |
2217 | 2227 | "verbose" => \$verbose, |
2218 | 2228 | "debug" => \$debug, |
2219 | 2229 | "trace" => \$trace, |
|
0 commit comments