由于公司大部分機器都是使用DELL服務器,所以找了dell專門的監(jiān)控軟件omsa呢簸。
0x01 服務端
模板導入
把Template Hardware Monitor導入到zabbix里。
下載地址:https://github.com/JPOPS/Monitor/tree/master/zabbix-Hardware主機關聯(lián)模板
把需要監(jiān)控的硬件服務器關聯(lián)此模板即可
0x02 安裝omsa
A、在redhat或者centos系統(tǒng)里安裝
- 安裝dell的yum源
$ wget -q -O - http://linux.dell.com/repo/hardware/latest/bootstrap.cgi | bash
```
2. 安裝omsa
```
$ yum install srvadmin-all
```
3. 做軟連接
```
$ ln -s /opt/dell/srvadmin/sbin/omreport /usr/bin/omreport
$ ln -s /opt/dell/srvadmin/sbin/omconfig /usr/bin/omconfig
```
4. 關閉web模式(僅允許運行cli)
```
$ echo "/usr/bin/omconfig system webserver action=stop" >>/opt/dell/srvadmin/sbin/srvadmin-services.sh
```
5. 啟動omsa
```
$ /opt/dell/srvadmin/sbin/srvadmin-services.sh start
```
6. 把omsa加入到開機啟動
```
$ echo "/opt/dell/srvadmin/sbin/srvadmin-services.sh start" >>/etc/rc.local
```
**B萎攒、在ubuntu下的安裝**
1. 增加源
```
$ echo 'deb [http://linux.dell.com/repo/community/ubuntu](http://linux.dell.com/repo/community/ubuntu) precise openmanage'
| sudo tee -a /etc/apt/sources.list.d/linux.dell.com.sources.list
```
2. 檢測與增加key
```
$ gpg --keyserver pool.sks-keyservers.net --recv-key 1285491434D8786F
$ gpg -a --export 1285491434D8786F | sudo apt-key add -
```
3. 更新源
```
$ apt-get update -y
```
4. 安裝omsa
```
$ apt-get install srvadmin-all -y
```
5. 做軟連接
```
ln -s /opt/dell/srvadmin/sbin/omreport /usr/bin/omreport
ln -s /opt/dell/srvadmin/sbin/omconfig /usr/bin/omconfig
```
6. 啟動cli模式omsa
```
$ service dataeng start
```
>**0x03 zabbix配置**
1. 在zabbix_agentd.conf里配置
```
# follow is monitor hardware
UserParameter=hardware_battery,omreport chassis batteries | awk '/^Status/{if($NF=="Ok") {print 1} else {print 0}}'
UserParameter=hardware_cpu_model,awk-vhardware_cpu_crontol=`sudoomreport chassis biossetup|awk '/C State/{if($NF=="Enabled") {print 0} else {print 1}}' ` -vhardware_cpu_c1=`sudoomreport chassis biossetup|awk '/C1[-|E]/{if($NF=="Enabled") {print 0} else {print 1}}' ` 'BEGIN{if(hardware_cpu_crontol==0 && hardware_cpu_c1==0) {print 0} else {print 1}}'
UserParameter=hardware_fan_health,awk-vhardware_fan_number=`omreport chassis fans|grep-c "^Index" ` -vhardware_fan=`omreport chassis fans|awk '/^Status/{if($NF=="Ok") count+=1}END{print count}' ` 'BEGIN{if(hardware_fan_number==hardware_fan) {print 1} else {print 0}}'
UserParameter=hardware_memory_health,awk-vhardware_memory=`omreport chassis memory|awk '/^Health/{print $NF}' ` 'BEGIN{if(hardware_memory=="Ok") {print 1} else {print 0}}'
UserParameter=hardware_nic_health,awk-vhardware_nic_number=`omreport chassis nics |grep-c "Interface Name" ` -vhardware_nic=`omreport chassis nics |awk '/^Connection Status/{print $NF}' |wc-l` 'BEGIN{if(hardware_nic_number==hardware_nic) {print 1} else {print 0}}'
UserParameter=hardware_cpu,omreport chassis processors|awk '/^Health/{if($NF=="Ok") {print 1} else {print 0}}'
UserParameter=hardware_power_health,awk-vhardware_power_number=`omreport chassis pwrsupplies|grep-c "Index" ` -vhardware_power=`omreport chassis pwrsupplies|awk '/^Status/{if($NF=="Ok") count+=1}END{print count}' ` 'BEGIN{if(hardware_power_number==hardware_power) {print 1} else {print 0}}'
UserParameter=hardware_temp,omreport chassis temps|awk '/^Status/{if($NF=="Ok") {print 1} else {print 0}}' |head-n 1
UserParameter=hardware_physics_health,awk-vhardware_physics_disk_number=`omreport storage pdisk controller=0|grep-c "^ID" ` -vhardware_physics_disk=`omreport storage pdisk controller=0|awk '/^Status/{if($NF=="Ok") count+=1}END{print count}' ` 'BEGIN{if(hardware_physics_disk_number==hardware_physics_disk) {print 1} else {print 0}}'
UserParameter=hardware_virtual_health,awk-vhardware_virtual_disk_number=`omreport storage vdisk controller=0|grep-c "^ID" ` -vhardware_virtual_disk=`omreport storage vdisk controller=0|awk '/^Status/{if($NF=="Ok") count+=1}END{print count}' ` 'BEGIN{if(hardware_virtual_disk_number==hardware_virtual_disk) {print 1} else {print 0}}'
```
2. 重啟zabbix_agentd服務
```
/etc/init.d/zabbix_agentd restart
```
---
博客地址:[http://yangfannie.com](http://yangfannie.com)