티스토리 뷰

반응형

|Conky 사용하기

리눅스에서 실시간으로 시스템 정보를 확인하려면 터미널에서 nvidia-smi와 같은 명령어를 사용하거나 기타 툴을 실행해야 합니다.

이를 더욱 편하게 하기 위해서는 Conky라는 위젯을 사용할 수 있는데 Conky는 커스터마이징이 가능한 위젯입니다.

위 이미지처럼 Conky를 사용해서 편리하게 실시간으로 시스템 정보를 확인할 수 있습니다. 

이 포스팅에서는 conky 설치법과 필자가 사용하는 conky code를 공유할려고 합니다.

또한 간단한 설정법에 관해서 설명하고자 합니다. 

참고로 필자는 우분투 18.04 버전을 사용중입니다.


|Conky 설치하기

 우분투 18.04 기준으로 터미널에서 아래의 명령어를 치면 됩니다.

1
sudo apt install conky-all
cs

위 명령어를 쳐서 설치를 했다면 시작프로그램에 등록해줘야 합니다. 

간편하게 등록을 할려면 윈도우 버튼(슈퍼 키)를 누른 후 검색창에다가 한글버전이라면 '시작 프로그램'을 영어라면 'start manager'를 검색하면 됩니다.

추가를 누르고 위와같이 입력 후 추가하면 됩니다. 정상적으로 진행되었다면 로그아웃이나 재부팅 후 conky 위젯이 바탕화면에 나타나게 됩니다.

만약 위 과정이 이해가 잘 안된다면 출처를 따라가서 사진을 보고 따라해보세요.

1
cp /etc/conky/conky.conf ~/.conkyrc
cs

그 다음 위 명령어를 쳐서 conky 설정을 편하게 할 수 있게 합니다.


|Conky 설정하기

이제 각자가 편한 텍스터 에디터를 사용해서 위 파일을 수정하면 됩니다.

필자의 경우 nano를 사용하기 때문에 터미널에 아래와 같이 치면됩니다.

1
nano ~/.conkyrc
cs

nano가 아니라 vim이나 기타 텍스터 에디터를 사용하면 동일하게 치되 nano부분만 변경하면 됩니다.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
-- vim: ts=4 sw=4 noet ai cindent syntax=lua
--[[
Conky, a system monitor, based on torsmo
 
Any original torsmo code is licensed under the BSD license
 
All code written since the fork of torsmo is licensed under the GPL
 
Please see COPYING for details
 
Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
Copyright (c) 2005-2012 Brenden Matthews, Philip Kovacs, et. al. (see AUTHORS)
All rights reserved.
 
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
]]
 
conky.config = {
 
        update_interval = 1,
        cpu_avg_samples = 8,
        net_avg_samples = 2,
        out_to_console = false,
        override_utf8_locale = true,
        double_buffer = true,
        no_buffers = true,
        text_buffer_size = 32768,
        imlib_cache_size = 0,
        own_window = true,
        own_window_type = 'normal',
        own_window_argb_visual = true,
        own_window_argb_value = 150,
        own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager',
        border_inner_margin = 5,
        border_outer_margin = 0,
        xinerama_head = 1,
        alignment = 'bottom_right',
        gap_x = 0,
        gap_y = 33,
        draw_shades = false,
        draw_outline = false,
        draw_borders = false,
        draw_graph_borders = false,
        use_xft = true,
        font = 'Ubuntu Mono:size=12',
        xftalpha = 0.8,
        uppercase = false,
        default_color = 'white',
        own_window_colour = '#000000',
        minimum_width = 400, minimum_height = 0,
        alignment = 'top_right',
 
};
conky.text = [[
 
 
${voffset -16}${font sans-serif:bold:size=36}${alignc}${time %H:%M %S}${font}
${voffset 6}${font sans-serif:normal:size=18}${alignc}${time %Y %m-%d}
${font}${voffset -4}
${font sans-serif:bold:size=14}SYSTEM ${hr 2}
${font sans-serif:normal:size=10}CPU :  ${color #FCAF3E}${execi 1000 grep model /proc/cpuinfo | cut -d : -f2 | tail -1 | sed 's/\s//'}
${font sans-setif:normal:size=10}${color1}GPU :  ${color #FCAF3E}${exec nvidia-smi --query-gpu=gpu_name --format=csv,noheader,nounits} $color
${font sans-serif:normal:size=10}$sysname $kernel $alignr $machine
Uptime:$alignr$uptime
 
${font sans-serif:bold:size=14}CPU ${hr 2}
${font sans-serif:normal:size=10}${color1}CPU Temp : ${hwmon 0 temp 1} °C
CPU0 :   ${freq 1} MHz ${alignr}${cpubar cpu0 6,250${cpu cpu1} %
CPU1 :   ${freq 2} MHz ${alignr}${cpubar cpu2 6,250}  ${cpu cpu2} %
CPU2 :   ${freq 3} MHz ${alignr}${cpubar cpu3 6,250}  ${cpu cpu3} %
CPU3 :   ${freq 4} MHz ${alignr}${cpubar cpu4 6,250}  ${cpu cpu4} %
CPU4 :   ${freq 5} MHz ${alignr}${cpubar cpu5 6,250}  ${cpu cpu5} %
CPU5 :   ${freq 6} MHz ${alignr}${cpubar cpu6 6,250}  ${cpu cpu6} %
CPU6 :   ${freq 7} MHz ${alignr}${cpubar cpu7 6,250}  ${cpu cpu7} %
CPU7 :   ${freq 8} MHz ${alignr}${cpubar cpu8 6,250}  ${cpu cpu8} %
CPU8 :   ${freq 9} MHz ${alignr}${cpubar cpu9 6,250}  ${cpu cpu9} %
CPU9 :   ${freq 10} MHz ${alignr}${cpubar cpu10 6,250}  ${cpu cpu10} %
CPU10 : ${freq 11} MHz ${alignr}${cpubar cpu11 6,250}  ${cpu cpu11} %
CPU11 : ${freq 12} MHz ${alignr}${cpubar cpu12 6,250}  ${cpu cpu12} %
CPU12 : ${freq 13} MHz ${alignr}${cpubar cpu13 6,250}  ${cpu cpu13} %
CPU13 : ${freq 14} MHz ${alignr}${cpubar cpu14 6,250}  ${cpu cpu14} %
CPU14 : ${freq 15} MHz ${alignr}${cpubar cpu15 6,250}  ${cpu cpu15} %
CPU15 : ${freq 16} MHz ${alignr}${cpubar cpu16 6,250}  ${cpu cpu16} %
 
${font sans-serif:bold:size=14}MEMORY ${hr 2}
${font sans-serif:normal:size=10}RAM $alignc $mem / $memmax $alignr $memperc%
${membar 6,400 }
SWAP $alignc ${swap} / ${swapmax} $alignr ${swapperc}%
${swapbar 6,400 }
 
${font sans-serif:bold:size=14}GPU ${hr 2}
${font sans-serif:normal:size=10}${color1}GPU Utilization ${color}${alignr}${exec nvidia-smi | grep % | cut -61-63} %
${color1}GPU Clock ${alignr}${color0}${nvidia gpufreq} MHz
${color1}Mem Clock ${alignr}${color0}${nvidia memfreq} MHz
${color2}Mem Used ${alignr}${color0}${execi 5 nvidia-settings -q [gpu:0]/UsedDedicatedGPUMemory -t} / ${exec nvidia-settings -q [gpu:0]/TotalDedicatedGPUMemory -t} MiB
${color1}GPU Power Draw ${alignr}${exec nvidia-smi | grep % | cut -21-23} W
${color1}GPU Temp ${alignr}${color0}${nvidia temp} °C
 
${font sans-serif:bold:size=14}DISK USAGE ${hr 2}
${font sans-serif:normal:size=10}${alignc}              ${fs_used // ${fs_size /${alignr} ${fs_used_perc /}%
${fs_bar 6,400}
 
${font Ubuntu:bold:size=14}NETWORK ${hr 2}
${font sans-serif:normal:size=10}Local IPs : ${execi 1000 ip a | grep inet | grep -vw lo | grep -v inet6 | cut -d \/ -f1 | sed 's/[^0-9\.]*//g'}  ${alignr}External IP : ${execi 1000  wget --O- http://ipecho.net/plain; echo}
${font sans-serif:normal:size=10}Down: ${downspeed enp6s0}  ${alignr}Up: ${upspeed enp6s0}
${color lightgray}${downspeedgraph enp6s0 40,190 } ${alignr}${upspeedgraph enp6s0 40,190 }$color
${font sans-serif:bold:size=14}TOP PROCESSES ${hr 2}
${font sans-serif:bold:size=10}Name $alignr PID   CPU%   MEM%${font sans-serif:normal:size=10}
${top name 1} $alignr ${top pid 1${top cpu 1}% ${top mem 1}%
${top name 2} $alignr ${top pid 2${top cpu 2}% ${top mem 2}%
${top name 3} $alignr ${top pid 3${top cpu 3}% ${top mem 3}%
${top name 4} $alignr ${top pid 4${top cpu 4}% ${top mem 4}%
${top name 5} $alignr ${top pid 5${top cpu 5}% ${top mem 5}%
]];
cs

위는 필자가 쓰고 있는 코드입니다. 이 코드 말고도 구글에서 conky 로 검색하면 여러 사람들이 올린 코드가 있으니 마음에 드는 코드로 적용하면 됩니다.

이제 위 코드중 필수적으로 수정해야 하는 부분과 원하면 수정가능한 부분을 주석으로 달아서 한개 더 올리겠습니다


-- vim: ts=4 sw=4 noet ai cindent syntax=lua

--[[

Conky, a system monitor, based on torsmo


Any original torsmo code is licensed under the BSD license


All code written since the fork of torsmo is licensed under the GPL


Please see COPYING for details


Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen

Copyright (c) 2005-2012 Brenden Matthews, Philip Kovacs, et. al. (see AUTHORS)

All rights reserved.


This program is free software: you can redistribute it and/or modify

it under the terms of the GNU General Public License as published by

the Free Software Foundation, either version 3 of the License, or

(at your option) any later version.


This program is distributed in the hope that it will be useful,

but WITHOUT ANY WARRANTY; without even the implied warranty of

MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

GNU General Public License for more details.

You should have received a copy of the GNU General Public License

along with this program.  If not, see <http://www.gnu.org/licenses/>.

]]


conky.config = {


        update_interval = 1,

        cpu_avg_samples = 8,

        net_avg_samples = 2,

        out_to_console = false,

        override_utf8_locale = true,

        double_buffer = true,

        no_buffers = true,

        text_buffer_size = 32768,

        imlib_cache_size = 0,

        own_window = true,

        own_window_type = 'normal',

        own_window_argb_visual = true,

        own_window_argb_value = 150, //투명도 100이 기본이며 값이 커질수록 갈수록 불투명해진다

        own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager',

        border_inner_margin = 5,

        border_outer_margin = 0,

        xinerama_head = 1,

        alignment = 'bottom_right',

        gap_x = 0,

        gap_y = 33,

        draw_shades = false,

        draw_outline = false,

        draw_borders = false,

        draw_graph_borders = false,

        use_xft = true,

        font = 'Ubuntu Mono:size=12',

        xftalpha = 0.8,

        uppercase = false,

        default_color = 'white',

        own_window_colour = '#000000',

        minimum_width = 400, minimum_height = 0, //창의 최소 크기

        alignment = 'top_right', //창이 위치하는 방향 top_left, bottom_right 등등


};

conky.text = [[



${voffset -16}${font sans-serif:bold:size=36}${alignc}${time %H:%M %S}${font} //모든 폰트 크기는 원한느데로 변경 가능 bold는 굵은 글씨

${voffset 6}${font sans-serif:normal:size=18}${alignc}${time %Y %m-%d}

${font}${voffset -4}

${font sans-serif:bold:size=14}SYSTEM ${hr 2}

${font sans-serif:normal:size=10}CPU :  ${color #FCAF3E}${execi 1000 grep model /proc/cpuinfo | cut -d : -f2 | tail -1 | sed 's/\s//'}

${font sans-setif:normal:size=10}${color1}GPU :  ${color #FCAF3E}${exec nvidia-smi --query-gpu=gpu_name --format=csv,noheader,nounits} $color

${font sans-serif:normal:size=10}$sysname $kernel $alignr $machine

Uptime:$alignr$uptime


${font sans-serif:bold:size=14}CPU ${hr 2}

${font sans-serif:normal:size=10}${color1}CPU Temp : ${hwmon 0 temp 1} °C //필자는 2700x 사용으로 16개 썼지만 본인의 코어수에 맞게 1번부터 코어수만큼만 하면 된다. 쓰레드 숫자로

CPU0 :   ${freq 1} MHz ${alignr}${cpubar cpu0 6,250} ${cpu cpu1} %

CPU1 :   ${freq 2} MHz ${alignr}${cpubar cpu2 6,250}  ${cpu cpu2} %

CPU2 :   ${freq 3} MHz ${alignr}${cpubar cpu3 6,250}  ${cpu cpu3} %

CPU3 :   ${freq 4} MHz ${alignr}${cpubar cpu4 6,250}  ${cpu cpu4} %

CPU4 :   ${freq 5} MHz ${alignr}${cpubar cpu5 6,250}  ${cpu cpu5} %

CPU5 :   ${freq 6} MHz ${alignr}${cpubar cpu6 6,250}  ${cpu cpu6} %

CPU6 :   ${freq 7} MHz ${alignr}${cpubar cpu7 6,250}  ${cpu cpu7} %

CPU7 :   ${freq 8} MHz ${alignr}${cpubar cpu8 6,250}  ${cpu cpu8} %

CPU8 :   ${freq 9} MHz ${alignr}${cpubar cpu9 6,250}  ${cpu cpu9} %

CPU9 :   ${freq 10} MHz ${alignr}${cpubar cpu10 6,250}  ${cpu cpu10} %

CPU10 : ${freq 11} MHz ${alignr}${cpubar cpu11 6,250}  ${cpu cpu11} %

CPU11 : ${freq 12} MHz ${alignr}${cpubar cpu12 6,250}  ${cpu cpu12} %

CPU12 : ${freq 13} MHz ${alignr}${cpubar cpu13 6,250}  ${cpu cpu13} %

CPU13 : ${freq 14} MHz ${alignr}${cpubar cpu14 6,250}  ${cpu cpu14} %

CPU14 : ${freq 15} MHz ${alignr}${cpubar cpu15 6,250}  ${cpu cpu15} %

CPU15 : ${freq 16} MHz ${alignr}${cpubar cpu16 6,250}  ${cpu cpu16} %


${font sans-serif:bold:size=14}MEMORY ${hr 2}

${font sans-serif:normal:size=10}RAM $alignc $mem / $memmax $alignr $memperc%

${membar 6,400 }

SWAP $alignc ${swap} / ${swapmax} $alignr ${swapperc}%

${swapbar 6,400 }


${font sans-serif:bold:size=14}GPU ${hr 2}

${font sans-serif:normal:size=10}${color1}GPU Utilization ${color}${alignr}${exec nvidia-smi | grep % | cut -c 61-63} %

${color1}GPU Clock ${alignr}${color0}${nvidia gpufreq} MHz

${color1}Mem Clock ${alignr}${color0}${nvidia memfreq} MHz

${color2}Mem Used ${alignr}${color0}${execi 5 nvidia-settings -q [gpu:0]/UsedDedicatedGPUMemory -t} / ${exec nvidia-settings -q [gpu:0]/TotalDedicatedGPUMemory -t} MiB

${color1}GPU Power Draw ${alignr}${exec nvidia-smi | grep % | cut -c 21-23} W

${color1}GPU Temp ${alignr}${color0}${nvidia temp} °C


${font sans-serif:bold:size=14}DISK USAGE ${hr 2}

${font sans-serif:normal:size=10}${alignc}              ${fs_used /} / ${fs_size /} ${alignr} ${fs_used_perc /}%

${fs_bar 6,400}


${font Ubuntu:bold:size=14}NETWORK ${hr 2}

${font sans-serif:normal:size=10}Local IPs : ${execi 1000 ip a | grep inet | grep -vw lo | grep -v inet6 | cut -d \/ -f1 | sed 's/[^0-9\.]*//g'}  ${alignr}External IP : ${execi 1000  wget -q -O- http://ipecho.net/plain; echo}

${font sans-serif:normal:size=10}Down: ${downspeed enp6s0}  ${alignr}Up: ${upspeed enp6s0} //enp6s0 부분은 각자의 컴퓨터마다 다른데 ifconfig를 터미널에 치게되면 가장 먼저 나오는 부분으로 바꿔서 입력하면 된다

${color lightgray}${downspeedgraph enp6s0 40,190 } ${alignr}${upspeedgraph enp6s0 40,190 }$color

${font sans-serif:bold:size=14}TOP PROCESSES ${hr 2}

${font sans-serif:bold:size=10}Name $alignr PID   CPU%   MEM%${font sans-serif:normal:size=10}

${top name 1} $alignr ${top pid 1} ${top cpu 1}% ${top mem 1}% //5개만 보이게 해 놓았는데 원한다면 5개이상도 가능하고 반대로 5개 미만도 가능하다 

${top name 2} $alignr ${top pid 2} ${top cpu 2}% ${top mem 2}%

${top name 3} $alignr ${top pid 3} ${top cpu 3}% ${top mem 3}%

${top name 4} $alignr ${top pid 4} ${top cpu 4}% ${top mem 4}%

${top name 5} $alignr ${top pid 5} ${top cpu 5}% ${top mem 5}%

]];

위에서 필수로 변경해야 할 것은 CPU숫자 ifconfig를 통해 네트워크 장치 이름 변경입니다.

만약 필자가 설명한 것 외에도 궁금한 점이나 잘 안되는 점이 있으면 댓글 남기면 답하겠습니다.


출처/참고

https://linuxconfig.org/system-monitoring-on-ubuntu-18-04-linux-with-conky


광고


반응형
댓글
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함