Ubuntu下conky 的风扇转速和显卡温度显示问题的解决办法

系统安装、升级讨论
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
回复
wenhuanqun
帖子: 1
注册时间: 2011-07-24 21:01

Ubuntu下conky 的风扇转速和显卡温度显示问题的解决办法

#1

帖子 wenhuanqun » 2011-07-24 21:07

系统:ubuntu10.04
笔记本:Thinkpad R400
显卡:ATI 3400
问题:安装完conky后,显示CPU温度等信息正常,但显示不了风扇的转速和显卡的温度,网上找了一些解决的办法,悲剧的是我运行aticonfig --adgt命令时报错。无法获取显卡温度,风扇转速的问题也没有找到解决的办法,琢磨了一下午,终于找到了解决的办法。
获取显卡温度时报错如下:ERROR - Get temperature failed for the Default Adapter - ATI Mobility Radeon HD 3400 Series
我们知道,conky获取系统信息时是通过获取系统文件的一些特殊字段来获取信息的,换句话说,conky是一个平台,我们要做的就是把所要监控的信息接入这个平台,而调取这些信息都是通过系统本身的命令来完成的,这时就显示了conky强大的功能了,几乎可以显示你想显示的所有系统信息,当然,前提是你知道如何调用这些信息,在编辑conky配置文件时,你需要对管道等linux下的概念很熟悉,同时,对grep,cut等命令的用法很熟悉,这点是非常重要的。
网上很多针对获取A卡温度的方法是调用显卡驱动本身的aticonfig --odgt命令来完成的,这确实是最好的办法,但在这种办法失效的情况下,就只有另寻别的办法了,以下是我的配置文件,我是通过sensors这个监控程序,来获取显卡的温度和风扇的转速,然后conky通过调取sensors所获得的信息的相关字段来获得风扇的转速和显卡的温度,以下是我的conky配置文件。有一点需要说明的是该配置文件参考借鉴了http://forum.ubuntu.org.cn/viewtopic.php?t=271567上的一篇文章,显示风扇转速和显卡温度是我自己加进去的,同时修改了显示器亮度的配置。在此对作者表示感谢。
# -*- conf -*-
#
# ~/.conkyrc - Conky configuration file

# do not fork to background
background no
# font settings
use_xft yes
font Comic Sans MS-8
uppercase no

# update every 3 secs
update_interval 2

# stay running forever
total_run_times 0

# draw to root window
own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

# avoid flickering
double_buffer yes

# size
minimum_size 400 100
maximum_width 1280

# position
alignment top_left
gap_x 0
gap_y 0

# colors
default_color white
default_shade_color black
default_outline_color black
color0 000000
color1 144556
color2 33b0dc

# borders
draw_borders no
stippled_borders 8
border_margin 4
border_width 1

# shades
draw_shades no

# outline
draw_outline no

# spacer
use_spacer no

# buffers
no_buffers yes

# sampling
cpu_avg_samples 2
net_avg_samples 2

# configuration
TEXT
${voffset 35}${offset 95}${color2}System
${offset 95}$color1 CPU: $color2 ${execi 99999 cat /proc/cpuinfo | grep "model name" -m1 | cut -d":" -f2 | cut -d" " -f2- | sed 's#Processor ##'}
${offset 95}$color1 System: $color2 ${execi 99999 lsb_release -d -s -c | tr -s "\n" " "} $kernel
${offset 95}$color1 Uptime:$color2 $uptime $color1 Load:$color2 $loadavg

${voffset -60}${offset 655}${color2}Display: Lenovo Thinkpad LCD (1280*800)
${offset 655}$color2 Brightness $color2${exec cat /proc/acpi/video/VID1/LCD0/brightness | grep current}%

${voffset 85}${offset 95}${color2}CPU 1
${offset 95}$color1 Usage: $color2${cpu cpu1}% $color1 Temperature:$color2 $acpitemp ${font iYaHei:size=8}℃
${offset 95}${font}$color1 Load: $color2$cpu% ${cpubar cpu0 6,200}
${offset 95}$color1 ${cpugraph cpu0 20,270 000000 33b0dc}
${offset 95}${color2}CPU 2
${offset 95}$color1 Usage: $color2${cpu cpu2}% $color1 Temperature:$color2 $acpitemp ${font iYaHei:size=8}℃
${offset 95}${font}$color1 Load: $color2$cpu% ${cpubar cpu1 6,200}
${offset 95}$color1 ${cpugraph cpu1 20,270 000000 33b0dc}
${offset 95}${color2}FAN: $color1${execi 300 /usr/bin/sensors | grep fan | cut -c11-17}rpm #获取风扇转速
${offset 95}${color2}GPU: $color1${execi 300 /usr/bin/sensors | grep temp4 | cut -c15-16}℃ #获取显卡温度
${offset 95}${color2}HDD: $color1${hddtemp /dev/sda}℃ #获取硬盘温度,实际上也可通过获取显卡温度的方法获取硬盘温度,只是该方法比较方便。

${voffset 35}${offset 95}${color2}Wireless (${wireless_essid wlan0})
${offset 95}$color1 IPv4: $color2${addr wlan0} ${color #144556} WLAN quality: $color2${wireless_link_qual_perc wlan0}% ${wireless_link_bar 5, 40 wlan0}
${offset 95}$color1 Down: $color2${downspeed wlan0} /s $color1 ${downspeedgraph wlan0 8,100 000000 33b0dc} $color1 Up:$color2 ${upspeed wlan0} /s $color1 ${upspeedgraph wlan0 8,100 000000 33b0dc}
${offset 95}${color2}Wire
${offset 95}$color1 IPv4: $color2${addr eth0}
${offset 95}$color1 Down: $color2${downspeed eth0}/s $color1 ${downspeedgraph eth0 8,100 000000 33b0dc} $color1 Up:$color2 ${upspeed eth0} /s $color1 ${upspeedgraph eth0 8,100 000000 33b0dc}

${voffset -430}${offset 1100}
${voffset 460}${offset 1120}$color2 ${font}Battery: $color2 ${battery_percent BAT0}% ${battery_bar BAT0}
${offset 1120}$color1 State: $color2$acpiacadapter

${voffset 30}${offset 1010}${color2}File System (${fs_type /})
${offset 1010}$color1 Total:$color2 ${fs_size /} $color1 Free:$color2 ${fs_free /} ${fs_used_perc /}%
${offset 1010}$color1 Usage:$color2 ${fs_bar 5,170 /}
${offset 1010}${color2}/home (ext4)
${offset 1010}$color1 Total:$color2 ${fs_size /home} $color1 Free:$color2 ${fs_free /home} ${fs_used_perc /home}%
${offset 1010}$color1 Usage:$color2 ${fs_bar 5,170 /home}
${offset 1010}${color2}/boot (ext4)
${offset 1010}$color1 Total:$color2 ${fs_size /boot} $color1 Free:$color2 ${fs_free /boot} ${fs_used_perc /boot}%
${offset 1010}$color1 Usage:$color2 ${fs_bar 5,170 /boot}

${voffset -10}${offset 400}${color1}Memory ${color2}($memmax)
${offset 400}${color1}RAM: $color2$mem($memperc%) ${membar 5,142}
${offset 400}${color1}Swap: $color2$swap ($swapperc%) ${membar 5,142}


${voffset -150}${offset 100}${color1}Processes: $color2$processes $color1 Runing:$color2${tcp_portmon 1 65535 count}
${offset 100}${color2}Name PID CPU% MEM%
${offset 100}${color1} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}
${offset 100}${color1} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}
${offset 100}${color1} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}

${offset 100}${color2}Mem usage
${offset 100}${color1} ${top_mem name 1} ${top_mem pid 1} ${top_mem cpu 1} ${top_mem mem 1}
${offset 100}${color1} ${top_mem name 2} ${top_mem pid 2} ${top_mem cpu 2} ${top_mem mem 2}
${offset 100}${color1} ${top_mem name 3} ${top_mem pid 3} ${top_mem cpu 3} ${top_mem mem 3}
thinkpad-ubuntu-conky.png
Screenshot.png
Screenshot.png (82.52 KiB) 查看 6300 次
头像
月下叹逍遥
论坛版主
帖子: 33994
注册时间: 2010-10-07 14:23
系统: Archdows10
来自: 某系某星某洲某国某省某市
联系:

Re: Ubuntu下conky 的风扇转速和显卡温度显示问题的解决办法

#2

帖子 月下叹逍遥 » 2011-07-24 21:14

还是习惯蛋蛋 :em06
浮生七十今三十,从此凄惶未可知
头像
mingming_song
帖子: 28
注册时间: 2012-10-10 18:51
系统: ubuntu 12.04

Re: Ubuntu下conky 的风扇转速和显卡温度显示问题的解决办法

#3

帖子 mingming_song » 2012-10-15 4:34

请问那个你的那个桌面不单单是conky吧,全屏难道是把横竖比调整的非常大么?感觉好华丽的说,求指导~~ :em06 :em06 :em06
逆风的方向更适合飞翔,我不怕万人阻挡,只怕自己投降
头像
charskar
帖子: 511
注册时间: 2011-07-28 3:14
系统: ubuntu 12.04
来自: 中國大陸安徽池州的一個鄉村中小組裏的一個農民
联系:

Re: Ubuntu下conky 的风扇转速和显卡温度显示问题的解决办法

#4

帖子 charskar » 2013-03-02 9:01

${offset 95}${color2}FAN: $color1${execi 300 /usr/bin/sensors | grep fan | cut -c11-17}rpm #获取风扇转速
${offset 95}${color2}GPU: $color1${execi 300 /usr/bin/sensors | grep temp4 | cut -c15-16}℃ #获取显卡温度
${offset 95}${color2}HDD: $color1${hddtemp /dev/sda}℃ #获取硬盘温度,实际上也可通过获取显卡温度的方法获取硬盘温度,只是该方法比较方便。
获取硬盘温度不靠谱,我测试了,显示不了。
还有显卡的温度我觉得不太准确,因为显卡温度显示得太高了。看得吓人。
迷乱了!ubuntu所谓的触控就是拖动图标和窗体。
连基本的放大缩小,卷动都没有,要触控有什么用?
难道就是为了用手指在屏幕上拖图标和窗体玩?
回复