Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add performance data for snapmirror #95

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Copy `check_netapp_ontap.pl` script to your nagios libexec folder and configure
* --warning, -w => A custom warning threshold value. See the option and threshold list at the bottom of this help text.
* --critical, -c => A custom warning threshold value. See the option and threshold list at the bottom of this help text.
* --modifier, -m => This modifier is used to set an inclusive or exclusive filter on what you want to monitor.
* --linefeed, -l => Add linefeeds between multi-line diagnostic output entries.
* --help, -h => Display this help text.

### Options
Expand Down
12 changes: 11 additions & 1 deletion check_netapp_ontap.pl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
if ($verbose || $debug || $trace) {
use Data::Dumper;
}
my $lineFeed = undef;

##############################################
## DISK HEALTH
Expand Down Expand Up @@ -1161,6 +1162,7 @@ sub calc_snapmirror_health {
my $intState = 0;
my $intObjectCount = 0;
my $strOutput;
my %perfOutput = ();

foreach my $strSM (keys %$hrefSMInfo) {
$intObjectCount = $intObjectCount + 1;
Expand Down Expand Up @@ -1189,13 +1191,18 @@ sub calc_snapmirror_health {
$intState = get_nagios_state($intState, 1);
}
}
$perfOutput{"snapmirror-$strSM"} = "'" . $strSM . "_snapmirror'=" . $hrefSMInfo->{$strSM}->{'lag'} . "s;" . $hrefWarnThresholds->{'lag-time'} . ";" . $hrefCritThresholds->{'lag-time'} . ";;";
}

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

if (keys(%perfOutput) > 0) {
$strOutput .= ("\n| " . join(' ', values(%perfOutput)));
}

return $intState, $strOutput;
}

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

return $strOutput;
Expand Down Expand Up @@ -2214,6 +2223,7 @@ sub filter_object {
"c=s" => \$strCritical, "critical=s" => \$strCritical,
"m=s" => \$strModifier, "modifier=s" => \$strModifier,
"r=s" => \$strReport, "report=s" => \$strReport,
"l" => \$lineFeed, "linefeed" => \$lineFeed,
"verbose" => \$verbose,
"debug" => \$debug,
"trace" => \$trace,
Expand Down