惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
Attack and Defense Labs
Attack and Defense Labs
GbyAI
GbyAI
月光博客
月光博客
Recent Announcements
Recent Announcements
云风的 BLOG
云风的 BLOG
F
Full Disclosure
宝玉的分享
宝玉的分享
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
爱范儿
爱范儿
博客园 - Franky
V
V2EX
Recorded Future
Recorded Future
WordPress大学
WordPress大学
小众软件
小众软件
Webroot Blog
Webroot Blog
雷峰网
雷峰网
Vercel News
Vercel News
N
News and Events Feed by Topic
PCI Perspectives
PCI Perspectives
Cyberwarzone
Cyberwarzone
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
W
WeLiveSecurity
S
Schneier on Security
博客园 - 三生石上(FineUI控件)
K
Kaspersky official blog
F
Fortinet All Blogs
Security Archives - TechRepublic
Security Archives - TechRepublic
Spread Privacy
Spread Privacy
博客园 - 叶小钗
罗磊的独立博客
D
Docker
Forbes - Security
Forbes - Security
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
The Register - Security
The Register - Security
A
About on SuperTechFans
B
Blog RSS Feed
I
InfoQ
T
Tailwind CSS Blog
G
Google Developers Blog
H
Help Net Security
V
Vulnerabilities – Threatpost
AWS News Blog
AWS News Blog
N
News and Events Feed by Topic
M
MIT News - Artificial intelligence
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
P
Proofpoint News Feed
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
MyScale Blog
MyScale Blog
Latest news
Latest news

闲余悟道

Window 安装 Llama.cpp Docker 镜像迁移命令 星露谷物语 Mod 安装 局域网共享文件小工具 FastSend Perplexica 个人 AI 搭建 使用 Pyenv-Win 管理 Python 版本 用winget 优雅地给 Window 安装软件 RTL8126 5G网卡驱动安装 搭建webdav并挂载为本地磁盘 免费的docker镜像代理搭建 Win11 Node.js 版本管理 Vite项目打包为apk包 安装dae代理 加固服务器SSH端口的一些方法 搭建AdGuard Home去掉恼人的广告 三星手机刷机教程 使用 Cloudflare 搭建 Docker 代理 手机上安装mysql数据库 树莓派与本地ollama联动实现私人AI助理 丢香蕉 雨声 意界 AI聚合软体 LobeHub 搭建 树莓派安装 Sanpdrop 传输文件 用 Conda 为 Comfyui 安装虚拟环境 自建无监管聊天服务器——tinode ShareX截图为 Webp 格式,节省网站流量 ComfyUI 必备插件 Linux 安装 Fooocus与 ComfyUI Namesilo域名购买及转入cloudflare Stable Diffusion Webui 浅玩 Stable Diffusion Webui 安装 秝玖玟忻 酒鬼 旧书 调头 二手 归属 锻炼 晨跑 大雁 贝壳 推波助澜 孤立 厕所 十轮车 共享小工具picoshare 遇事后 Linux版阿里云盘 Obsidian效率流常用插件 人场 自建rtmp服务器 24小时直播推流 树莓派关于IP6的毛病 关于冰箱的那些破事 读书与内在 云文档showdoc搭建 Docker介绍及使用 云编辑器——在线Vscode搭建 自建必应AI,轻松用上GPT4 晚风与广场 短视频脚本学习 树莓派NVME拓展 打劫 Webssh搭建 搭建属于自己的音乐播放器——Navidrome 他的第一次 百度网盘docker版搭建 网海乾坤袋——Huntly搭建 兄弟寄语 死后记忆如何处理 树莓派4B硬盘折腾 尊重 自托管知识库memos搭建 Stable Diffusion 云端使用 个人网盘新秀Alist搭建 Claude AI使用 关于国外书籍的思考 洗衣 护肤 创意写作 Markdown常用命令 Openwrt再编译及一些问题 OpenWrt插件与主题安装 Docker化openwrt固件 个人博客美化(五) Docker编译openwrt固件 Win11 终端美化——Oh My Posh Oh My Zsh 为终端换肤 树莓派搭建openwrt Caddy 搭配cloudflare 暗网进入Zlibrary FRP内网穿透搭建 骨科知识 Vps选购 井底之蛙 烧烤异象 论理发这事 《代价》 一只蛤蟆的逃亡
Rpi Monitor树莓派状态监控
freecrazy · 2021-12-08 · via 闲余悟道

树莓派温度、内存、cpu、硬盘监控

一、前因

每次连接树莓派都不自觉地输入 htop 查看用了多少内存,df -h 查看用了多少空间,今天想着或许可以找款工具,替代下我这下意识的举动,搜寻一番,原来早已有一款专门为树莓派设计的工具了。

用了一下,还挺强大,使用说明在这:https://xavierberger.github.io/RPi-Monitor-docs/10_index.html

二、安装

这次就不用docker-compose安装了,挂载一大堆路径,远没有直接安装来的快。

官网的安装步骤太古老了,而且有些还没反应(你懂的),下面是改造的安装办法,只是换了条路而已,本质还是一样的。

添加rpimonitor源

apt install apt-transport-https ca-certificates dirmngr
apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 2C0D3C0F
wget https://raw.githubusercontent.com/XavierBerger/RPi-Monitor/master/src/etc/apt/sources.list.d/rpimonitor.list -O /etc/apt/sources.list.d/rpimonitor.list

安装并升级RPi-Monitor

apt update && apt install rpimonitor && apt upgrade -y

添加源如果出现下面错误

进入这里:https://www.ipaddress.com 解析 raw.githubusercontent.com 的IP。

我这里解析出来四个,全部添加入hosts就行。

运行下面代码,添加hosts。

sed -i '$a185.199.108.133 raw.githubusercontent.com' /etc/hosts
sed -i '$a185.199.109.133 raw.githubusercontent.com' /etc/hosts
sed -i '$a185.199.110.133 raw.githubusercontent.com' /etc/hosts
sed -i '$a185.199.111.133 raw.githubusercontent.com' /etc/hosts

输入树莓派IP+8888就可以进入页面,它长这样。

有红色警告,我们去升级一下。

sudo /etc/init.d/rpimonitor update

三、优化

我们看到外接的硬盘没在里面,而且网络监控也没有配置,rpimonitor共有三处配置地点,位置在 /etc/rpimonitor ,如下图:

daemon.conf : 配置网页端口,日志等 data.conf : 总配置文件 template : 模板文件,里面预置了许多配置文件,我们只需要进去放开注释,修改成自己的即可

我这里只做了network 与 storage 的修改,其他的目前用不到,像摄像头、打印机等的。

编辑 data.conf 文件

vi /etc/rpimonitor/data.conf

去掉最下面相应的注释。

编辑对应的文件,下面是我的。

network.conf,只是放开的注释。

########################################################################
# Extract Network information
#  Page: 1
#  Information               Status     Statistics
#  - recieved                - yes      - yes
#  - send                    - yes      - yes
#
# Note: Replace 'eth0' in the configuration bellow by the name of your
#       network interface and uncomment the line according to your needs
########################################################################

dynamic.10.name=net_received
dynamic.10.source=/sys/class/net/eth0/statistics/rx_bytes
dynamic.10.regexp=(.*)
dynamic.10.postprocess=$1*-1
dynamic.10.rrd=DERIVE
dynamic.10.max=0

dynamic.11.name=net_send
dynamic.11.source=/sys/class/net/eth0/statistics/tx_bytes
dynamic.11.regexp=(.*)
dynamic.11.postprocess=
dynamic.11.rrd=DERIVE
dynamic.11.min=0

web.status.1.content.8.name=Network
web.status.1.content.8.icon=network.png
#web.status.1.content.8.line.1="To activate network monitoring, edit and customize <font color='#AA0000'><b>network.conf</b></font>"
#web.status.1.content.8.line.2="Help is available in man pages:"
#web.status.1.content.8.line.3="<font color='#AA0000'><b>man rpimonitord</b></font> or <font color='#AA0000'><b>man rpimonitord.conf</b></font>"
web.status.1.content.8.line.1="Ethernet Sent: <b>"+KMG(data.net_send)+"<i class='icon-arrow-up'></i></b> Received: <b>"+KMG(Math.abs(data.net_received)) + "<i class='icon-arrow-down'></i></b>"

web.statistics.1.content.2.name=Network
web.statistics.1.content.2.graph.1=net_send
web.statistics.1.content.2.graph.2=net_received
web.statistics.1.content.2.graph_options.yaxis={ tickFormatter: function (v) { if (Math.abs(v) > 1048576) return (Math.round(v*10/1024/1024)/10) + " MiB/s" ; if (Math.abs(v) > 1024) return (Math.round(v*10/1024)/10) + " KiB/s" ; else return v + " B/s" }, }
web.statistics.1.content.2.ds_graph_options.net_send.label=Upload bandwidth (bytes)
web.statistics.1.content.2.ds_graph_options.net_send.lines={ fill: true }
web.statistics.1.content.2.ds_graph_options.net_send.color="#FF7777"
web.statistics.1.content.2.ds_graph_options.net_received.label=Download bandwidth (bytes)
web.statistics.1.content.2.ds_graph_options.net_received.lines={ fill: true }
web.statistics.1.content.2.7ds_graph_options.net_received.color="#77FF77"

storage.conf,注意你的硬盘格式ext4,还有盘符 sda1

########################################################################
# Extract Storage (1-sda1, 2-sda3) information
#  Page: 1
#  Information               Status     Statistics
#  - storage1 total          - yes      - yes
#  - storage1 used           - yes      - yes
#  - storage2 total          - yes      - yes
#  - storage2 used           - yes      - yes
########################################################################
static.10.name=storage1_total
static.10.source=df -t ext4
static.10.regexp=sda1\s+(\d+)
static.10.postprocess=$1/1024

#static.11.name=storage2_total
#static.11.source=df -t ext4
#static.11.regexp=sda3\s+(\d+)
#static.11.postprocess=$1/1024

dynamic.14.name=storage1_used
dynamic.14.source=df -t ext4
dynamic.14.regexp=sda1\s+\d+\s+(\d+)
dynamic.14.postprocess=$1/1024
dynamic.14.rrd=GAUGE

#dynamic.15.name=storage2_used
#dynamic.15.source=df -t ext4
#dynamic.15.regexp=sda3\s+\d+\s+(\d+)
#dynamic.15.postprocess=$1/1024
#dynamic.15.rrd=GAUGE

web.status.1.content.9.name=Storage
web.status.1.content.9.icon=usb_hdd.png
web.status.1.content.9.line.1="<b>/storage1</b> Used: <b>"+KMG(data.storage1_used,'M')+"</b> (<b>"+Percent(data.storage1_used,data.storage1_total,'M')+"</b>) Free: <b>"+KMG(data.storage1_total-data.storage1_used,'M')+ "</b> Total: <b>"+ KMG(data.storage1_total,'M') +"</b>"
web.status.1.content.9.line.2=ProgressBar(data.storage1_used,data.storage1_total)
#web.status.1.content.9.line.3="<b>/storage2</b> Used: <b>"+KMG(data.storage2_used,'M')+"</b> (<b>"+Percent(data.storage2_used,data.storage2_total,'M')+"</b>) Free: <b>"+KMG(data.storage2_total-data.storage2_used,'M')+ "</b> Total: <b>"+ KMG(data.storage2_total,'M') +"</b>"
#web.status.1.content.9.line.4=ProgressBar(data.storage2_used,data.storage2_total)

web.statistics.1.content.9.name=Storage1
web.statistics.1.content.9.graph.1=storage1_total
web.statistics.1.content.9.graph.2=storage1_used
web.statistics.1.content.9.ds_graph_options.storage1_total.label=Storage1 total space (MB)
web.statistics.1.content.9.ds_graph_options.storage1_total.color="#FF7777"
web.statistics.1.content.9.ds_graph_options.storage1_used.label=Storage1 used space (MB)
web.statistics.1.content.9.ds_graph_options.storage1_used.lines={ fill: true }
web.statistics.1.content.9.ds_graph_options.storage1_used.color="#7777FF"

#web.statistics.1.content.10.name=Storage2
#web.statistics.1.content.10.graph.1=storage2_total
#web.statistics.1.content.10.graph.2=storage2_used
#web.statistics.1.content.10.ds_graph_options.storage2_total.label=Storage2 total space (MB)
#web.statistics.1.content.10.ds_graph_options.storage2_total.color="#FF7777"
#web.statistics.1.content.10.ds_graph_options.storage2_used.label=Storage2 used space (MB)
#web.statistics.1.content.10.ds_graph_options.storage2_used.lines={ fill: true }
#web.statistics.1.content.10.ds_graph_options.storage2_used.color="#7777FF"

最后重启下服务

systemctl restart rpimonitor.service

最后效果如下:

四、总结

没啥总结的,链接到你的Heimdall里面,用起来吧。

收工!

癫狂乐天,狂放不羁,叛世逆俗,天纯不可一世。

跑酷

游戏玩腻,自个寻的,只喜纯跑,不喜炫技

滑板

身处异乡,未找到跑酷伙伴,转投滑板,oli练到死

骑行

通勤会的,通着通着成了爱好,不攀里数,不懂车构,菜腿一枚

爬山

老妈生错了生肖,喜欢在台阶或石头上蹦跶

设计

大学学的,PS效率实用流

代码

培训得的,已弃坑,得益于此,软件玩得起飞,如本博客内容

剪辑

无聊学的,人生苦短,想学的太多,学会罢了,我应该会了了吧……

写作

读书多了自然而然就……he,tui,人人都会,正在精进中

独自环过岛

海南岛,9天骑行,一人一包一帐篷,事故故事一堆堆

只身入过藏

心之所向,21点的太阳妙不可言

万里路

不少,如……

万卷书

微多,如……


人生苦短,繁华三千,可纵情声色,亦可摇桨泛舟。

碎年流光,若都平淡如水,岂非虚度一遭。

波澜不惊的一生虽不可恨,但数载光阴就历尽沧桑的生活应该更畅快。

别试图在文章末尾评论处留言,那只是摆设,不过若是打赏,我定会收到心意。联系方式本页社交链接中有猫腻。

心若冰清,天塌不惊。

万变犹定,神怡气静。

尘垢不沾,俗相不染。

虚空甯宓,浑然无物。

无有相生,难易相成。

份与物忘,同乎混涅。

天地无涯,万物齐一。

飞花落叶,虚怀若谷。

千般烦忧,才下心头。

即展眉头,灵台清幽。

心无挂碍,意无所执。

解心释神,莫然无魂。

水流心不惊,云在意俱迟。

一心不赘物,古今自逍遥。

自由转载-非商用-转载注明出处即可。