Zabbix监控服务器硬件信息

由于公司大部分机器都是使用DELL服务器,所以找了dell专门的监控软件omsa。

一、服务端

1、模板导入

把Template Hardware Monitor导入到zabbix里。

2、主机关联模板

把需要监控的硬件服务器关联此模板即可

二、安装omsa

A、在redhat或者centos系统里安装

1、安装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 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

三、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

文件下载

阿里云
weinxin
聂扬帆博客
一个分享IT运维相关工作经验和实战技巧的个人博客

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: