Search Exchange

Search All Sites

Nagios Log Server Now Available - Download Now

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

check-multipath.pl

Bookmark and Share

Don't miss your chance to attend the 2016 Nagios World conference!

Don't miss your chance to attend the 2016 Nagios World Conference, Sep 12-15th. Informative Sessions, Networking, Food and Cocktails! Visit conference.nagios.com for more information or to register.


Rating
3 votes
Favoured:
3
Current Version
0.4.1
Last Release Date
2015-12-14
E-mail
License
GPL
Hits
94784
Files:
FileDescription
check-multipath.plcheck-multipath.pl vs 0.4.1
TEST_check-multipath.plCheck output against expected results vs. 0.4.1
Monitor number of available connection paths per LUN and failed paths for multipath devices on Linux.
Some users wanted different configurations for single LUNs or groups of LUNs, so the optional parameters --extraconfig and --group were introduced.
A configuration for a specific LUN name via --extraconfig has highest priority and overrides group and global config.
If no --extraconfig entry matches the LUN name and a regex defined in --group matches a LUN line, the specified group values are used. Can also be used to identify LUNs by IDs in LUN line. (First matching regex in List, checked from left to right.)
Otherwise the global defaults are used (--min-paths, --ok-paths).

The plugin performs an extra check for a running multipathd process.

NOTE: internal SCSI drives SHOULD NOT be handled by the multipath driver. They SHOULD be excluded in the multipath configuration. See multipath documentation for details.

Options:
-m, --min-paths Low mark, less paths per LUN are CRITICAL [2]
-o, --ok-paths High mark, less paths per LUN raise WARNING [4]
-n, --no-multipath Exitcode for no LUNs, no multipath driver and multipathd not running [warning]
-M, --mdskip Skip extra check for a running multipathd process (check uses '--no-multipath' returncode)

-L, --ll use multipath -ll instead of multipath -l
Can give more detailed information, helps to detect failed paths with older versions of multipath tools (RHEL 5, ...)

-r, --reload force devmap reload if status is WARNING or CRITICAL
(multipath -r)
Can help to pick up LUNs coming back to life.

-g, --group Specify perl-regex to identify groups of LUNs (or single LUNs) with other default-thresholds.
Overrides global config for LUNs with LUN lines that match a group regex.
In most cases a simple String should be sufficient. NOTE: special regex characters must be escaped!
"LUN_LINE_REGEX,LOW,HIGH:" for each group with deviant thresholds
e.g. "IBM,ServeRAID,1,1:ChpRAID,1,2:"
Use command multipath -l to see the LUN lines and to identify groups.

-e, --extraconfig Specify different low/high thresholds for LUNs
Overrides group and global config for the specified LUNs.
optional: specify return code if no data for LUN name was found
(ok, warning, critical), default is warning
"LUN,LOW,HIGH[,RETURNCODE]:" for each LUN with deviant thresholds
e.g. "iscsi_lun_01,2,2:dummyLun,1,1,ok:paranoid_lun,8,16,critical:"
"oddLun,3,5,critical:"
"default,2,4,warning:DonalLunny,6,8:"
Use option -v to see LUN names used by this plugin.

-l, --linebreak define end-of-line string:
REG regular UNIX-Newline
HTML br-Tag (HTML-Linebreak)
-other- use specified string as linebreak symbol, e.g. ', ' (all in one line, comma seperated)

-s, --state Prefix alerts with alert state
-S, --short-state Prefix alerts with alert state abbreviated
-h, --help Display this help text
-V, --version Display version info
-v, --verbose

-d, --di Run testcase instead of real check [0]
-t, --test Do not display testcase input, just result


System configuration for 'sudo' must allow the Nagios user to call the command 'multipath -l' and/or 'multipath -ll' if you use the --ll option (and also 'multipath -r' if you intend to use the --reload option) *without* password.

Several testcases to are included in the script. They can be called by using the parameter --di with numerical values other than zero.
The additional Script 'TEST_check-multipath.pl' can be used for regression tests if you feel like editing the plugin.


This plugin was written by Hinnerk Rümenapf and is based on work by:
- Trond H. Amundsen [t.h.amundsen@usit.uio.no]
- Gunther Schlegel [schlegel@riege.com]
- Matija Nalis [mnalis+debian@carnet.hr]

Thanks to Bernd Zeimetz, Sven Anders, Kai Groshert, Ernest Beinrohr, Sébastien Maury, Benjamin von Mossner, Michal Svamberg, Andreas Steinel and Ben Evans for testing and contributions and to Matthew Castanien, Dmitry Sakoun, Robert Towster, Tom Schier and Ricardo Guijt for their comments.

SOFTWARE IS PROVIDED AS-IS, WITHOUT ANY WARRANTY
Reviews (1)
bybbaghele, March 17, 2016
0 of 1 people found this review helpful
I was trying this script to use outside Nagios as standalone script so it can create email alert and had some suggestions. Not sure they can be implemented or not.

1. The output redirection adds "" extra characters to the end of line. See below example.

# ./check-multipath.pl -s
CRITICAL: LUN mpathb: less than 2 paths (1/4)!
CRITICAL: LUN mpatha: less than 2 paths (1/4)!

# ./check-multipath.pl -s > /tmp/1
# cat /tmp/1
CRITICAL: LUN mpathb: less than 2 paths (1/4)!CRITICAL: LUN mpatha: less than 2 paths (1/4)!root@seieadb93#
#

===========================

2. Can the internal drives (Non SAN) like HP Proliant servers internal SMART array based RAID drives. The multipath -ll command for such internal drive is shown below

# ./check-multipath.pl -s
CRITICAL: LUN mpathb: less than 2 paths (1/4)!
#
# multipath -ll mpathb
mpathb (3600508b1001c3718d6b6ba8fec4cf14b) dm-2 HP,LOGICAL VOLUME
size=137G features='1 queue_if_no_path' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=1 status=active
`- 0:0:0:1 sdb 8:16 active ready running
Owner's reply

1) I'm not shure about this. The ! character is part of the message. The line end charater (new line by default) can be changed by using the parameter -l or --linebreak.
2) Internal drives SHOULD NOT be handled by the multipath driver. Internal drives SHOULD be excluded in the multipath configuration. See multipath documentation.