Linux System Monitor - BPYTOPのインストール

Ubuntu Desktop環境構築 Part 26

公開日: 2023-01-04
更新日: 2023-01-05

  Table of Contents

1. やりたいこと

  • CPU, memory, diskの利用状況を逐次モニターできる環境にしたい
  • process単位でのCPU, memory利用状況を確認できるようにしたい
  • リソースの利用状況に合わせてprocess操作(killコマンド)が可能なモニターが欲しい

実行環境

実行環境

項目  
マシン HP ENVY TE01-0xxx
OS ubuntu 20.04 LTS Focal Fossa
CPU Intel Core i7-9700 CPU 3.00 GHz
RAM 32.0 GB
GPU NVIDIA GeForce RTX 2060 SUPER
1
2
3
4
5
6
% lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.5 LTS
Release:        20.04
Codename:       focal

2. リソースモニターとしてのBPYTOP

Features

  • Terminal Appの一種
  • レイアウトの操作がキーボードでもマウスで実行可能
  • processのソートがcpu usage, memory usage, pidなどでsort可能
  • processの検索が f + <search word> で実行可能(キャンセルしたい場合はesc)
  • process単位の詳細情報(tree情報, プログラムファイルetc)が確認可能
  • process単位のkill, Terminate, Interrupt操作がマウスで実行可能
  • network usage情報が確認可能

欠点

  • CPU usageの時系列line plotが確認可能だが, x軸のtickが存在しない

Remarks

  • GitHub repositoryはpoetryでパッケージ管理されている

3. Installation

PyPiは本人がメンテしているけれども, メンテしなくなった時ちょっと怖いので Manual installation を今回は実施

Dependencies

  • Python3
  • git
  • psutil(python module)

Install

1
2
3
git clone https://github.com/aristocratos/bpytop.git
cd bpytop
sudo make install

Uninstall

1
2
cd bpytop
sudo make uninstall

4. Terminatorでの表示設定

完成図

設定

  1. Terminatorを起動する
  2. Preference > Layoutで画面分割レイアウトを設定
  3. 上記で設定したLayoutのCustom commandsource ~/.zshrc && bpytopと設定
  4. (任意) UbuntuのStartup Application Preferenceterminator -l <Layout name> と設定

Appendix: ネットワークインターフェース

BPYTOPではネットワーク使用情報が確認できますが, どのネットワークインターフェース名がなにを表しているか理解する事が必要です.

ネットワークインターフェースの命名規則

種別 説明
en イーサネット(有線LAN) enp2s0
wl 無線LAN wlp3s0
ww 無線WAN  
デバイス 説明
オンボードデバイス o<インデックス>
ホットプラグデバイス s<スロット>
PCIデバイス p<バス>s<スロット>

ネットワークインターフェースの一覧の確認は, 次のコマンドで可能です

1
2
% ls /sys/class/net
enp2s0@  lo@  wlp3s0@

Appendix: シェルスクリプトの&&の意味

基本ルール

1
2
3
% command1; command2   #command1が成功/異常終了にかかわらず, 終了後command2を実行
% command1 && command2 #command1が成功したらcommand2を実行
% command1 || command2 #command1が異常終了したらcommand2を実行

三項演算

1
2
3
4
5
6
7
8
9
10
11
12
13
% true && true || echo "Command Failed"

% true && false || echo "Command Failed"
Command Failed
% false && true || echo "Command Failed"
Command Failed
% false && false || echo "Command Failed"
Command Failed
% true || echo "foo" && echo "boo" 
boo
% false || echo "foo" && echo "boo"
foo
boo

References

BPYTOP

&& in a shell command



Share Buttons
Share on:

Feature Tags
Leave a Comment
(注意:GitHub Accountが必要となります)