|
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 |
@@ -1144,6 +1145,7 @@ sub calc_snapmirror_health { |
1144 | 1145 | my $intState = 0; |
1145 | 1146 | my $intObjectCount = 0; |
1146 | 1147 | my $strOutput; |
| 1148 | + my %perfOutput = (); |
1147 | 1149 |
|
1148 | 1150 | foreach my $strSM (keys %$hrefSMInfo) { |
1149 | 1151 | $intObjectCount = $intObjectCount + 1; |
@@ -1172,13 +1174,18 @@ sub calc_snapmirror_health { |
1172 | 1174 | $intState = get_nagios_state($intState, 1); |
1173 | 1175 | } |
1174 | 1176 | } |
| 1177 | + $perfOutput{"snapmirror-$strSM"} = "'" . $strSM . "_snapmirror'=" . $hrefSMInfo->{$strSM}->{'lag'} . "s;" . $hrefWarnThresholds->{'lag-time'} . ";" . $hrefCritThresholds->{'lag-time'} . ";;"; |
1175 | 1178 | } |
1176 | 1179 |
|
1177 | 1180 | # If everything looks ok and no output has been defined then set the message to display OK. |
1178 | 1181 | if (!(defined($strOutput))) { |
1179 | 1182 | $strOutput = "OK - No problem found ($intObjectCount checked)"; |
1180 | 1183 | } |
1181 | 1184 |
|
| 1185 | + if (keys(%perfOutput) > 0) { |
| 1186 | + $strOutput .= ("\n| " . join(' ', values(%perfOutput))); |
| 1187 | + } |
| 1188 | + |
1182 | 1189 | return $intState, $strOutput; |
1183 | 1190 | } |
1184 | 1191 |
|
@@ -1943,6 +1950,8 @@ sub help { |
1943 | 1950 | This modifier is used to set an inclusive or exclusive filter on what you want to monitor. |
1944 | 1951 | --report, -r |
1945 | 1952 | 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) |
1946 | 1955 | --verbose, --debug, --trace |
1947 | 1956 | Debug output options |
1948 | 1957 | --help, -h |
@@ -2077,7 +2086,7 @@ sub get_nagios_description { |
2077 | 2086 | if (!(defined($strOutput))) { |
2078 | 2087 | $strOutput = $strNewMessage; |
2079 | 2088 | } else { |
2080 | | - $strOutput .= ", " . $strNewMessage; |
| 2089 | + $strOutput .= (defined $lineFeed ? "\n" : ", ") . $strNewMessage; |
2081 | 2090 | } |
2082 | 2091 |
|
2083 | 2092 | return $strOutput; |
@@ -2187,6 +2196,7 @@ sub filter_object { |
2187 | 2196 | "c=s" => \$strCritical, "critical=s" => \$strCritical, |
2188 | 2197 | "m=s" => \$strModifier, "modifier=s" => \$strModifier, |
2189 | 2198 | "r=s" => \$strReport, "report=s" => \$strReport, |
| 2199 | + "l" => \$lineFeed, "linefeed" => \$lineFeed, |
2190 | 2200 | "verbose" => \$verbose, |
2191 | 2201 | "debug" => \$debug, |
2192 | 2202 | "trace" => \$trace, |
|
0 commit comments