Build precise queries to find exactly what you need
Press ESC to close
Your review has been submitted and is pending approval.
This script runs the specified Nagios-plugin, captures stdout and reformats the performance-data to multi-label-format as specified by check_multi. It has been designed for check-scripts, which check several instances (f.e. disks) on one system.
Current Version
1.0.1
Last Release Date
2010-07-08
Owner
Ingo Lantschner
Website
http://netapp-monitoring.info/
Compatible With
Installation package
NAME Multi label wrapper (wrap_multi.pl) - standard perfoutput to multi-label-format
VERSION Version 1.0.1 (stable)
FILENAME- and PATH of the WRAPPED CHECK-SCRIPT In order to keep the script simple and independent, only usual file- and directory-names are supported.
This script probably will not work with delimiters other than forward-slashes.
SYNOPSIS This script runs the specified Nagios-plugin, captures stdout and reformats the performance-data to multi-label-format as specified by check_multi.
EXAMPLE $ wrap_multi.pl 'check_disk.pl' '-H host' free_space
This prints
DISK OK - free space: / 3326 MB (56%); | check_disk::multi_label::instances=4 / 15272 MB (77%); /boot 68 MB (69%); /home 69357 MB (27%); /var/log 819 MB (84%); | /::check_disk::free_space=2643MB;5948;5958;0;5968 /boot::check_disk::free_space=68MB;88;93;0;98 /home::check_disk::free_space=69357MB;253404;253409;0;253414 /var/log::check_disk::free_space=818MB;970;975;0;980
instead of the following (output without wrap_multi):
DISK OK - free space: / 3326 MB (56%); | /=2643MB;5948;5958;0;5968 / 15272 MB (77%);/boot 68 MB (69%); /home 69357 MB (27%); /var/log 819 MB (84%); | /boot=68MB;88;93;0;98 /home=69357MB;253404;253409;0;253414 /var/log=818MB;970;975;0;980
SYNTAX BASIC This wrapper-script receives three parameter, the name of the check-script to wrap, its arguments and a label:
$ wrap_multi.pl <check_script> <arguments> <label>
ADVANCED An optional 4th parameter prefixes the instance-names and makes them unique in case of having several checks, retrieving different metrics from the same instance. (f.e. usage- and snapshot-data from the volumes)
$ wrap_multi.pl check_disk.pl 'H host' free fs-
DISK OK - free space: / 3326 MB (56%); | check_disk::multi_label::instances=4 / 15272 MB (77%); /boot 68 MB (69%); /home 69357 MB (27%); /var/log 819 MB (84%); | fs-/::check_disk::free=2643MB;5948;5958;0;5968 fs-/boot::check_disk::free=68MB;88;93;0;98 fs-/home::check_disk::free=69357MB;253404;253409;0;253414 fs-/var/log::check_disk::free=818MB;970;975;0;980
IMPLEMENTATION This script executes whatever is defined by the first argument. Stdout is captured, stderr is send to /dev/null.
MULTI-LINE HEADER (INSTANCE COUNTER) The number of perf-data elements is counted and used to construct the first multi-label-perfelement in the following format:
<check-name>::multi_label::<label>=<number of instances>
So the number of perf-elements is taken as the number of instances.
If there is no perf-data, the counter is zero.
NEWLINES VS. BLANKS The Nagios-documentation allows newlines to separate perf-data-elements. The Perl-Module Nagios::Plugin uses blanks. This scripts does the latter and follows what most plugins will do: Separate the perf-elements by blanks. So some of the above examples do not reflect 100% correct what this script will output.
Example: This input (second part of perf-data in multi-line output)
some message | a=1 b=2 c=3
will get changed to:
some message | a::some_check::lab=1 b::some_check::lab=2 c::some_check::lab=3
FORMAT DEFINITIONS STANDARD NAGIOS PERFDATA (INPUT) This script can process both the Nagios 2.x service-output and the newer Nagios 3.x multiline service-output.
TEXT OUTPUT | OPTIONAL PERFDATA LONG TEXT LINE 1 LONG TEXT LINE 2 ... LONG TEXT LINE N | PERFDATA LINE 2 PERFDATA LINE 3 ... PERFDATA LINE N
This definition has been taken from nagios.org on 13th of April 2010. <http://nagios.sourceforge.net/docs/3_0/pluginapi.html>
MULTI-LABEL-FORMAT (OUTPUT) <Instance-Name>::<Plugin>::<Label>=<Value[;warn;crit;min;max]>
Instance-Name The string left of each = in the original perf-output
Plugin The file-name of the called script w/o extension (anything left of the last '.')
Label The label is to set to the command-lines second parameter.
Example - this results in 'size_used' as label:
$ wrap_multi.pl some_check.pl size_used
Value Value, including thresholds and min/max values without any change.
INSTANCE-LINE The wrapper-script counts the number of instances and adds it as perfdata in front of the first perfdata.
<Plugin>::multi_label::instances=<no of instances>
Example - if four volumes have been checked by check_disk.pl the first line of the perfdata would be:
check_disk::multi_label::instances=4
See also the example above.
LICENSE AND COPYRIGHT Copyright (c) 2010 Bacher Systems GmbH. All rights reserved.
Author: Ingo Lantschner, <http://perl.lantschner.name>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Using for wrapping some perl script I wrote, which icinga was displaying as null. now works. dont know why!
You must be logged in to submit a review.
To:
From: