Linux 监控CPU 温度

安装测试系统:

硬件:普通PC机,

软件:redhat linux as 4  2.6 .9 , 安装系统自带的lm_sensors-2.8.7-2.i386

你也可以从[url]http://www.edgedesign.us/about/lm_sensors[/url]下载

这个软件可以在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

启动

[[email protected] 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 软件。

时间: 2024-08-10 02:38:47

Linux 监控CPU 温度的相关文章

linux获取CPU温度

Centos系列 1 yum install lm_sensors 2 sensors-detect 3 sensors Ubuntu系列(多了service module-init-tools start一步骤) 1 apt-get install lm-sensors 2 sensors-detect 3 service module-init-tools start 4 sensors 也可以通过sys系统读取cpu的温度: /sys/class/hwmon/hwmon0/device/

linux 监控CPU memory disk process 脚本

#!/bin/bash # #This is a monitor system CPU Memory process disk IO disk zone statistixs scripts. # # ##CPU usage rate /bin/date>> /mnt/system_info.log echo -e "\n" >> /mnt/system_info.log ##CPU usage rate echo -e "\033[31mCPU us

Linux 查看CPU温度

安装 lm-sensors sudo apt-get install lm-sensors # 安装yes | sudo sensors-detect # 侦测所有感测器 sensors # 查看温度 reference :https://magiclen.org/linux-view-cpu/

linux查看cpu温度

  分类: linux系统 一.安装 sudo apt-get install lm-sensors 二.查看 [email protected]:~$ sensors k10temp-pci-00c3 Adapter: PCI adapter temp1:        +33.6°C  (high = +70.0°C) (crit = +72.0°C, hyst = +70.0°C) radeon-pci-0100 Adapter: PCI adapter temp1:        +54

简单几步使用zabbix监控Linux物理服务器CPU温度

前段时间有个属于笔者维护的小机房空调故障,温度过高导致系统卡慢,多日无人发现.于是想着使用zabbix监控CPU温度并设置告警阀值,同时也能监控到风扇异常.挡风板太脏空气不畅.进程死锁导致CPU使用率超高等异常,侧面监控服务器多种异常状况. 服务器有两台四路x86服务器,系统是CentOS,用到软件lm_sensors.使用zabbix监控系统自定义监控项,采集监控数据并设置告警.下面详细介绍. 安装 lm_sensors 并获取CPU温度 yum install lm_sensors 安装后运

linux-查看cpu温度的方法

linux查看cpu温度,安装lm_sensors工具 1.安装lm_sensors工具即可查看温度了 yum -y install lm_sensors rpm -qa|grep coretemp 看一下有没有kmod-coretemp,没有的话需要安装这个 x86和x64的系统直接wget http://www.pperry.f2s.com/linux/coretemp/kmod-coretemp-1.1-2.el5.x86_64.rpm 2.然后rpm -ivh kmod-coretemp

Linux 检测CPU常用的工具sar iostat vmstat top uptime

sar -u 1 2 iostat -c 1 2 vmstat 1 2 top uptime Linux监控CPU整体性能常用的工具有: # mpstat: mpstat 不但能查看所有CPU的平均信息,还能查看指定CPU的信息. # vmstat:只能查看所有CPU的平均信息:查看cpu队列信息: # iostat:  只能查看所有CPU的平均信息. # sar: 与mpstat 一样,不但能查看CPU的平均信息,还能查看指定CPU的信息. # top:显示的信息同ps接近,但是top可以了解

Linux终端下查看CPU温度

在我们服务器日常维护中,我们可能会关心服务器CPU的温度,如何在Linux系统中快速查看CPU温度呢?lm_sensors提供了一套方案,可以自动侦测主板传感器的型号和读取方式,可以在命令行模式下快速安装运行.这样我们就可以把CPU温度纳入到日常的监控中去了. 在CentOS系统中安装使用实例如下: #yum install -y lm_sensors 然后运行sensors-detect来探测传感器类型,此命令会给出一些问题,一律回答Yes即可: [[email protected] ~]#

Zabbix添加对Windows 客户端CPU温度的监控

温度是监测一台机器运行的重要参数 Zabbix预置的模板中没有对CPU温度的监控,所以我们需要使用自定义的KEY对温度进行监测 Windows没有温度监测的组件这时候需要借助第三方软件Speed-Fan进行温度的读取 Speed-Fan下载:http://www.almico.com/sfdownload.php 安装完成后进行简单的设置 选中需要监测的项目,勾选下面的Logged 然后打开Log选项卡,勾选Enable 最小化Speed-Fan就会转入后台运行,注意点击右上角X则会直接关闭软件