時(shí)間:2015-06-28 00:00:00 來(lái)源:IT貓撲網(wǎng) 作者:網(wǎng)管聯(lián)盟 我要評(píng)論(0)
安裝測(cè)試系統(tǒng):
硬件:普通PC機(jī),
軟件:redhat linux as 4? 2.6 .9 , 安裝系統(tǒng)自帶的lm_sensors-2.8.7-2.i386
你也可以從[url]http://www.edgedesign.us/about/lm_sensors[/url]下載
這個(gè)軟件可以在linux下收集到系統(tǒng)溫度。然后我用cacti顯示。
由于是系統(tǒng)自帶的。所以我在安裝系統(tǒng)的時(shí)候就已經(jīng)安裝好的。所以如果你找不到的話(huà)??梢栽谙到y(tǒng)盤(pán)上找,然后rpm安裝。這個(gè)我就不說(shuō)了。
下來(lái)看配置:
運(yùn)行:? /sbin/depmod –a
vi /etc/ld.so.conf
加入這一行: /usr/local/lib
運(yùn)行: ldconfig
運(yùn)行:sensors-detect 掃瞄你的主機(jī)使用那些芯片組
1: We can start with probing for (PCI) I2C or SMBus adapters.
You do not need any special privileges for this.
Do you want to probe now? (YES/no): YES
2:Next adapter: SMBus I801 adapter at 0500 (Algorithm unavailable)
Do you want to scan it? (YES/no/selectively): YES
3:Do you want to scan the ISA bus? (YES/no): YES
4:Do you want to scan for Super I/O sensors? (YES/no): YES
5:Do you want to scan for secondary Super I/O sensors? (YES/no): YES
6:Now follows a summary of the probes I have just done.
Just press ENTER to continue: 回車(chē)
7:I will now generate the commands needed to load the I2C modules.
Sometimes, a chip is available both through the ISA bus and an I2C bus.
ISA bus access is faster, but you need to load an additional driver module
for it. If you have the choice, do you want to use the ISA bus or the
I2C/SMBus (ISA/smbus)? ISA
顯示:
To make the sensors modules behave correctly, add these lines to
/etc/modules.conf:
#----cut here----
# I2C module options
alias char-major-89 i2c-dev
#----cut here----
To load everything that is needed, add this to some /etc/rc* file:
#----cut here----
# I2C adapter drivers
modprobe i2c-isa
# I2C chip drivers
modprobe w83627hf
# sleep 2 # optional
/usr/bin/sensors -s # recommended
#----cut here----
WARNING! If you have some things built into your kernel, the list above
will contain too many modules. Skip the appropriate ones! You really should
try these commands right now to make sure everything is working properly.
Monitoring programs won't work until it's done.
8:Do you want to generate /etc/sysconfig/lm_sensors? (YES/no): YES
Copy prog/init/lm_sensors.init to /etc/rc.d/init.d/lm_sensors
for initialization at boot time.
完成。
cat /etc/sysconfig/lm_sensors
顯示:
MODULE_0=i2c-isa
MODULE_1=w83627hf
啟動(dòng)
[root@linux etc]# /etc/rc.d/init.d/lm_sensors start
Starting lm_sensors:?? [? OK? ]
#p#副標(biāo)題#e#
測(cè)試:運(yùn)行 sensors
顯示:
w83627thf-isa-0290
Adapter: ISA adapter
VCore:???? +1.53 V? (min =? +1.93 V, max =? +1.93 V)
+12V:????? +5.59 V? (min = +10.82 V, max = +13.19 V)
+3.3V:???? +3.26 V? (min =? +3.14 V, max =? +3.47 V)
+5V: +5.01 V? (min =? +4.75 V, max =? +5.25 V)
-12V:???? -14.91 V? (min = -10.80 V, max = -13.18 V)
V5SB:????? +4.44 V? (min =? +4.76 V, max =? +5.24 V)
VBat:????? +3.23 V? (min =? +2.40 V, max =? +3.60 V)
fan1:? 0 RPM? (min = 225000 RPM, div = 2)
CPU Fan:? 3668 RPM? (min =?? -1 RPM, div = 2)
fan3:? 0 RPM? (min = 14062 RPM, div = 8)
M/B Temp:??? +35?°C? (high =??? +5?°C, hyst =??? +0?°C)?? sensor = thermistor
CPU Temp:? +42.0?°C? (high =? +100?°C, hyst =?? +95?°C)?? sensor = PII/Celeron diode
temp3:???? +25.5?°C? (high =? +100?°C, hyst =?? +95?°C)?? sensor = thermistor
ERROR: Can't get VID data!
alarms:?? Chassis intrusion detection??? ALarm
beep_enable:
Sound alarm disabled
eeprom-i2c-0-50
Adapter: SMBus I801 adapter at 0500
Memory type:????? DDR SDRAM DIMM
Memory size (MB): 512
運(yùn)行: ntsysv
設(shè)置lm_sensors 開(kāi)機(jī)運(yùn)行。
接下來(lái) 設(shè)置與 cacti整合:
編輯數(shù)據(jù)采集腳本
Vi mrtg.sh
#!/bin/sh
cputemp=`sensors | grep "CPU Temp" | awk '{print $3}' | cut -c 2-3`
systemp=`sensors | grep temp3 | awk '{print $2}' | cut -c 2-3`
uptime=`uptime | awk '{print $3 " " $4 " " $5}'`
echo $cputemp
echo $systemp
echo $uptime
echo linux226
添加權(quán)限:chmod +x mrtg.sh
采集結(jié)果如下:
42
26
4:50, 2 users,
linux226
接下來(lái)改寫(xiě)檔案
WorkDir: /var/www/html/mrtg/temp/
Language: big5
Target[index]: `/var/www/html/mrtg/temp/mrtg.temp`
MaxBytes[index]:60
Options[index]: gauge, nopercent, growright
YLegend[index]: Temp (度)
ShortLegend[index]: 度
LegendO[index]: 系統(tǒng)溫度;
LegendI[index]: CPU溫度;
Title[index]: Blue-Moon City 系統(tǒng)溫度表
PageTop[index]:
系統(tǒng): | RedHat 9.0+Apache 2.0.40 |
Mrtg添加:root#/usr/bin/mrtg /var/www/html/mrtg/temp/mrtg.cfg.temp
然后將上面這條命令加入crontab 里定時(shí)運(yùn)行。
我在pc機(jī)測(cè)試沒(méi)有問(wèn)題。。IBM服務(wù)器測(cè)試沒(méi)有成功,總是 sensors-detect 時(shí)候出錯(cuò)。
經(jīng)查詢(xún):IBM服務(wù)器不建議用lm_sensors 軟件。
關(guān)鍵詞標(biāo)簽:Linux,Linux監(jiān)控,Linu
相關(guān)閱讀
熱門(mén)文章 安裝紅帽子RedHat Linux9.0操作系統(tǒng)教程 Tomcat9.0如何安裝_Tomcat9.0環(huán)境變量配置方法 多種操作系統(tǒng)NTP客戶(hù)端配置 Linux操作系統(tǒng)修改IP
人氣排行 Linux下獲取CPUID、硬盤(pán)序列號(hào)與MAC地址 dmidecode命令查看內(nèi)存型號(hào) linux tc實(shí)現(xiàn)ip流量限制 安裝紅帽子RedHat Linux9.0操作系統(tǒng)教程 linux下解壓rar文件 lcx.exe、nc.exe、sc.exe入侵中的使用方法 Ubuntu linux 關(guān)機(jī)、重啟、注銷(xiāo) 命令 查看linux服務(wù)器硬盤(pán)IO讀寫(xiě)負(fù)載