安装测试系统:
硬件:普通PC机,
软件:redhat linux as 4  2.6 .9 , 安装系统自带的lm_sensors-2.8.7-2.i386
这个软件可以在linux下收集到系统温度。然后我用cacti显示。
由于是系统自带的。所以我在安装系统的时候就已经安装好的。所以如果你找不到的话。可以在系统盘上找,然后rpm安装。这个我就不说了。
下来看配置:
运行:  /sbin/depmod –a
vi /etc/ld.so.conf
加入这一行: /usr/local/lib
运行: ldconfig
运行:sensors-detect 扫瞄你的主机使用那些芯片组
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: 回车
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
启动
[root@linux etc]# /etc/rc.d/init.d/lm_sensors start
Starting lm_sensors:                                       [  OK  ]
测试:运行 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
运行: ntsysv
设置lm_sensors 开机运行。
接下来 设置与 cacti整合:
编辑数据采集脚本
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
添加权限:chmod +x mrtg.sh
采集结果如下:
42
26
4:50, 2 users,
linux226
接下来改写档案
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]: 系统温度;

  LegendI[index]: CPU温度;

  Title[index]: Blue-Moon City 系统温度表

  PageTop[index]: <H1>Blue-Moon City 主机温度表</H1>

  <TABLE>

  <TR><TD>系统:</TD> <TD>RedHat 9.0+Apache 2.0.40 </TD></TR>

  </TABLE>

Mrtg添加:root#/usr/bin/mrtg /var/www/html/mrtg/temp/mrtg.cfg.temp
然后将上面这条命令加入crontab 里定时运行。
我在pc机测试没有问题。。IBM服务器测试没有成功,总是 sensors-detect 时候出错。
经查询:IBM服务器不建议用lm_sensors 软件。

Linux 监控CPU 温度的更多相关文章

  1. zabbix 监控cpu 温度

    Zabbix监控Linux主机CPU温度   一.客户端 1.客户Linux主机安装Im_sensors [root@localhost ~]# yum install -y lm-sensors-y ...

  2. Linux监控CPU,内存,磁盘I/O

    简单讲讲Linux下监控 [CPU] 监控CPU,top命令能够实时监控系统的运行状态,并且可以按照CPU.内存和执行时间进行排序,同时top命令还可以通过交互式命令进行设定显示,通过top命令可以查 ...

  3. Linux 监控CPU、内存、IO

    安装说明 # tar zxvf sysstat-11.5.6.tar.gz# cd sysstat-11.5.6# ./configure# make# make install 备注:若在linux ...

  4. linux获取CPU温度

    Centos系列 1 yum install lm_sensors 2 sensors-detect 3 sensors Ubuntu系列(多了service module-init-tools st ...

  5. Linux监控--CPU、内存、I/O

    CPU top命令能够实时监控系统的运行状态,并且可以按照CPU.内存和执行时间进行排序,同时top命令还可以通过交互式命令进行设定显示,通过top命令可以查看即时活跃的进行. 内存 free命令可以 ...

  6. linux查看cpu温度

      分类: linux系统 一.安装  sudo apt-get install lm-sensors   二.查看 linux@cdyemail:~$ sensors k10temp-pci-00c ...

  7. Linux 查看CPU温度

    安装 lm-sensors sudo apt-get install lm-sensors # 安装yes | sudo sensors-detect # 侦测所有感测器 sensors # 查看温度 ...

  8. Linux监控cpu,内存,磁盘脚本

    #!/bin/bash # CPU_us=$(vmstat | awk '{print $13}' | sed -n '$p') CPU_sy=$(vmstat | awk '{print $14}' ...

  9. linux采集CPU温度并上传数据到云平台判断是否需要beep

    如果要beep肯定要apt install beep的 但光安装好还不够,需要执行模块加载 /sbin/modprobe pcspkr 再写一个bash脚本 data=$(/usr/bin/senso ...

随机推荐

  1. 分布式系统间通信之RPC的基本概念(六)

    RPC(Remote Procedure Call Protocol)远程过程调用协议.一个通俗的描述是:客户端在不知道调用细节的情况下,调用存在于远程计算机上的某个对象,就像调用本地应用程序中的对象 ...

  2. spoj SORTBIT - Sorted bit squence

    Let's consider the 32 bit representation of all integers i from m up to n inclusive (m ≤ i ≤ n; m × ...

  3. bzoj3639: Query on a tree VII

    Description You are given a tree (an acyclic undirected connected graph) with n nodes. The tree node ...

  4. bzoj3583: 杰杰的女性朋友 && 4362: Graph

    Description 给出一张n个点的有向图G(V,E).对于任意两个点u,v(u可以等于v),u向v的连边数为: ∑OUT(u,i) * IN(v,i),其中1<=i<=K 其中k和数 ...

  5. ExtJS 4 树

    Tree Panel是ExtJS中最多能的组件之一,它非常适合用于展示分层的数据.Tree Panel和Grid Panel继承自相同的基类,所以所有从Grid Panel能获得到的特性.扩展.插件等 ...

  6. 应用SecureCRT(发送接收文件)

    使用 SecureCRT 和 cz. sz,可以从 Linux 服务器上下载/上传文件. Linux 上要安装 lszrz 包 (1)编译安装root 账号登陆后,依次执行以下命令 cd /tmp w ...

  7. BZOJ 1492 货币兑换

    Description Input 第一行两个正整数\(N,S\),分别表示小Y 能预知的天数以及初始时拥有的钱数. 接下来\(N\)行,第\(K\)行三个实数\(A_{K},B_{K},Rate_{ ...

  8. BZOJ 1029 建筑抢修

    Description 小刚在玩JSOI提供的一个称之为“建筑抢修”的电脑游戏:经过了一场激烈的战斗,T部落消灭了所有z部落的入侵者.但是T部落的基地里已经有N个建筑设施受到了严重的损伤,如果不尽快修 ...

  9. SSH:Connection closed by foreign host

    以为和防火墙,性能,HOSTS.DENY,端口之类的有关,后来查了下,啥都没有关系. 就是同一台机器NAT之后,被另一台抢了先机. http://blog.sina.com.cn/s/blog_6d0 ...

  10. 了解运行时类型信息(RTTI)

    RTTI需要引用单元TypeInfo GetPropInfo 函数用于获得属性的 RTTI 指针 PPropInfo.它有四种重载形式,后面三种重载的实现都是调用第一种形式.AKinds 参数用于限制 ...