监控dell raid卡 with nagios

制作:高进波
时间:2010-7-28
以下文档在ubuntu下制作,其他发行版的Linux基本操作一样,只是安装mpt-status和megactl会有所不同,需要进行相应修改。

服务器端配置nagios server
1.添加检测脚本
vi /usr/local/nagios/libexec/check_snmp_extend
脚本内容见check_snmp_extend.sh
修改权限
chmod +x /usr/local/nagios/libexec/check_snmp_extend
chown nagios:nagios /usr/local/nagios/libexec/check_snmp_extend


2.添加检测命令
vi /etc/nagiosql/commands.cfg

[php]
#check dell raid mpt
define command{
command_name  check_snmp_extend
command_line  $USER1$/check_snmp_extend $HOSTADDRESS$ $ARG1$
}
[/php]

3.添加需要检测的机器
vi /etc/nagiosql/services/112.90.216.145.cfg

[php]
define service{
use                     generic-service
host_name               112.90.216.145
service_description     RAID status
check_command           check_snmp_extend!mpt-status
}
[/php]

4.测试配置文件并重启nagios
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
/etc/init.d/nagios restart

5.命令测试获取raid状态
/usr/local/nagios/libexec/check_snmp_extend 112.90.216.145 mpt-status
注意:由于使用nagiosql来管理配置文件,路径会有所不同

客户端配置snmpd
mpt类型raid卡
1.安装mpt-status
用自己编译的deb包
wget http://gaojinbo.com/mpt.deb
dpkg -i mpt.deb

2.编写检测脚本
vi /root/raid-status.sh

[php]
#!/bin/bash
if [ -f /tmp/mpt-status ]
then
rm /tmp/mpt-status
fi
for u in 0 1 2 3
do   /usr/sbin/mpt-status –autoload  -s -i 2 -i $u |grep log_id  |awk ‘{print $3}’ >> /tmp/mpt-status;
done
[/php]

增加执行权限
chmod +x /root/raid-status.sh

3.每5分钟检测一下磁盘状态
crontab -e

[php]
*/5     *       *       *       *       /root/raid-status.sh
[/php]

4.添加snmpd配置
vi /etc/snmp/snmpd.conf

[php]
extend mpt-status /bin/cat /tmp/mpt-status

[/php]

or
[php]echo "extend mpt-status /bin/cat /tmp/mpt-status" >> /etc/snmp/snmpd.conf[/php]

5.重启snmpd
/etc/init.d/snmpd restart

===================================================================
megaraid_sas类型raid卡
1.增加源

[php]
echo "deb http://hwraid.le-vert.net/debian lenny main" >> /etc/apt/sources.list
[/php]

2.安装megactl
apt-get update && apt-get install megactl

3.编写检测脚本
cd
rm raid-status.sh*

[php]
wget http://gaojinbo.com/raid-status.sh
chmod +x /root/raid-status.sh
vi /root/raid-status.sh
#!/bin/bash
if [ -f /tmp/mpt-status ]
then
rm /tmp/mpt-status
fi
/usr/sbin/megasasctl |grep RAID  |awk ‘{print $6}’ >> /tmp/mpt-status;
RESULT1=`/usr/sbin/megasasctl | grep bad|awk ‘{print $3}’`
RESULT2=`/usr/sbin/megasasctl | grep BAD|awk ‘{print $3}’`
if [ "$RESULT1" = "bad" -o "$RESULT2" = "BAD" ]
then
echo "DISK-BAD" >> /tmp/mpt-status;
fi
[/php]

增加执行权限
chmod +x /root/raid-status.sh

4.每5分钟检测一下磁盘状态
crontab -e

[php]
*/5     *       *       *       *       /root/raid-status.sh
[/php]

5.添加snmpd配置
vi /etc/snmp/snmpd.conf

[php]
extend mpt-status /bin/cat /tmp/mpt-status[/php]

or

[php]
echo "extend mpt-status /bin/cat /tmp/mpt-status" >> /etc/snmp/snmpd.conf
[/php]

6.重启snmpd
/etc/init.d/snmpd restart

完成!

还没有评论,快来抢沙发!

发表评论

  • 😉
  • 😐
  • 😡
  • 😈
  • 🙂
  • 😯
  • 🙁
  • 🙄
  • 😛
  • 😳
  • 😮
  • emoji-mrgree
  • 😆
  • 💡
  • 😀
  • 👿
  • 😥
  • 😎
  • ➡
  • 😕
  • ❓
  • ❗
  • 65 queries in 0.405 seconds