zabbix监控dell服务器

环境:zabbix 2.4.3

1
2
服务器型号:Dell PowerEdge R730
服务器系统:CentOS release 6.8 (Final)

1、下载官网下的监控包

1
wget -q -O - http://linux.dell.com/repo/hardware/latest/bootstrap.cgi | bash

2、安装依赖包

1
2
yum -y install OpenIPMI
yum install srvadmin-all -y

3、安装完成对相关命令做软链接或者设置srvadmin的环境变量

1
2
ln -s /opt/dell/srvadmin/sbin/omreport /usr/bin/omreport
ln -s /opt/dell/srvadmin/sbin/omconfig /usr/bin/omconfig

4、启动OMSA

1
/etc/init.d/dataeng start

5、加入到开机自启动

1
chkconfig dataeng on

6、开启web界面(可以不开)

1
/opt/dell/srvadmin/sbin/srvadmin-services.sh start

使用https://IP:1131访问:用户名与密码是系统的root

7、OMSA查看温度的命令:

1
omreport chassis temps

8、输出的结果如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
[root@egrant scripts]#omreport chassis temps
Temperature Probes Information
------------------------------------
Main System Chassis Temperatures: Ok
------------------------------------
Index : 0
Status : Ok
Probe Name : System Board Inlet Temp
Reading : 21.0 C
Minimum Warning Threshold : 3.0 C
Maximum Warning Threshold : 42.0 C
Minimum Failure Threshold : -7.0 C
Maximum Failure Threshold : 47.0 C
Index : 1
Status : Ok
Probe Name : System Board Exhaust Temp
Reading : 30.0 C
Minimum Warning Threshold : 0.0 C
Maximum Warning Threshold : 70.0 C
Minimum Failure Threshold : 0.0 C
Maximum Failure Threshold : 75.0 C
Index : 2
Status : Ok
Probe Name : CPU1 Temp
Reading : 48.0 C
Minimum Warning Threshold : 8.0 C
Maximum Warning Threshold : 85.0 C
Minimum Failure Threshold : 3.0 C
Maximum Failure Threshold : 90.0 C
Index : 3
Status : Ok
Probe Name : CPU2 Temp
Reading : 49.0 C
Minimum Warning Threshold : 8.0 C
Maximum Warning Threshold : 85.0 C
Minimum Failure Threshold : 3.0 C
Maximum Failure Threshold : 90.0 C

zabbix方面

思路:我们捕捉:”Probe Name“ 与其对应的 “Reading”,使其在zabbix监控起来。

1、在客户端上/usr/local/zabbix/scripts 编写如下脚本,且命名为[check_dell.sh]:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
#function:monitor tcp connect status from zabbix
source /etc/bashrc >/dev/null 2>&1
source /etc/profile >/dev/null 2>&1
#定义发现函数
dell_temp_discovery () {
#temps=($(omreport chassis temps |grep 'Probe Name' | awk -F ':' '{print $2}'))
#数组模式添加温度项
temps[0]="System_Board_Inlet_Temp"
temps[1]="System_Board_Exhaust_Temp"
temps[2]="CPU1_Temp"
temps[3]="CPU2_Temp"
#length=${#temps[3]}
length=4
#打印json格式
printf "{\n"
printf '\t'"\"data\":["
for ((i=0;i<$length;i++))
do
printf "\n\t\t{"
printf "\t\"{#DELL_TEMP}\":\"${temps[$i]}\"}\n"
if [ $i -lt $[$length-1] ];then
printf ","
fi
done
printf "\n\t]\n"
printf "}\n"
}
#case分情况判断对应的温度数值
case "$1" in
dell_temp_discovery)
dell_temp_discovery
;;
System_Board_Inlet_Temp)
omreport chassis temps | grep -C 1 "System Board Inlet Temp" | grep Reading | awk '{print $3}'
;;
System_Board_Exhaust_Temp)
omreport chassis temps | grep -C 1 "System Board Exhaust Temp" | grep Reading | awk '{print $3}'
;;
CPU1_Temp)
omreport chassis temps | grep -C 1 "CPU1 Temp" | grep Reading | awk '{print $3}'
;;
CPU2_Temp)
omreport chassis temps | grep -C 1 "CPU2 Temp" | grep Reading | awk '{print $3}'
;;
*)
"Usage:$0 {dell_temp_discovery|System_Board_Inlet_Temp|System_Board_Exhaust_Temp|CPU1_Temp|CPU2_Temp}"
;;
esac

2、在/usr/local/zabbix/etc/zabbix_agentd.conf.d 添加自定义键值的配置文件dellmachine.conf

1
2
3
4
#发现温度项的名称
UserParameter=check.dell.discover[*],sh /usr/local/zabbix/scripts/check_dell.sh dell_temp_discovery
#查询温度数值
UserParameter=dell.temps[*],sh /usr/local/zabbix/scripts/check_dell.sh $1

PS:添加完记得重启下zabbix客户端服务

3、zabbix服务端网页上在配置“自动发现”
图我就不截图 别问为什么

# zabbix
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×