Zabbix監控Linux主機CPU溫度
一、客戶端
1、客戶Linux主機安裝Im_sensors
[root@localhost ~]# yum install -y lm-sensors-y
[root@localhost ~]# sensors-detect
一直yes,然后重啟zabbix-agent服務或者主機。
2、Im_sensors查看顯示結果(由於這里是使用虛機,所以溫度顯示有問題)
[root@localhost ~]# sensors coretemp-isa-0000 Adapter: ISA adapter Physical id 0: N/A (high = +100.0°C, crit = +100.0°C) Core 0: N/A (high = +100.0°C, crit = +100.0°C)
正常情況是:
[root@Zabbix ~]# sensors i5k_amb-isa-0000 Adapter: ISA adapter Ch. 0 DIMM 0: +54.5°C (low = +100.5°C, high = +124.0°C) Ch. 1 DIMM 0: +58.5°C (low = +100.5°C, high = +124.0°C) coretemp-isa-0000 Adapter: ISA adapter Core 0: +45.0°C (high = +82.0°C, crit = +100.0°C) Core 1: +42.0°C (high = +82.0°C, crit = +100.0°C) Core 2: +44.0°C (high = +82.0°C, crit = +100.0°C) Core 3: +44.0°C (high = +82.0°C, crit = +100.0°C) coretemp-isa-0001 Adapter: ISA adapter Core 0: +47.0°C (high = +82.0°C, crit = +100.0°C) Core 1: +47.0°C (high = +82.0°C, crit = +100.0°C) Core 2: +48.0°C (high = +82.0°C, crit = +100.0°C) Core 3: +46.0°C (high = +82.0°C, crit = +100.0°C) w83627hf-isa-0a00 Adapter: ISA adapter in0: +1.15 V (min = +0.00 V, max = +4.08 V) in1: +1.15 V (min = +0.00 V, max = +4.08 V) in2: +3.38 V (min = +2.82 V, max = +3.79 V) in3: +3.02 V (min = +3.57 V, max = +4.08 V) ALARM in4: +1.50 V (min = +4.00 V, max = +2.03 V) ALARM in5: +1.82 V (min = +3.82 V, max = +3.82 V) ALARM in6: +3.38 V (min = +4.06 V, max = +4.05 V) ALARM in7: +3.34 V (min = +3.81 V, max = +4.02 V) ALARM in8: +3.31 V (min = +3.82 V, max = +3.06 V) ALARM fan1: 0 RPM (min = 1328 RPM, div = 8) ALARM fan2: 7031 RPM (min = 0 RPM, div = 8) fan3: 0 RPM (min = 883 RPM, div = 8) ALARM temp1: +34.0°C (high = -1.0°C, hyst = -68.0°C) ALARM sensor = thermistor temp2: -3.0°C (high = +80.0°C, hyst = +75.0°C) sensor = CPU diode temp3: -3.0°C (high = +80.0°C, hyst = +75.0°C) sensor = CPU diode cpu0_vid: +1.419 V beep_enable: enabled
3、提取sensors顯示數字:34.0(取Physical這行ID為0的第35-39的數值,多核就改變$0的值。-c后面的數字也根據主機顯示結果改動)
[root@Zabbix ~]# sensors|grep "temp1" |cut -c 16-19 34.0
4、修改客戶端配置文件zabbix-agent.conf
[root@localhost ~]# vim /etc/zabbix/zabbix_agentd.conf
#UnsafeUserParameters=0 改為:UnsafeUserParameters=1
下面一行添加:
UserParameter=get_temp_cpu[*],sensors|grep "temp1" |cut -c 16-19
保存退出,重啟zabbix-agent服務

二、zabbix服務器端
1、點擊對應主機監控項

2、創建監控項

3、填寫監控項信息

4、點擊對應主機觸發器

5、創建觸發器

6、設置表達式,自定義溫度值大於70就觸發告警(告警發送和接收信息在另外一篇文章提到)

7、監控事件就會提示溫度告警信息

