2009年5月11日星期一

系统监控软件Conky

虽然监控系统状况的软件很多,但现在最受欢迎的该是Conky,Conky 小巧,漂亮,且配置方便简单。
CPU 温度读取部分用了sensors,硬盘温度读取用hddtemp。
首先apt-get install conky,这当然不用说了,接下来就是配置了,效果如图:

Conky 安装后不会为当前用户创建配置文件,而是使用系统级默认配置文件,这时候需要使用下列命令手动生成当前用户的配置文件:
zcat /usr/share/doc/conky/examples/conkyrc.sample.gz > ~/.conkyrc
然 后打开主文件夹,显示隐藏文件,打开.conkyrc文件,编辑里面的内容,再在终端输入conky启动conky.通过系统监视器结束conky进程和 终端启动conky.可以反复调试conky.

以下是我的配置文件:

background no
xftfont Monospace:style=Bold:size=10
#xftfont Sans:size=10
use_xft yes
xftalpha 0.9
update_interval 1.0
total_run_times 0
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
out_to_console no
double_buffer yes
minimum_size 220 5
maximum_width 220
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders 1
default_color white
default_shade_color black
default_outline_color green
alignment bottom_right
gap_x 12
gap_y 35
no_buffers yes
uppercase no
cpu_avg_samples 2
net_avg_samples 2
override_utf8_locale yes

TEXT

${color white}${font YaHeiConsolas:style=Bold:size=12}${time %b%d日 星期%a}${alignr}${time %p%l:%M:%S}
${color white}${font YaHeiConsolas:style=Bold:size=12}主 机 名: ${font Impact:size=10}$alignr$nodename
${color white}${font YaHeiConsolas:style=Bold:size=12}内 核: ${font Impact:size=10}$alignr$kernel
${color white}${font YaHeiConsolas:style=Bold:size=12}运行时间: ${font Impact:size=10}$alignr$uptime
${color white}${font YaHeiConsolas:style=Bold:size=12}CPU温度: ${font Impact:size=10}${alignr}${acpitemp}°C
${color white}${font YaHeiConsolas:style=Bold:size=12}CPU频率: ${font Impact:size=10}${alignr}${freq} MHz
${color white}${font YaHeiConsolas:style=Bold:size=12}进 程 数: ${font Impact:size=10}${alignr}$processes ($running_processes running)
${color white}${font YaHeiConsolas:style=Bold:size=12}系统负载: ${font Impact:size=10}${alignr}$loadavg
${color white}${font Impact:size=9}${execi 1000 cat /proc/cpuinfo | grep 'model name' | sed -e 's/model name.*: //'}
${color #F3AB2E}${font Catull Bold:style=Bold:size=10}C${color #C02E1D}p${color #F3AB2E}u${color white}-1${color #88aadd} ${cpubar 4,135 cpu1} ${font Impact:size=10}${color white}${alignr}${cpu cpu1}%
${color #F3AB2E}${font Catull Bold:style=Bold:size=10}C${color #C02E1D}p${color #F3AB2E}u${color white}-2${color #88aadd} ${cpubar 4,135 cpu2} ${font Impact:size=10}${color white}${alignr}${cpu cpu2}%
${color white}${font YaHeiConsolas:style=Bold:size=12}物理内存: ${font Impact:size=10}${alignr}$mem / $memmax ($memperc%)
${color #88aadd}${membar 4}
${color white}${font YaHeiConsolas:style=Bold:size=12}交换空间: ${font Impact:size=10}${alignr}$swap / $swapmax ($swapperc%)
${color #88aadd}${swapbar 4}
${color white}${font YaHeiConsolas:style=Bold:size=10}CPU使用量 ${font Impact:size=10}$alignr CPU ${font YaHeiConsolas:size=10} 内存%
${font Narkisim:size=10:style=Regular}${top name 1}$alignr${top cpu 1}${top mem 1}
${font Narkisim:size=10:style=Regular}${top name 2}$alignr${top cpu 2}${top mem 2}
${font Narkisim:size=10:style=Regular}${top name 3}$alignr${top cpu 3}${top mem 3}
${color white}${font YaHeiConsolas:style=Bold:size=10}高内存 ${font Impact:size=10}$alignr CPU ${font YaHeiConsolas:size=10} 内存%
${font Narkisim:size=10:style=Regular}${top_mem name 1}$alignr${top_mem cpu 1}${top_mem mem 1}
${font Narkisim:size=10:style=Regular}${top_mem name 2}$alignr${top_mem cpu 2}${top_mem mem 2}
${font Narkisim:size=10:style=Regular}${top_mem name 3}$alignr${top_mem cpu 3}${top_mem mem 3}
${color #ddaa00}${font YaHeiConsolas:style=Bold:size=12}${alignc}文件系统 ${color}
${color white}${font YaHeiConsolas:style=Bold:size=12}主目录: ${font Impact:size=10}${alignr}${fs_free /} / ${fs_size /}
${color #88aadd}${fs_bar 4 /}
${color white}${font YaHeiConsolas:style=Bold:size=12}家目录: ${font Impact:size=10}${alignr}${fs_free /home} / ${fs_size /home}
${color #88aadd}${fs_bar 4 /home}
${font YaHeiConsolas:style=Bold:size=11}下载速度: ${font Impact:size=9}${downspeed eth0} k/s ${font YaHeiConsolas:style=Bold:size=11}上传速度:${alignr}${font Impact:size=9}${upspeed eth0} k/s
${color #88aadd}${downspeedgraph eth0 15,105 ff0000 0000ff} $alignr${color #88aadd}${upspeedgraph eth0 15,105 0000ff ff0000}

${color white}${font YaHeiConsolas:style=Bold:size=11}下载总量 ${font Impact:size=9}${totaldown eth0} ${font YaHeiConsolas:style=Bold:size=11}${alignr}上传总量 ${font Impact:size=9}${totalup eth0}

没有评论: