Zabbix¼à¿Ø·þÎñÆ÷Ó²¼þRAIDÕóÁп¨×´Ì¬

»·¾³£º

[root@node tmp]# uname -a

Linux node 2.6.32-696.el6.x86_64 #1 SMP Tue Mar 2119:29:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

[root@node tmp]# cat /etc/redhat-release

CentOS release 6.9 (Final)

Ó²¼þƽ̨£º

          HP ProLiant DL388 Gen9

ÕóÁп¨£º

# hpssacli ctrl all show status

Smart Array P440ar in Slot 0 (Embedded)

   ControllerStatus: OK

   Cache Status: OK

  Battery/Capacitor Status: OK

 

ÏÂÔØÈí¼þ£º

hpssacli-2.10-14.0.x86_64.rpm

ÏÂÔصØÖ·£ºhttps://support.hpe.com/hpsc/swd/public/detail?swItemId=MTX-c88321dcaaa94c7db3eb5fc651

 

°²×°£º

rpm  -ivh  hpssacli-2.10-14.0.x86_64.rpm

 

±àдzabbix ¼à¿Øshell½Å±¾£º

vim  raid_status.sh

#!/bin/bash

if [  $#  -ne "1"  ];then

   echo "arg error!"

fi

 

File_dir="/tmp/hpssacli"

 

case $1 in

          Controller_Status)

          result=$(cat $File_dir| grep"Controller Status"|awk -F ': ' '{print $2 }')

          [ $result = OK ] && echo 101|| echo 0

          ;;

          Cache_Status)

          result=$(cat $File_dir| grep"Cache Status"|awk -F ': ' '{print $2 }')

          [ $result = OK ] && echo 102|| echo 0

          ;;

          Battery_Status)

          result=$(cat $File_dir| grep"Battery\/Capacitor Status"|awk -F ': ' '{print $2 }')

          [ $result = OK ] && echo 103|| echo 0

          ;;

          Controller_Temperature)

          result=$(cat$File_dir| grep "Controller Temperature (C):"|awk -F ': ' '{print $2}')

          echo $result

          ;;

          Cache_Module_Temperature)

          result=$(cat $File_dir| grep"Cache Module Temperature (C):"|awk -F ': ' '{print $2 }')

          echo $result

          ;;

          Logical_Drive_Status)

          result=$(cat $File_dir| sed -n 99p|awk -F ': ' '{print $2 }')

          [ $result = OK ] && echo 104|| echo 0

          ;;

          physicaldrive_1)

          result=$(cat $File_dir| sed -n 120p|awk -F ': ' '{print $2 }')

          [ $result = OK ] && echo 131|| echo 0

          ;;

          physicaldrive_1_Current_Temperature)

        result=$(cat $File_dir| sed -n 129p|awk -F ': ' '{print $2 }')

        echo $result

        ;;

          physicaldrive_1_Maximum_Temperature)

        result=$(cat $File_dir| sed -n 130p|awk -F ': ' '{print $2 }')

        echo $result

        ;;

        physicaldrive_2)

        result=$(cat $File_dir| sed -n 141p|awk -F ': ' '{print $2 }')

        [ $result = OK ] && echo 132 ||echo 0

        ;;

        physicaldrive_2_Current_Temperature)

        result=$(cat $File_dir| sed -n 150p|awk -F ': ' '{print $2 }')

        echo $result

        ;;

        physicaldrive_2_Maximum_Temperature)

        result=$(cat $File_dir| sed -n 151p |awk -F': ' '{print $2 }')

        echo $result

        ;;

 

        physicaldrive_3)

        result=$(cat $File_dir| sed -n 162p|awk -F ': ' '{print $2 }')

        [ $result = OK ] && echo 133 ||echo 0

        ;;

        physicaldrive_3_Current_Temperature)

        result=$(cat $File_dir| sed -n 171p|awk -F ': ' '{print $2 }')

        echo $result

        ;;

        physicaldrive_3_Maximum_Temperature)

        result=$(cat $File_dir| sed -n 172p|awk -F ': ' '{print $2 }')

        echo $result

        ;;

 

        physicaldrive_4)

        result=$(cat $File_dir| sed -n 183p|awk -F ': ' '{print $2 }')

        [ $result = OK ] && echo 134 ||echo 0

        ;;

        physicaldrive_4_Current_Temperature)

        result=$(cat $File_dir| sed -n 192p|awk -F ': ' '{print $2 }')

        echo $result

        ;;

        physicaldrive_4_Maximum_Temperature)

        result=$(cat $File_dir| sed -n 193p|awk -F ': ' '{print $2 }')

        echo $result

        ;;

          *)

          echo "Usage:$0(status)"

          ;;

esac

 

 

±àдraidÐÅÏ¢ÊÕ¼¯½Å±¾£º

vimcollect_raid_info.sh

#!/bin/bash

echo $(hpssaclictrl all show config detail>/tmp/hpssacli)

 

¼ÓÈ붨ʱÈÎÎñ£º

#ÊÕ¼¯raid״̬ÐÅÏ¢

*/10 * * **  root /bin/bash  /usr/local/src/collect_raid_info.sh

 

ÔÚzabbix_agentd¼ÓÈëparameter½Å±¾£º

vim/usr/local/zabbix/etc/zabbix_agent.conf

 

UserParameter=raid.status[*], /usr/local/src/check_raid_status/raid_status.sh $1

 

ÖØÐÂÆô¶¯·þÎñ£º

servicezabbix_agentd restart

 

ÔÚ·þÎñ¶Ë¼ÓÈë¼à¿Øitem:


 

 

 

zabbix·þÎñ¶Ë¼à¿ØЧ¹ûͼ£º


 

 

 

 

 

 

 


·Ö¸îÏß
¸Ðл´òÉÍ
½­Î÷Êý¿âÐÅÏ¢¼¼ÊõÓÐÏÞ¹«Ë¾
YWSOS.COM ƽ̨´úÔËά½â¾ö·½°¸
 ÆÀÂÛ
 ·¢±íÆÀÂÛ
ÐÕ   Ãû£º

Powered by AKCMS