写点什么

一款基于 Python 语言的 Linux 资源监视器!

用户头像
JackTian
关注
发布于: 2020 年 08 月 10 日
一款基于 Python 语言的 Linux 资源监视器!

大家好,我是 JackTian。


还记得前不久给大家推荐的《一款霸榜 GitHub 的开源 Linux 资源监视器!—— bashtop》吗?它是一个用 Bash 编写的 Linux 资源监视器。


昨天刚好闲逛 GitHub,发现这个作者又开源了一款基于 Python 语言的 Linux / OSX / FreeBSD 资源监视器 —— bpytop,其主要作用跟之前的 bashtop 大同小异,用于显示处理器,内存,磁盘,网络和进程的使用情况和状态。


首先我们先来看看 bpytop 资源监视器主界面。


特征


  • 易使用,带有游戏启发的菜单系统;

  • 完全支持鼠标,所有带有突出显示键的按钮均可单击,并且鼠标滚动可在进程列表和菜单框中使用;

  • 快速反应灵敏的 UI,带有 UP,DOWN 键可自行过程选择;

  • 用于显示所选进程的详细统计信息的功能;

  • 具有过滤过程的能力,可输入多个过滤器;

  • 在排序选项之间轻松切换;

  • 将 SIGTERM,SIGKILL,SIGINT 发送到选定的进程;

  • 用于更改所有配置文件选项的 UI 菜单;

  • 网络使用情况的自动缩放图;

  • 如有新版本可用,可在菜单选项中进行显示;

  • 显示磁盘的当前读写速度;


Bpytop 使用与 bashtop 相同的主题文件,因此为 bashtop 制作的任何主题都可以使用。


可根据自己的需求修改及设置 Main 配色,在自定义设置主题时,重新生成一个名为.theme的主题文件并设置默认变量赋值。


#Bashtop theme with default colors and black background......# Main background, empty for terminal default, need to be empty if you want transparent backgroundtheme[main_bg]="#00"
# Main text colortheme[main_fg]="#cc"
# Title color for boxestheme[title]="#ee"
# Higlight color for keyboard shortcutstheme[hi_fg]="#90"
# Background color of selected item in processes boxtheme[selected_bg]="#7e2626"
# Foreground color of selected item in processes boxtheme[selected_fg]="#ee"
# Color of inactive/disabled texttheme[inactive_fg]="#40"
# Misc colors for processes box including mini cpu graphs, details memory graph and details status texttheme[proc_misc]="#0de756"
# Cpu box outline colortheme[cpu_box]="#3d7b46"
# Memory/disks box outline colortheme[mem_box]="#8a882e"
# Net up/down box outline colortheme[net_box]="#423ba5"
# Processes box outline colortheme[proc_box]="#923535"
# Box divider line and small boxes line colortheme[div_line]="#30"
# Temperature graph colorstheme[temp_start]="#4897d4"theme[temp_mid]="#5474e8"theme[temp_end]="#ff40b6"
# CPU graph colorstheme[cpu_start]="#50f095"theme[cpu_mid]="#f2e266"theme[cpu_end]="#fa1e1e"
# Mem/Disk free metertheme[free_start]="#223014"theme[free_mid]="#b5e685"theme[free_end]="#dcff85"
# Mem/Disk cached metertheme[cached_start]="#0b1a29"theme[cached_mid]="#74e6fc"theme[cached_end]="#26c5ff"
# Mem/Disk available metertheme[available_start]="#292107"theme[available_mid]="#ffd77a"theme[available_end]="#ffb814"
# Mem/Disk used metertheme[used_start]="#3b1f1c"theme[used_mid]="#d9626d"theme[used_end]="#ff4769"
# Download graph colorstheme[download_start]="#231a63"theme[download_mid]="#4f43a3"theme[download_end]="#b0a9de"
# Upload graph colorstheme[upload_start]="#510554"theme[upload_mid]="#7d4180"theme[upload_end]="#dcafde"
复制代码


更多的主题配色,可通过 Bpytop 项目中的 themes 文件夹查看。


安装


依赖项安装 Linux,使用 python3 和 git 安装


安装 psutil python 模块(可能需要 sudo)


# python3 -m pip install psutil
复制代码


依赖项安装 OSX,用于显示 CPU 温度。


# brew install osx-cpu-temp
复制代码


手动安装 Linux,OSX 和 FreeBSD


# git clone https://github.com/aristocratos/bpytop.git# cd bpytop# sudo make install
复制代码

命令行选项

USAGE: bpytop [argument]
Arguments: -m, --mini Start in minimal mode without memory and net boxes // 最小模式下启动 -v, --version Show version info and exit // 显示版本信息并退出 -h, --help Show this help message and exit // 显示此帮助信息并退出 --debug Start with loglevel set to DEBUG overriding value set in config
复制代码


由此看来目前 bpytop 还处于开发阶段,接下来,还有很多要去做新功能:



最后贴下该项目 GitHub 地址,大家感兴趣的可前去围观:


https://github.com/aristocratos/bpytop


原创不易,码字不易,如果你觉得这篇文章对你有点用的话,就请为本文留个言点个赞,或者转发一下吧,让更多的运维工程师看到。因为这将是我持续输出更多优质文章的最强动力!感谢大家!



关注微信公众号『杰哥的 IT 之旅』,后台回复“1024”查看更多内容,回复“微信”添加我微信。


发布于: 2020 年 08 月 10 日阅读数: 118
用户头像

JackTian

关注

公众号:杰哥的IT之旅 微信:Hc220088 2018.09.21 加入

一名奋斗在一线城市的 Linux 中级运维工程师。 擅长 Linux、运维、GitHub 等方向领域; 爱好写作,听歌,喜欢交朋友,走过路过的朋友,也可以通过我的签名添加我的微信,畅聊你我之间的故事。

评论

发布
暂无评论
一款基于 Python 语言的 Linux 资源监视器!