LSI SAS SNMP agent for Linux
Nagios通过check_sasraid_megaraid对RAID卡和硬盘进行监控的方法
对于使用了LSI MegaRAID卡搭建RAID的,可以 通过LSI公司提供的MegaCli工具进行管理监控,但对于板载SAS 6/iR RAID, 虽然可以通过服务器自带的管理工具进行图形化的管理,但通过snmp数据获取再由nagios监控方式可能效果更佳
1.下载SAS_SNMP
获取最新的包地址
%3D%22AQxNZWdhUkFJRCBTQVMMcHJvZHVjdGZhY2V0AQJeIgIiJA%3D%3D%22%20os%3D%22AQVMSW51eAJvcwEBXgEk%22
#wget %20Common%20Files/3.16-1006_Linux_SAS_SNMP_Installer.zip
//有多层目录 慢慢解吧...
2.找到sas_snmp.tar.gz 解压会生成以下两个文件
#tar -xzvf sas_snmp.tar.gz
readme.txt
sas_snmp-3.16-1006.i386.rpm
3.安装LSI SAS SNMP Agent
# rpm -ivh sas_snmp-3.16-1006.i386.rpm
4.安装成功后会有相应文件生成 包括MIB文件: LSI-AdapterSAS.mib
# ll /etc/lsi_mrdsnmp/sas
total 240
-rwxr-xr-x 1 root root 5017 Jan 21 2009 install
-rw-r--r-- 1 root root 164354 Jan 21 2009 LSI-AdapterSAS.mib
-rw-r--r-- 1 root root 35302 Jan 21 2009 sas_mib.dat
-rw-r--r-- 1 root root 572 Jan 21 2009 sas_TrapDestination.conf
-rwxr-xr-x 1 root root 3595 Jan 21 2009 uninstall
/etc/snmp/snmpd.conf 在最后一行会有以下行生成
pass .1.3.6.1.4.1.3582 /usr/sbin/lsi_mrdsnmpmain
5.修改/etc/snmp/snmpd.conf 并同时修改/etc/lsi_mrdsnmp/lsi_mrdsnmpd.conf 两者修改相同位置
/etc/snmp/snmpd.conf
HOST=*.*.*.*
sed -i "/^com2sec notConfigUser/s/default/$HOST/" /etc/snmp/snmpd.conf
sed -i '/^access/s/systemview/all/' /etc/snmp/snmpd.conf
sed -i '/^#view all/s/#//' /etc/snmp/snmpd.conf
/sbin/service snmpd restart
/sbin/chkconfig snmpd on
/etc/lsi_mrdsnmp/lsi_mrdsnmpd.conf
仅需要修改第60行 允许snmpget的主机IP即可
6. To Run/stop the snmpd daemon.
/etc/init.d/snmpd start/stop
7. To start/stop the SAS SNMP Agent daemon before issuing any snmp query.
/etc/init.d/lsi_mrdsnmpd start/stop
8. Status of the SAS SNMP Agent daemon can be checked by issuing the following command...
/etc/init.d/lsi_mrdsnmpd status
9. You can issue snmp query like this...
snmpwalk -v1 -c public localhost .1.3.6.1.4.1.3582
10. You can get the snmp trap from local m/c by issuing the following command...
snmptrapd -P -F "%02.2h:%02.2j TRAP%w.%q from %A %v\n"
关掉selinux 再进行snmpwalk
# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
# setenforce 0
使用nagios插件check_sasraid_megaraid :通过获取.1.3.6.1.4.1.3582 信息进行处理
需要修改158行的lib路径
#如果不使用nagios获取的话 也可以找一台nagios主机将libexec目录下的utils.pm提取出来;然后修改lib路径为utils.pm所在目录即可
设置为/usr/local/nagios
11.
#./check_sasraid_megaraid
如果提示无法加载到SNMP模块 则按照以下方式安装
# wget
# tar -xzvf SNMP-5.0401.tar.gz
# cd Net-SNMP-v6.0.1
# perl Makefile.PL
# make test
# make install
12.
这是一台PowerEdge R710结果
[root@localhost sas-snmp]# dmidecode -s system-product-name
PowerEdge R710
[root@localhost sas-snmp]# dmesg | grep RAID
scsi0 : LSI SAS based MegaRAID driver
md: Autodetecting RAID arrays.
[root@localhost sas-snmp]# ./check_sasraid_megaraid -H localhost -T perc6
Megaraid OK - 1 logical disks, 4 physical drives, 1 controllers found
下面是一台PowerEdge R410结果
[root@localhost libexec]# dmidecode -s system-product-name
PowerEdge R410
[root@localhost libexec]# dmesg | grep RAID
md: Autodetecting RAID arrays.
#Controller SAS 6/iR Integrated 板载RAID
[root@localhost libexec]# ./check_sasraid_megaraid -T sas6 -H localhost
Megaraid OK - 1 logical disks, 2 physical drives, 1 controllers found
同样适用于Lenovo WQ
[root@localhost src]# dmidecode -s system-product-name
Lenovo WQ R510 G7
[root@localhost src]# dmesg | grep RAID
md: Autodetecting RAID arrays. <与PowerEdge R410相同>
[root@localhost src]# ./check_sasraid_megaraid -H localhost -T sas6
Megaraid OK - 1 logical disks, 2 physical drives, 1 controllers found
check_sasraid_megaraid 插件: sas-snmp包可官网下载