Netapp Lun State Monitoring using Nagios – Dirty Way

Monitoring Netapp LUN directly may possible using SNMP by calling OID, in different way and dirty way using shell script. Here is an way Netapp Lun state Monitoring using Nagios- Dirty Way. 

Netapp Lun State Monitoring using Nagios Steps :

  • Creating read-only account in Netapp
  • Provide access to read-only account to execute Lun commands
  • Create Key Based Access (Passwordless Access) from Linux Server to Netapp controller
  • Copy below script to /usr/local/nagios/libexec  file name lunstatus.sh
  • Define service in Nagios

Use below Article to create Netapp User with read-only access

Creating User in Netapp 7 Mode

To Create Passwordless connection between Linux and Netapp First Generate ssh key from Linux machine 

[root@ArkitServer ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
24:e6:b5:71:7b:60:36:a4:3b:12:0e:87:ed:8e:8f:a9 root@ArkitServer
The key's randomart image is:
+--[ RSA 2048]----+
| . |
| o o |
| o * = * |
| B = B + |
| = S . . |
| o . . . |
| . . |
| + |
| E.o . |
+-----------------+

Change Directory path to .ssh/ from user profile and copy the public content to Netapp controller to get access via passwordless authentication

[root@ArkitServer ~]# cd .ssh/
[root@ArkitServer .ssh]# ls
id_rsa id_rsa.pub
[root@ArkitServer .ssh]# cat id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDxfpqVe7OgXy/RUfvqqqe9/kPaNj2LKPs79HZEvp4U0aZUT12g9uV4vHPmwd7RvDtJ9JJK129X2hAVYh0qAWwduGppWBeMjQwYHmCUCrU99BLBBtYNAxsd18zXxQvIvaMk5gTeYf9xcNXpKuziIt/4fs0AbadVCYq1obAAmfmkwJBmvIjv0zGzLpsRqARK/e1Z7jHaGGMNkoCJqmWxjhDftLdRNeMwPCTNEtHYBG9+polfe4Wlrhl2Z8Mk2qzJaOmruUjpWoqI6Dyr006evYWPINy2YkNNtRaPOpyy5467tndFIM2b7AkMC2KDJlWSo36/MV66j root@ArkitServer

Open Netapp CIFS share \NEtappFilerIP\ETC$

sshd/.ssh/username/authorized_keys Paste public key content here

Command Syntax

./lunstatus.sh 192.168.1.4 /vol/vol2/lun

Define command in commands configuration file

#vi /usr/local/nagios/etc/objects/commands.cfg

# 'check_lunstatus' command check netapp lun status
define command{
 command_name check_lunstatus
 command_line $USER1$/lunstatus.sh $HOSTADDRESS$ $ARG1$
 }

Now add service configuration

define service{
 use generic-service
 host_name cn-ark-netapp01
 service_description Lun status Check
 check_command check_lunstatus!/vol/vol2/lun1
 }

Below is the script

#!/bin/bash
## Lun state Monitoring Nagios Script
# Written by Ravi Ankam

if [ "$1" = "" ]; then
 echo "Usage: ./Scriptname FilerIP LUNPath"
 exit 1
fi

LUNCHECK=$( ssh 'root@'$1 lun show $2 | awk '{ print $5 }' )
output="Lun State: $LUNCHECK"
if [ $LUNCHECK != online, ]; then
 echo "CRITICAL - $output"
 exit 2
else
 echo "OK - Lun State: $LUNCHECK"
 exit 0
fi

Conclusion :

The Dirty way to monitor Netapp Lun status using Nagios Monitoring tool.

Related Articles

NRPE Linux Machine Commands

Installing and configuring Linux Nagios Agent

Thanks for your wonderful Support and Encouragement

Ravi Kumar Ankam

My Name is ARK. Expert in grasping any new technology, Interested in Sharing the knowledge. Learn more & Earn More

Leave a Reply

Your email address will not be published. Required fields are marked *