0%

Zabbix(9)结合sensor监控cpu温度

zabbix 可以通过sensors-detect检测内核模块,使用zabbix监控系统自定义监控项,采集监控数据并设置告警。可以监控物理机器(虚拟机获取不到)的温度。

安装sensors

安装、运行sensors,可以看到每颗cpu的温度

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
[root@siluxa2 src]# yum install lm_sensors
[root@siluxa2 src]# sensors
i350bb-pci-0100
Adapter: PCI adapter
loc1: +50.0°C (high = +120.0°C, crit = +110.0°C)

coretemp-isa-0000
Adapter: ISA adapter
Physical id 0: +55.0°C (high = +80.0°C, crit = +90.0°C)
Core 0: +45.0°C (high = +80.0°C, crit = +90.0°C)
Core 1: +46.0°C (high = +80.0°C, crit = +90.0°C)
Core 2: +45.0°C (high = +80.0°C, crit = +90.0°C)
Core 3: +46.0°C (high = +80.0°C, crit = +90.0°C)
Core 4: +46.0°C (high = +80.0°C, crit = +90.0°C)
Core 8: +46.0°C (high = +80.0°C, crit = +90.0°C)
Core 9: +46.0°C (high = +80.0°C, crit = +90.0°C)
Core 10: +46.0°C (high = +80.0°C, crit = +90.0°C)
Core 11: +44.0°C (high = +80.0°C, crit = +90.0°C)
Core 12: +45.0°C (high = +80.0°C, crit = +90.0°C)

coretemp-isa-0001
Adapter: ISA adapter
Physical id 1: +49.0°C (high = +80.0°C, crit = +90.0°C)
Core 0: +42.0°C (high = +80.0°C, crit = +90.0°C)
Core 1: +41.0°C (high = +80.0°C, crit = +90.0°C)
Core 2: +41.0°C (high = +80.0°C, crit = +90.0°C)
Core 3: +41.0°C (high = +80.0°C, crit = +90.0°C)
Core 4: +42.0°C (high = +80.0°C, crit = +90.0°C)
Core 8: +41.0°C (high = +80.0°C, crit = +90.0°C)
Core 9: +42.0°C (high = +80.0°C, crit = +90.0°C)
Core 10: +41.0°C (high = +80.0°C, crit = +90.0°C)
Core 11: +41.0°C (high = +80.0°C, crit = +90.0°C)
Core 12: +41.0°C (high = +80.0°C, crit = +90.0°C)

配置zabbix agent客户端文件

修改客户端配置文件zabbix_agentd.conf
第一次自定义监控时要设置

1
UnsafeUserParameters=1

在配置文件中添加一行:

1
UserParameter=get_temp_cpu[*],sensors|grep "Physical id $1"|cut -c 17-20

添加监控项

1
2
3
4
5
6
sensor[device,sensor,<mode>]
读取硬件传感器
device - 设备名称
sensor - 传感器名称
mode - 可选值:avg, max, min
示例key: sensor[w83781d-i2c-0-2d,temp1] Prior to Zabbix 1.8.4, the sensor[temp1] format was used. On Linux 2.6+, 读取/sys/class/hwmon. On OpenBSD, 读取hw.sensors MIB.示例keys: sensor[cpu0,temp0] – CPU0的温度 sensor[cpu[0-2]$,temp,avg] – cpu平均温度Zabbix 1.8.4开始支持OpenBSD

我这里添加两颗cpu为例!
z
z

添加触发器

z
z

添加图形

z

查看图形

z

参考链接:http://xy.uyun.cn/post/1865.html