真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

怎么用軟件lm_sensors監(jiān)測(cè)Linux系統(tǒng)和CPU溫度

本篇內(nèi)容介紹了“怎么用軟件lm_sensors監(jiān)測(cè)Linux系統(tǒng)和CPU溫度”的有關(guān)知識(shí),在實(shí)際案例的操作過(guò)程中,不少人都會(huì)遇到這樣的困境,接下來(lái)就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!

創(chuàng)新互聯(lián)公司專(zhuān)注于比如網(wǎng)站建設(shè)服務(wù)及定制,我們擁有豐富的企業(yè)做網(wǎng)站經(jīng)驗(yàn)。 熱誠(chéng)為您提供比如營(yíng)銷(xiāo)型網(wǎng)站建設(shè),比如網(wǎng)站制作、比如網(wǎng)頁(yè)設(shè)計(jì)、比如網(wǎng)站官網(wǎng)定制、微信平臺(tái)小程序開(kāi)發(fā)服務(wù),打造比如網(wǎng)絡(luò)公司原創(chuàng)品牌,更為您提供比如網(wǎng)站排名全網(wǎng)營(yíng)銷(xiāo)落地服務(wù)。

lm_sensors的軟件可以幫助我們來(lái)監(jiān)控主板,CPU的工作電壓,風(fēng)扇轉(zhuǎn)速、溫度等數(shù)據(jù)。這些數(shù)據(jù)我們通常在主板的 BIOS也可以看到。當(dāng)我們可以在機(jī)器運(yùn)行的時(shí)候通過(guò)lm_sensors隨時(shí)來(lái)監(jiān)測(cè)著CPU的溫度變化,可以預(yù)防呵保護(hù)因?yàn)镃PU過(guò)熱而會(huì)燒掉。

1. 安裝lm_sensors

現(xiàn)在基本上每個(gè)Linux都已經(jīng)有l(wèi)m_sensors包了,我們主要安裝了就可以了?;蛘呶覀円部梢酝ㄟ^(guò)源文件來(lái)自己編譯。

1)在FC,RH, CENTOS下,用rpm:

[root@securitycn ~]# rpm -ivh lm_sensors-2.10.0-3.1.i386.rpm

3)編譯源文件安裝

我們可以通過(guò):這里下載源文件

這里我們要注意的問(wèn)題是要先安裝libsysfs庫(kù),是Sysfsutils,Sysfsutils-devel軟件

tar xzvf lm-sensors-xxx.tar.gz

make user

make user_install testing

下面我們就用一些簡(jiǎn)單的命令來(lái)利用lm_sensors來(lái)得到CPU的數(shù)據(jù)。我們要用root的身份來(lái):

sensors-detect,然后它會(huì)自動(dòng)搜索主板上的chipset和相應(yīng)的driver,我們?nèi)看餣ES就可以了

[root@securitycn ~]# sensors-detect

# sensors-detect revision 1.413 (2006/01/19 20:28:00)

This program will help you determine which I2C/SMBus modules you need to

load to use lm_sensors most effectively. You need to have i2c and

lm_sensors installed before running this program.

Also, you need to be `root', or at least have access to the /dev/i2c-*

files, for most things.

If you have patched your kernel and have some drivers built in, you can

safely answer NO if asked to load some modules. In this case, things may

seem a bit confusing, but they will still work.

It is generally safe and recommended to accept the default answers to all

questions, unless you know what you're doing.

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):

全部默認(rèn)YES即可。

然后我們啟動(dòng)lm_sensors :

/etc/init.d/lm_sensors start

Starting lm_sensors: [ OK ]

我們可以通過(guò)lsmod來(lái)確定我們需要的driver已經(jīng)加載了沒(méi)有

lsmod | grep i2c

i2c_isa 9153 2 w83627hf,w83781d

i2c_i801 11341 0

i2c_dev 12613 0

i2c_ec 9025 1 sbs

i2c_core 23745 6 w83627hf,w83781d,i2c_isa,i2c_i801,i2c_dev,i2c_ec

然后我們用sensors的命令就可以了:

[root@securitycn ~]# sensors

w83627hf-isa-0290

Adapter: ISA adapter共2頁(yè)。

VCore 1: +3.33 V (min = +0.00 V, max = +0.00 V) ALARM

VCore 2: +3.36 V (min = +0.00 V, max = +0.00 V) ALARM

+3.3V: +0.93 V (min = +3.14 V, max = +3.46 V) ALARM

+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

這里我們可以看到溫度還沒(méi)有相對(duì)應(yīng)CPU,我們主要稍微修改一下/etc/sensors.conf就可以了,不過(guò)其實(shí)都不用我們自己去動(dòng)手,一般我們都可以從主板生產(chǎn)商那里下載到配置文件。通過(guò)lmsensors我們就可以得到主板溫度,CPU電壓,風(fēng)扇轉(zhuǎn)速這些信息。我們可以根據(jù)這些數(shù)據(jù)來(lái)監(jiān)察系統(tǒng)的運(yùn)行情況來(lái)預(yù)防系統(tǒng)的問(wèn)題。

接下來(lái)讓它和MRTG整合在一起吧

[root@securitycn ~]# cd /usr/local/mrtg/bin

[root@securitycn ~]# vi temp.sh

#內(nèi)容如下

#!/bin/bash

cputemp=`/usr/bin/sensors | grep temp1 |awk '{print $2}'|cut -c 2-4` #這句是說(shuō)找出有temp1那一行,印出第二個(gè)列的2-4個(gè)字

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 改成可執(zhí)行

[root@securitycn ~]# ./temp.sh 試試看有沒(méi)有問(wèn)題

39

33.5

15:36:19 up 22:28, 1 user, load average: 0.04, 0.09, 0.04

securitycn

再來(lái)寫(xiě)下面的文件

[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]: 系統(tǒng)溫度;

LegendI[index]: CPU溫度;

Title[index]: 系統(tǒng)溫度表

PageTop[index]:

主機(jī)溫度表

[root@securitycn ~]# /usr/local/mrtg/bin/mrtg /usr/local/mrtg/etc/temp.cfg

執(zhí)行3次就不報(bào)錯(cuò)了

然后加入到crontab里面

*/5 * * * * /usr/local/mrtg/bin/mrtg /usr/local/mrtg/etc/temp.cfg共2頁(yè)。

“怎么用軟件lm_sensors監(jiān)測(cè)Linux系統(tǒng)和CPU溫度”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識(shí)可以關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實(shí)用文章!


本文題目:怎么用軟件lm_sensors監(jiān)測(cè)Linux系統(tǒng)和CPU溫度
標(biāo)題路徑:http://weahome.cn/article/pddoeh.html

其他資訊

在線咨詢(xún)

微信咨詢(xún)

電話咨詢(xún)

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部