Monitoring HP server RAID with Nagios

Source: Internet
Author: User
Tags hp server

Background: The unit selects Dell and HP two types of servers in the IDC room. For information on monitoring server hardware, especially RAID, Dell can monitor it using its own OMSA program process. However, HP does not have this aspect of monitoring, the disk in the server is the most prone to problems, the personal study of multi-day discovery can use the following way to monitor the HP server raid.


Use Nagios to monitor your HP server's Raid:

Premise The local server has installed the Nagios-plugin and Nrpe modules, if there is no installation can search, the relevant tutorials are many, belonging to the use of Nagios. Here's just a look at how to monitor raid.

The operating system currently in use is centos5.1


1. Monitoring raid:

(1) Download and install HPASMCLI, this module is used to detect the HP server RAID and disk conditions:

#rpm-IVH hpacucli-9.40-12.0.x86_64.rpm

(2) When the installation is complete, the default generated executable file is:

/usr/sbin/hpacucli

Use the following command to detect server hard disks and raid:

$ SUDO/USR/SBIN/HPACUCLI Ctrl slot=0 PD all show status


Physicaldrive 1i:1:1 (Port 1i:box 1:bay 1, GB): OK

Physicaldrive 1i:1:2 (Port 1i:box 1:bay 2, GB): OK

Physicaldrive 1i:1:3 (Port 1i:box 1:bay 3, GB): OK

$ SUDO/USR/SBIN/HPACUCLI Ctrl slot=0 Logicaldrive all Show|grep RAID

Logicaldrive 1 (558.7 GB, RAID 5, OK)

(3) Edit the script so that Nrpe can invoke:

#!/bin/bash

#First Create date:2016/01/07

#Author: Kunka

#定义nagios返回状态

State_ok=0

State_warning=1

state_critical=2

State_unknown=3

State_dependent=4

I=1

#设置变量

disk_com=$ (sudo/usr/sbin/hpacucli Ctrl slot=0 PD all show Status|awk ' {print $9} ')

disk_err=$ (sudo/usr/sbin/hpacucli Ctrl slot=0 PD all show Status|grep-v OK)

disk_raid=$ (sudo/usr/sbin/hpacucli Ctrl slot=0 logicaldrive all Show|grep RAID)


If [$?-eq 0];then

For OK in $DISK _com

Do

if [$OK = ' OK '];then

i=$ (($i + 1))

Else

echo "Warning:" $DISK _err, $DISK _raid

Exit $STATE _critical

Fi

Done

echo "Ok-raid:" $DISK _raid

Exit $STATE _OK

Else

Echo ' unkonwn! HPACUCLI can not to exec. '

Exit $STATE _unknown

Fi

(4) Since Nrpe is generally set to Nagios user execution, the/etc/sudoers file needs to be modified with sudo permissions:

#vim/etc/sudoers

Defaults Requiretty--Comment out

Nagios all=nopasswd:/usr/sbin/hpacucli

: Wq

Save exit



(5) Configure the Nrpe file:
Copy the above script to the usr/local/nagios/libexec/directory and edit the

#vim nrep.cfg

command[check_raid]=/usr/local/nagios/libexec/check_raid.sh

Start Nrpe:

#sudo/usr/local/nagios/bin/nrpe-d/usr/local/nagios/etc/nrpe.cfg

(6) Configuring Nagios files:

1) Add Host File

2) Modify the Nagios.cfg file

3) Check the Nagios configuration file

Sudo/usr/local/nagios/bin/nagios-v/usr/local/nagios/etc/nagios.cfg

3) Restart the Nagios service



Monitoring HP server RAID with Nagios

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.