En solaris 10 existe el comando mpathadm que nos da el estado del MPXIO, y gracias a eso, el plugin de Nagios check_mpath, que brinda esa información al nagios. Pero en los Solaris mas viejos, donde el comando mpathadm no existe, hay que usar luxadm para probar los caminos. Para eso hice este pequeño y sencillo script. El mismo se debe poner en el directorio libexec de la máquina cliente, y solo necesita un argumento para funcionar, el dispositivo raw (partición 2), tal y como nos lo muestra el luxadm probe, por ejemplo:

# luxadm probe
No Network Array enclosures found in /dev/es

Found Fibre Channel device(s):
Node WWN:200400a0b821a3ce  Device Type:Disk device
Logical Path:/dev/rdsk/c5t600A0B800021A46A0000545B45BD64C7d0s2
Node WWN:200400a0b821a3ce  Device Type:Disk device
Logical Path:/dev/rdsk/c5t600A0B800021A46A0000545C45BD6CA3d0s2

Luego, el plugin, ejecutado a mano:

# ./libexec/check_luxadm /dev/rdsk/c5t600A0B800021A46A0000545B45BD64C7d0s2
OK - 4/ 4 paths are active

El plugin se puede descargar aqui

Y por las dudas aquí está el código:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
 
 
# Copyright (c) 2010, Guillermo Adrián Molina
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the <organization> nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY Guillermo Adrián Molina ''AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL Guillermo Adrián Molina BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
 
 
if [ $# -ne 1 ]
then
 echo Usage:
 echo $0 "<device>"
 echo
 echo Where device is something like: /dev/rdsk/c8t60060E800429D200000029D20000003Fd0s2
 echo Check devices with luxadm probe
fi
 
# Count number of paths available
TOTAL=`/usr/sbin/luxadm disp $1 | fgrep State | wc -l`
# Count number of good paths
GOOD=`/usr/sbin/luxadm disp $1 | fgrep State | egrep '(ONLINE|STANDBY)' | wc -l`
# Estimate the warning level
WARNING=$((TOTAL/2))
 
# if GOOD = TOTAL -> OK
# if TOTAL/2 <= GOOD < TOTAL -> WARNING
# if 0 <= GOOD < TOTAL/2 -> ERROR
 
if [ "$GOOD" -eq "$TOTAL" ]
then
 echo OK - $GOOD/$TOTAL paths are active
 exit $STATE_OK
fi
 
if [ "$GOOD" -ge "$WARNING" ]
then
 echo WARNING - $GOOD/$TOTAL paths are active 
 exit $STATE_WARNING
fi
 
#Error!!!
echo ERROR - $GOOD/$TOTAL paths are active
exit $STATE_CRITICAL
 

 

   
© Copyright © 2020 Web de Guillermo Adrián Molina. All Rights Reserved.