2012年12月4日

Linux Conky 安裝與設定

Conky 安裝與設定




終端機下輸入:

~# apt-get install conky -y
~# cd /etc/conky/
~# ls
conky.conf conky_no_x11.conf
~# vim conky.conf

------------------------------------------將內容改為下列------------------------------------------

background no
font Sans:size=11
#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
double_buffer yes
minimum_size 220 5
maximum_width 220
draw_shades yes
draw_outline no
draw_borders no
draw_graph_borders yes
default_color white
default_shade_color black
default_outline_color green
alignment top_right
gap_x 12
gap_y 5
no_buffers yes
uppercase no
#大小寫
cpu_avg_samples 2
override_utf8_locale no
#uppercase yes # set to yes if you want all text to be in uppercase

TEXT
${color white}System ${hr 1}${color}

Hostname: $alignr$nodename
Kernel: $alignr$kernel
Uptime: $alignr$uptime
Temp: ${alignr}${acpitemp}C

CPU: ${alignr}${freq} MHz
Processes: ${alignr}$processes ($running_processes running)
Load: ${alignr}$loadavg

CPU1 $alignr${cpu cpu1}%
${cpubar cpu1}
CPU2 $alignr${cpu cpu2}%
${cpubar cpu2}
CPU3 $alignr${cpu cpu3}%
${cpubar cpu3}
CPU4 $alignr${cpu cpu4}%
${cpubar cpu4}

ram ${alignr}$mem / $memmax ($memperc%)
${membar 4}
swap ${alignr}$swap / $swapmax ($swapperc%)
${swapbar 4}

battery ${alignr}$battery 
${battery_bar 4}


Highest CPU $alignr CPU% MEM%
${top name 1}$alignr${top cpu 1}${top mem 1}
${top name 2}$alignr${top cpu 2}${top mem 2}
${top name 3}$alignr${top cpu 3}${top mem 3}

Highest MEM $alignr CPU% MEM%
${top_mem name 1}$alignr${top_mem cpu 1}${top_mem mem 1}
${top_mem name 2}$alignr${top_mem cpu 2}${top_mem mem 2}
${top_mem name 3}$alignr${top_mem cpu 3}${top_mem mem 3}

${color white}Filesystem ${hr 1}${color}

Root: ${alignr}${fs_free /} / ${fs_size /}
${fs_bar 4 /}
Home: ${alignr}${fs_free /home} / ${fs_size /home}
${fs_bar 4 /home}

HDD0: ${alignr}${fs_free /media/HDD0} / ${fs_size /media/HDD0}
${fs_bar 4 /media/HDD0}
HDD1: ${alignr}${fs_free /media/HDD1} / ${fs_size /media/HDD1}
${fs_bar 4 /media/HDD1}
HDD2: ${alignr}${fs_free /media/HDD2} / ${fs_size /media/HDD2}
${fs_bar 4 /media/HDD2}
HDD3: ${alignr}${fs_free /media/HDD3} / ${fs_size /media/HDD3}
${fs_bar 4 /media/HDD3}

${color white}Network ${hr 1}${color}

Down ${downspeed eth0} k/s ${alignr}Up ${upspeed eth0} k/s
${downspeedgraph eth0 25,107} ${alignr}${upspeedgraph eth0 25,107}
Total ${totaldown eth0} ${alignr}Total ${totalup eth0}


---------------------------------------------------------------------------------------------------------------------------------

上面部份標示綠色的語法, 可能會因為電腦解析度與硬體設備不同而無法顯示,底下我解釋他們語法的意義

font Sans:size=11 更改字型大小,如果過大可能下辦不的部份會被遮住無法顯示
update_interval 1.0 更新顯示的速率

gap_x 12 更改位置的X座標
gap_y 5 更改位置的Y座標

uppercase no 更改大小寫

依電腦CPU核心數來增減,過多會造成無法開啟
CPU2 $alignr${cpu cpu2}%
${cpubar cpu2}
CPU3 $alignr${cpu cpu3}%
${cpubar cpu3}
CPU4 $alignr${cpu cpu4}%
${cpubar cpu4}

依電腦內接硬碟數量來增減
HDD0: ${alignr}${fs_free /media/HDD0} / ${fs_size /media/HDD0}
${fs_bar 4 /media/HDD0}
HDD1: ${alignr}${fs_free /media/HDD1} / ${fs_size /media/HDD1}
${fs_bar 4 /media/HDD1}
HDD2: ${alignr}${fs_free /media/HDD2} / ${fs_size /media/HDD2}
${fs_bar 4 /media/HDD2}
HDD3: ${alignr}${fs_free /media/HDD3} / ${fs_size /media/HDD3}
${fs_bar 4 /media/HDD3}

寬度最大值
maximum_width 225

================================================================================
2015/6/3更新

cpu 溫度顯示

請先參考這篇Linux cpu temperature

測試看看下列指令是否有出現溫度
# sensors | grep -A 0 'Core 0' | cut -c17-19
+92

有的話可以把上列的
CPU1 $alignr${cpu cpu1}%
${cpubar cpu1}
CPU2 $alignr${cpu cpu2}%
${cpubar cpu2}
CPU3 $alignr${cpu cpu3}%
${cpubar cpu3}
CPU4 $alignr${cpu cpu4}%
${cpubar cpu4}

改成
CPU1 $alignr${cpu cpu1}% Temp:${execi 8 sensors | grep -A 0 'Core 0' | cut -c17-19}°C
${cpubar cpu1}
CPU2 $alignr${cpu cpu2}% Temp:${execi 8 sensors | grep -A 0 'Core 1' | cut -c17-19}°C
${cpubar cpu2}
CPU3 $alignr${cpu cpu3}% Temp:${execi 8 sensors | grep -A 0 'Core 2' | cut -c17-19}°C
${cpubar cpu3}
CPU4 $alignr${cpu cpu4}% Temp:${execi 8 sensors | grep -A 0 'Core 3' | cut -c17-19}°C
${cpubar cpu4}


參考資料:http://ebupof.deviantart.com/art/My-Conky-Config-1-3-60095106

http://conky.sourceforge.net/variables.html

沒有留言:

張貼留言

文章有誤或有問題麻煩您留言告知! 謝謝您~~