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_agentdparameterű

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