位置: 编程技术 - 正文
推荐整理分享用软件lm_sensors监测Linux系统和CPU温度(如何隐藏应用软件),希望有所帮助,仅作参考,欢迎阅读内容。
文章相关热门搜索词:苹果手机怎么隐藏应用软件,如何隐藏应用软件,电视怎么下载应用软件,荣耀x50怎么隐藏应用软件,如何隐藏应用软件,手机怎么隐藏应用软件,手机怎么隐藏应用软件,苹果手机怎么隐藏应用软件,内容如对您有帮助,希望把文章链接给更多的朋友!
lm_sensors的软件可以帮助我们来监控主板,CPU的工作电压,风扇转速、温度等数据。这些数据我们通常在主板的 BIOS也可以看到。当我们可以在机器运行的时候通过lm_sensors随时来监测着CPU的温度变化,可以预防呵保护因为CPU过热而会烧掉。
1. 安装lm_sensors
现在基本上每个Linux都已经有lm_sensors包了,我们主要安装了就可以了。或者我们也可以通过源文件来自己编译。
1)在FC,RH, CENTOS下,用rpm:
[root@securitycn ~]# rpm -ivh lm_sensors-2..0-3.1.i.rpm
3)编译源文件安装
我们可以通过:这里下载源文件
这里我们要注意的问题是要先安装libsysfs库,是Sysfsutils,Sysfsutils-devel软件
tar xzvf lm-sensors-xxx.tar.gz
make user
make user_install testing
下面我们就用一些简单的命令来利用lm_sensors来得到CPU的数据。我们要用root的身份来:
sensors-detect,然后它会自动搜索主板上的chipset和相应的driver,我们全部答YES就可以了
[root@securitycn ~]# sensors-detect
# sensors-detect revision 1. (// ::)
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):
全部默认YES即可。
然后我们启动lm_sensors :
/etc/init.d/lm_sensors start
Starting lm_sensors: [ OK ]
我们可以通过lsmod来确定我们需要的driver已经加载了没有
lsmod | grep i2c
i2c_isa 2 whf,wd
i2c_i 0
i2c_dev 0
i2c_ec 1 sbs
i2c_core 6 whf,wd,i2c_isa,i2c_i,i2c_dev,i2c_ec
然后我们用sensors的命令就可以了:
[root@securitycn ~]# sensors
whf-isa-
Adapter: ISA adapter共2页。
VCore 1: +3. V (min = +0. V, max = +0. V) ALARM
VCore 2: +3. V (min = +0. V, max = +0. V) ALARM
+3.3V: +0. V (min = +3. V, max = +3. V) ALARM
+5V: +5. V (min = +4. V, max = +5. V)
+V: +4. V (min = +. V, max = +. V) ALARM
-V: -7. V (min = -. V, max = -. V) ALARM
-5V: -1. V (min = -5. V, max = -4. V) ALARM
V5SB: +5. V (min = +4. V, max = +5. V) ALARM
VBat: +0. V (min = +2. V, max = +3. V) ALARM
fan1: 0 RPM (min = RPM, div = 2) ALARM
fan2: 0 RPM (min = 0 RPM, div = 2)
fan3: 0 RPM (min = 0 RPM, div = 2)
temp1: +? (high = +?, hyst = +?) sensor = thermistor
temp2: +.5? (high = +?, hyst = +?) sensor = thermistor
temp3: +.5? (high = +?, hyst = +?) sensor = thermistor
vid: +0. V (VRM Version .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 试试看有没有问题
.5
:: up :, 1 user, load average: 0., 0., 0.
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]:
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页。
vi编辑器图解教程 中英文对照
Linux系统下光,驱软开关与限速 一、光驱的软开关:eject-rcdrom,弹开指定光驱设备的仓门,如只有一个光驱,直接用eject就可,如有两个光驱设备根据/dev/下设备文件来指定设备,如我
LINUX系统下MySQL 压力测试工具super smack 1.源文件下载地址:
标签: 如何隐藏应用软件
本文链接地址:https://www.jiuchutong.com/biancheng/360760.html 转载请保留说明!友情链接: 武汉网站建设