網頁

2020年9月1日 星期二

conky in jetson nano


安裝相依套件
$ sudo apt-get install cmake
$ sudo apt-get install libimlib2-dev
$ sudo apt-get install libncurses5-dev
$ sudo apt-get install libx11-dev
$ sudo apt-get install libxdamage-dev
$ sudo apt-get install libxft-dev
$ sudo apt-get install libxinerama-dev
$ sudo apt-get install libxml2-dev
$ sudo apt-get install libxext-dev
$ sudo apt-get install libcurl4-openssl-dev
$ sudo apt-get install liblua5.3-dev

確認 cmake 版本要 >=3.8
$ cmake --version


下載原始碼並編譯安裝
$ git clone https://github.com/brndnmtthws/conky.git
$ cd conky
$ mkdir build
$ cd build
$ cmake ..
$ make
$ sudo make install

安裝 設定檔
$ vi .conkyrc
--[[
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-2019 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 = {
    alignment = 'top_right',
    background = false,
    border_width = 1,
    border_inner_margin = 5,
    border_outer_margin = 0,
    cpu_avg_samples = 2,
    default_color = 'white',
    default_outline_color = 'white',
    default_shade_color = 'white',
    double_buffer = true,
    draw_borders = false,
    draw_graph_borders = true,
    draw_outline = false,
    draw_shades = false,
    extra_newline = false,
    font = 'DejaVu Sans Mono:size=12',
    gap_x = 20,
    gap_y = 50,
    minimum_height = 5,
    minimum_width = 5,
    net_avg_samples = 2,
    double_buffer = true,
    no_buffers = true,
    out_to_console = false,
    out_to_ncurses = false,
    out_to_stderr = false,
    out_to_x = true,
    own_window = true,
    own_window_class = 'Conky',
    own_window_type = 'desktop',
    own_window_argb_visual = true,
    own_window_argb_value = 80,
    show_graph_range = false,
    show_graph_scale = false,
    stippled_borders = 0,
    update_interval = 1.0,
    uppercase = false,
    use_spacer = 'none',
    use_xft = true,
}

conky.text = [[
${font :blod:size=16}${time %Y-%m-%d}${alignr}${time %H:%M:%S}${font}
${font :blod:size=12}SYSTEM ${hr}
${font :normal:size=10}Uptime:$alignr$uptime
Running Processes:${alignr}${running_processes} / ${processes}
Fan Speed:${alignr}${execpi 3 (echo $((`cat /sys/devices/pwm-fan/cur_pwm` * 100 / 255)))}%
AO Temperature:${alignr}${execpi 3 (echo $((`cat /sys/devices/virtual/thermal/thermal_zone0/temp` / 1000)))}°C
CPU Temperature:${alignr}${execpi 3 (echo $((`cat /sys/devices/virtual/thermal/thermal_zone1/temp` / 1000)))}°C
GPU Temperature:${alignr}${execpi 3 (echo $((`cat /sys/devices/virtual/thermal/thermal_zone2/temp` / 1000)))}°C
Wifi Temperature:${alignr}${execpi 3 (echo $((`cat /sys/devices/virtual/thermal/thermal_zone6/temp` / 1000)))}°C
5V GPU Power:${alignr}${execpi 3 (awk -F " " '{print $25}' /tmp/tegrastats.tmp)}mW
5V CPU Power:${alignr}${execpi 3 (awk -F " " '{print $27}' /tmp/tegrastats.tmp)}mW
ALL Power:${alignr}${execpi 3 (awk -F " " '{print $23}' /tmp/tegrastats.tmp)}mW
${font :blod:size=12}CPU ${hr}
${font :normal:size=10}${execi 1000 grep model /proc/cpuinfo | cut -d : -f2 | tail -1 | sed 's/\s//'}
Frequency:$alignr${freq_g}GHz
Usage:${cpu cpu0}% ${cpubar cpu0}
${cpugraph cup0 50}
${font :blod:size=12}MEMORY & DISK ${hr}
${font :normal:size=10}RAM$alignc$mem / $memmax$alignr$memperc%
${membar}
${memgraph 50}
Disk /${alignc}${fs_used /} / ${fs_size /}${alignr}${fs_used_perc /}%
${fs_bar /}
SWAP$alignc$swap / $swapmax$alignr$swapperc%
${font :blod:size=12}NETWORK ${hr}
${font :normal:size=10}Local IPs:${alignr}External IP:
${execi 1000 ip a | grep inet | grep -vw lo | grep -v inet6 | cut -d \/ -f1 | sed 's/[^0-9\.]*//g'}  ${alignr}${execi 1000  wget -q -O- http://ipecho.net/plain; echo}
Up:${upspeed eth0}${alignr}Down:${downspeed eth0}
${upspeedgraph eth0 50, 130} ${alignr}${downspeedgraph eth0 50, 130}
${font :blod:size=12}TOP PROCESSES ${hr}
${font :normal:size=10}${color grey}Name${alignr}PID CPU% MEM%${color}
${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}
]]

因為要取得 Jetson Nano 電源消耗資訊
$ vi conky_power.sh
#!/bin/bash
sleep 10
tegrastats|while read line;do echo $line>/tmp/tegrastats.tmp;done

開始/Startup Applications
加入 /home/nano/conky_power.sh

沒有留言:

張貼留言