+5V: +5.11 V (min = +4.73 V, max = +5.24 V)
+12V: +4.56 V (min = +10.82 V, max = +13.19 V) ALARM
-12V: -7.10 V (min = -13.18 V, max = -10.88 V) ALARM
-5V: -1.93 V (min = -5.25 V, max = -4.75 V) ALARM
V5SB: +5.51 V (min = +4.73 V, max = +5.24 V) ALARM
VBat: +0.02 V (min = +2.40 V, max = +3.60 V) ALARM
fan1: 0 RPM (min = 2732 RPM, div = 2) ALARM
fan2: 0 RPM (min = 0 RPM, div = 2)
fan3: 0 RPM (min = 0 RPM, div = 2)
temp1: +38癈 (high = +50癈, hyst = +45癈) sensor = thermistor
temp2: +33.5癈 (high = +80癈, hyst = +75癈) sensor = thermistor
temp3: +33.5癈 (high = +80癈, hyst = +75癈) sensor = thermistor
vid: +0.000 V (VRM Version 10.0)
alarms:
beep_enable:
Sound alarm enabled
这里我们可以看到温度还没有相对应CPU,我们主要稍微修改一下/etc/sensors.conf就可以了,不过其实都不用我们自己去动手,一般我们都可以从主板生产商那里下载到配置文件。通过lmsensors我们就可以得到主板温度,CPU电压,风扇转速这些信息。我们可以根据这些数据来监察系统的运行情况来预防系统的问题。
接下来让它和MRTG整合在一起吧
[root@securitycn ~]# cd /usr/local/mrtg/bin
[root@securitycn ~]# vi temp.sh
#内容如下
#!/bin/bash
cputemp=`/usr/bin/sensors | grep temp1 |awk '{print $2}'|cut -c 2-4` #这句是说找出有temp1那一行,印出第二个列的2-4个字
systemp =`/usr/bin/sensors | grep temp2 |awk '{print $2}'|cut -c 2-5` 不用解释了吧
echo $cputemp
echo $systemp
# the uptime
uptime | sed 's:^.* up (.*), [0-9][0-9]* users.*$:1:'
# my name
uname -n
[root@securitycn ~]# chmod +x temp.sh 改成可执行
[root@securitycn ~]# ./temp.sh 试试看有没有问题
39
33.5
15:36:19 up 22:28, 1 user, load average: 0.04, 0.09, 0.04
securitycn
再来写下面的文件
[root@securitycn ~]# cd ../etc/
[root@securitycn ~]# vi temp.cfg
WorkDir: /data1/usr/apache/htdocs/mrtg/temp/
Target[index]: `/usr/local/mrtg/bin/temp.sh`
MaxBytes[index]:80
Options[index]: gauge, nopercent, growright
YLegend[index]: Temp (度)
ShortLegend[index]: 度
LegendO[index]: 系统温度;
LegendI[index]: CPU温度;
Title[index]: 系统温度表
PageTop[index]:
主机温度表
[root@securitycn ~]# /usr/local/mrtg/bin/mrtg /usr/local/mrtg/etc/temp.cfg
执行3次就不报错了
然后加入到crontab里面
*/5 * * * * /usr/local/mrtg/bin/mrtg /usr/local/mrtg/etc/temp.cfg共2页。










