Nagios Dell EMC VNXe 1600 monitoring

1. Download and install UnisphereCLI from dell official website. Due to I am using Ubuntu, have to convert the rpm to deb via alien.

sudo apt-get install alien
alien UnisphereCLI-Linux-64-x86-en_US-3.0.0.1.16-1.x86_64.rpm
sudo dpkg -i unispherecli-linux-64-x86-en-us_3.0.0.1.16-2_amd64.deb

2. The uemcli program will be installed to /opt/emc/uemcli/bin/uemcli.sh. It require root access to run it. Before run it, remember to configure the uemcli permission level.

sudo /opt/emc/uemcli/bin/setlevel.sh low
sudo /opt/emc/uemcli/bin/uemcli.sh -d xxx.xxx.xxx.xxx -u xxx -p xxx /sys/general show

3. I download a nagios plugins from nagios exchange and modify it to suite my own usage.

#!/bin/bash

usage="./check_vnxe.sh [Host] [User] [Password] [Check Command] [Sub Module (Optional)]\n
Available Check Commands:
ssd - Checks all ssd components.
ps - Checks all power supplies.
iomodule - Checks all iomodules.
dae - Checks all daes.
lcc - Checks all lccs.
sp - Checks all storage processors.
dpe - Checks all dpes.
disk - Checks all disks.
mm - Checks all memory modules.
ccard - Checks all ccard modules.
bat - Checks all batteries.
fan - Checks all fans.
eth - Checks all ethernet connection.
fc - Checks all fiber-channel connection.
sas - Checks all SAS connection.
general - Overall health check from /sys/general.
 Sub module for general:
  hostname - Display system name.
  model - Display device model.
  sn - Display product serial number.
  ver - Display product firmware version.\n
Security warning: It is STRONGLY recommended that a read only user be created in VNXe and used with this script. The script will work with admin login but this is highly insecure!\n
Note: This plugin requires sudo access to run, at least under Nagios on Ubuntu. You will need to add a line to your sudoers file that looks something like this - nagios ALL=(ALL) NOPASSWD:/usr/local/nagios/libexec/check_vnxe.sh. Be sure to only allow this script to run under sudo without password. You will also need to define the check command in Nagios to execute with sudo\n
Additionally, you must set the verification level to low by running /opt/emc/uemcli-1.5.4.1.0027/bin/setlevel.sh l as a root user or this plugin will fail.\n
Please send all comments/feedback to the author, Charles Bender, at charles@beachcamera.com\n
Modified by Me, Lee Pak Hong for my personal usage.\n"

ucli=/opt/emc/uemcli/bin/uemcli.sh

host=$1
user="$2"
password="$3"
cmd=$4
component=$5

# Verify input parameters
if [ -z $1 ] || [ -z $2 ] || [ -z $3 ] || [ -z $4 ]; then
    printf "$usage"
    exit 3
fi

# Check that Unisphere CLI exists, and then set parameters for it to work
if [ ! -e $ucli ]; then
    echo "Unisphere CLI not found. Check that uemcli is installed; if so check the ucli variable at the top of this script"
    exit 3
fi

check_field="Health state"

# Define check_vnxe function
check_vnxe () {
    temp=/tmp/$cmd-check_`date +%N`
    $ucli -d $host -u $user -p $password $check_path show > $temp
    if [[ $? -ne 0 ]]; then
        echo "UNKNOWN - Unisphere CLI returned an error, unable to perform check."
        result=3
        export result
    fi
    #echo $check
    check=`cat $temp | grep -i "$check_field" | cut -d "=" -f2 | sed 's/ //'`
    #echo $check
    if [ -z "$check" ]; then
        echo "UNKNOWN - $cmd module not detected"
        result=3
        export result
    elif [ -z `echo $check | grep -i "fail"` ]; then
        if [ "$check_field" == "Health state" ]; then
        echo "OK - no faults detected"
        else
        echo "OK - $label $check"
        fi
        result=0
        export result
    else
        echo "CRITICAL - Faults detected in $cmd modeule"
        result=2
        export result
    fi
    rm $temp
    }

# Run the script with specified parameters
case "$cmd" in
    ssd)
        check_path=/env/ssd
        check_vnxe
        exit $result
        ;;
    ps)
        check_path=/env/ps
        check_vnxe
        exit $result
        ;;
    iomodule)
        check_path=/env/iomodule
        check_vnxe
        exit $result
        ;;
    dae)
        check_path=/env/dae
        check_vnxe
        exit $result
        ;;
    lcc)
        check_path=/env/lcc
        check_vnxe
        exit $result
        ;;
    sp)
        check_path=/env/sp
        check_vnxe
        exit $result
        ;;
    dpe)
        check_path=/env/dpe
        check_vnxe
        exit $result
        ;;
    disk)
        check_path=/env/disk
        check_vnxe
        exit $result
        ;;
    mm)
        check_path=/env/mm
        check_vnxe
        exit $result
        ;;
    ccard)
        check_path=/env/ccard
        check_vnxe
        exit $result
        ;;
    bat)
        check_path=/env/bat
        check_vnxe
        exit $result
        ;;
    general)
        check_path=/sys/general
        if [ -z "$component" ]; then
            check_vnxe
            exit $result
        else
            case "$component" in
            hostname)
                check_field="name"
                label="System name:"
                check_vnxe
                exit $result
            ;;
            model)
                check_field="model"
                label="Model:"
                check_vnxe
                exit $result
            ;;
            sn)
                check_field="serial"
                label="Product serial number:"
                check_vnxe
                exit $result
            ;;
            ver)
                check_path=/sys/soft/ver
                check_field="version"
                label="Firmware Version:"
                check_vnxe
                exit $result
            ;;
            esac
        fi
        ;;
    eth)
        check_path=/net/port/eth
        check_vnxe
        exit $result
        ;;
    fc)
        check_path=/net/port/fc
        check_vnxe
        exit $result
        ;;
    sas)
        check_path=/net/port/eth
        check_vnxe
        exit $result
        ;;
    fan)
        check_path=/env/fan
        check_vnxe
        exit $result
        ;;
    *)
        printf "$usage"
        exit 3
        ;;
esac

4. The script require root access to run, configure sudoers for it.

sudo visudo -f /etc/sudoers.d/nagios

and add below line to it

nagios ALL=(root) NOPASSWD:/path/check_vnxe.sh 

5. Remember to add sudo to your nagios commands.

define command{
  command_name check_vnxe
  command_line sudo /path/check_vnxe.sh $HOSTADDRESS$ username password $ARG1$ $ARG2$
}
https://exchange.nagios.org/directory/Plugins/Hardware/Storage-Systems/SAN-and-NAS/check_vnxe/details
https://community.emc.com/docs/DOC-40213
https://thesanguy.com/2018/01/29/dell-emc-unity-unisphere-cli-command-reference-guide-uemcli/

Comments