使用RPi-Monitor监控、统计Guitar的运行状态

2024-02-04 07:10

本文主要是介绍使用RPi-Monitor监控、统计Guitar的运行状态,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

前言

之前发在ickey社区上的一系列文章:

  1. 犹抱琵琶半遮面,无人知是荔枝来——unboxing & interview 一、二、三
  2. 葡萄美酒夜光杯,巧妇难为无米炊——资料与社区
  3. 一支穿云箭,板子要加散热片——系统监控与发热问题
  4. 念去去千里烟波,暮霭沉沉楚天阔——远程控制相关
  5. 竹喧归浣女,莲动小轻舟——延长板载eMMC寿命、优化性能

RPi-Monitor简介

前文 讲到如何通过一个shell脚本获取CPU状态和PMU温度,而RPi-Monitor基于perl,内置webserver,通过优化后对sd卡占用更少。由于其极强的可定制性与拓展性,你可以换用熟悉的Web Server,显示服务状态,甚至作为视频监控。最早是基于树莓派的项目,后来在XApple社区发现有人移植到蓮霧派,今天cnx-software也报道了,特此记录下来。之前都是使用的phpsysinfo

项目主页:http://rpi-experiences.blogspot.com/
Github主页: https://github.com/XavierBerger/RPi-Monitor

开始页面

67163219.jpg

统计页面

直接用cnx-software的图了

安装配置

添加rpimonitor源

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

安装升级RPi-Monitor

apt-get update && apt-get install rpimonitor && apt-get upgrade

停止服务添加自定义模块

systemctl stop rpimonitor
nano /etc/rpimonitor/template/S500_ATC2603.conf

输入以下内容:

########################################################################
# Extract S500/ATC2603 information
#  Page: 1
#  Information               Status     Statistics
#  - cpu frequency           - yes      - yes
#  - cpu load 1, 5, 15       - yes      - yes
#  - cpu scaling governor    - yes      - no
#  - power in voltage        - yes      - yes
#  - power in consumption    - yes      - yes
#  - USB OTG voltage         - yes      - yes
#  - USB OTG consumption     - yes      - yes
#  - battery consumption     - yes      - yes
#  - total consumption       - yes      - yes
#  - power in current        - yes      - yes
#  - USB OTG current         - yes      - yes
#  - soc temperature         - yes      - yes
#  - pmu temperature         - yes      - yes
########################################################################
dynamic.1.name=cpu_frequency
dynamic.1.source=/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
dynamic.1.regexp=(.*)
dynamic.1.postprocess=$1/1000
dynamic.1.rrd=GAUGEdynamic.2.name=load1,load5,load15
dynamic.2.source=/proc/loadavg
dynamic.2.regexp=^(\S+)\s(\S+)\s(\S+)
dynamic.2.postprocess=
dynamic.2.rrd=GAUGEdynamic.3.name=scaling_governor
dynamic.3.source=/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
dynamic.3.regexp=(.*)
dynamic.3.postprocess=
dynamic.3.rrd=dynamic.4.name=ac_voltage
dynamic.4.source=/sys/devices/b0170000.i2c/i2c-0/0-0065/atc2603c-hwmon.0/wall_voltage
dynamic.4.regexp=(.*)
dynamic.4.postprocess=sprintf("%.2f", $1/1000)
dynamic.4.rrd=GAUGEdynamic.5.name=ac_consumption
dynamic.5.source=/sys/devices/b0170000.i2c/i2c-0/0-0065/atc2603c-hwmon.0/wall_current
dynamic.5.regexp=(.*)
dynamic.5.postprocess=sprintf("%.2f", $1/153 * $this->{'dynamic'}->{'ac_voltage'})
dynamic.5.rrd=GAUGEdynamic.6.name=usb_voltage
dynamic.6.source=/sys/devices/b0170000.i2c/i2c-0/0-0065/atc2603c-hwmon.0/vbus_voltage
dynamic.6.regexp=(.*)
dynamic.6.postprocess=sprintf("%.2f", $1/1000)
dynamic.6.rrd=GAUGEdynamic.7.name=usb_consumption
dynamic.7.source=/sys/devices/b0170000.i2c/i2c-0/0-0065/atc2603c-hwmon.0/vbus_current
dynamic.7.regexp=(.*)
dynamic.7.postprocess=sprintf("%.2f", $1/1000 * $this->{'dynamic'}->{'usb_voltage'})
dynamic.7.rrd=GAUGEdynamic.8.name=battery_consumption
dynamic.8.source=/sys/devices/b0170000.i2c/i2c-0/0-0065/atc2603c-hwmon.0/bat_current
dynamic.8.regexp=(.*)
dynamic.8.postprocess=sprintf("%.2f", $1/1000)
dynamic.8.rrd=GAUGEdynamic.9.name=total_consumption
dynamic.9.source=/sys/devices/b0170000.i2c/i2c-0/0-0065/atc2603c-hwmon.0/bat_voltage
dynamic.9.regexp=(.*)
dynamic.9.postprocess=sprintf("%.2f", $1/1000 + $this->{'dynamic'}->{'ac_consumption'} + $this->{'dynamic'}->{'usb_consumption'})
dynamic.9.rrd=GAUGEdynamic.10.name=usb_current
dynamic.10.source=/sys/devices/b0170000.i2c/i2c-0/0-0065/atc2603c-hwmon.0/vbus_current
dynamic.10.regexp=(.*)
dynamic.10.postprocess=sprintf("%.2f", $1/1000)
dynamic.10.rrd=GAUGEdynamic.11.name=ac_current
dynamic.11.source=/sys/devices/b0170000.i2c/i2c-0/0-0065/atc2603c-hwmon.0/wall_current
dynamic.11.regexp=(.*)
dynamic.11.postprocess=sprintf("%.2f", $1/153)
dynamic.11.rrd=GAUGEdynamic.12.name=soc_temp
dynamic.12.source=/sys/devices/virtual/thermal/thermal_zone1/temp
dynamic.12.regexp=(.*)
dynamic.12.postprocess=sprintf("%.1f", $1/1000)
dynamic.12.rrd=GAUGEdynamic.13.name=pmu_temp
dynamic.13.source=/sys/devices/b0170000.i2c/i2c-0/0-0065/atc2603c-hwmon.0/ic_temperature
dynamic.13.regexp=(.*)
dynamic.13.postprocess=sprintf("%.1f", $1/1000)
dynamic.13.rrd=GAUGEweb.status.1.content.1.name=CPU
web.status.1.content.1.icon=cpu.png
web.status.1.content.1.line.1="Loads: <b>" + data.load1 + "</b> [1min] - <b>" + data.load5 + "</b> [5min] - <b>" + data.load15 + "</b> [15min]"
web.status.1.content.1.line.2="CPU frequency: <b>" + data.cpu_frequency + "MHz</b>  Governor: <b>" + data.scaling_governor + "</b>"web.status.1.content.2.name=PMU
web.status.1.content.2.icon=pmu.png
web.status.1.content.2.line.1="Total PMU Consumption: <b>" + data.total_consumption + " W</b>"
web.status.1.content.2.line.2="PWR in: <b>" + data.ac_consumption + " W</b> USB OTG in: <b>" + data.usb_consumption + " W</b> BATT in: <b>" + data.battery_consumption + " W</b>"web.status.1.content.3.name=Temperature
web.status.1.content.3.icon=cpu_temp.png
web.status.1.content.3.line.1=JustGageBar("SoC", "°C",0, data.soc_temp , 125,100,80,percentColors,70,85)+" "+JustGageBar("PMU", "°C",0, data.pmu_temp , 125,100,80,percentColors,70,85)web.statistics.1.content.1.name=Load / cpufreq / Consumption
web.statistics.1.content.1.graph.1=load1
web.statistics.1.content.1.graph.2=load5
web.statistics.1.content.1.graph.3=load15
web.statistics.1.content.1.graph.4=total_consumption
web.statistics.1.content.1.graph.5=cpu_frequency
web.statistics.1.content.1.ds_graph_options.load1.label=Load 1 min
web.statistics.1.content.1.ds_graph_options.load5.label=Load 5 min
web.statistics.1.content.1.ds_graph_options.load15.label=Load 15 min
web.statistics.1.content.1.ds_graph_options.total_consumption.label=Consumption (W)
web.statistics.1.content.1.ds_graph_options.cpu_frequency.label=Clock speed (MHz)
web.statistics.1.content.1.ds_graph_options.cpu_frequency.yaxis=2
web.statistics.1.content.1.graph_options.y2axis={ position: "right" }web.statistics.1.content.2.name=PMU current/voltage
web.statistics.1.content.2.graph.1=ac_voltage
web.statistics.1.content.2.graph.2=usb_voltage
web.statistics.1.content.2.graph.3=ac_current
web.statistics.1.content.2.graph.4=usb_current
web.statistics.1.content.2.graph.5=battery_consumption
web.statistics.1.content.2.ds_graph_options.ac_voltage.label=Voltage PWR in (V)
web.statistics.1.content.2.ds_graph_options.usb_voltage.label=Voltage USB OTG (V)
web.statistics.1.content.2.ds_graph_options.ac_current.label=Current PWR in (A)
web.statistics.1.content.2.ds_graph_options.usb_current.label=Current USB OTG (mA)
web.statistics.1.content.2.ds_graph_options.battery_consumption.label=Consumption Battery (W)
web.statistics.1.content.2.ds_graph_options.ac_voltage.yaxis=1
web.statistics.1.content.2.ds_graph_options.usb_voltage.yaxis=1
web.statistics.1.content.2.ds_graph_options.ac_current.yaxis=2
web.statistics.1.content.2.ds_graph_options.usb_current.yaxis=2
web.statistics.1.content.2.ds_graph_options.battery_consumption.yaxis=1
web.statistics.1.content.2.graph_options.y1axis={ position: "left", min: 1.5, max: 11 }
web.statistics.1.content.2.graph_options.y2axis={ position: "right" }web.statistics.1.content.3.name=Temperature / Consumption
web.statistics.1.content.3.graph.1=pmu_temp
web.statistics.1.content.3.graph.2=soc_temp
web.statistics.1.content.3.graph.3=total_consumption
web.statistics.1.content.3.ds_graph_options.pmu_temp.label=PMU temperature (°C)
web.statistics.1.content.3.ds_graph_options.soc_temp.label=SoC temperature (°C)
web.statistics.1.content.3.ds_graph_options.total_consumption.label=Consumption (W)
web.statistics.1.content.3.ds_graph_options.total_consumption.yaxis=2
web.statistics.1.content.3.graph_options.y1axis={ position: "left", min: 0, max: 125 }
web.statistics.1.content.3.graph_options.y2axis={ position: "right" }
nano /etc/rpimonitor/template/lemaker_guitar.conf

添加以下内容,创建主配置文件,根据自己需要启用|禁用模块:

web.page.icon='img/logo.png'
web.page.menutitle='RPi-Monitor  <sub>('+data.hostname+')</sub>'
web.page.pagetitle='RPi-Monitor ('+data.hostname+')'web.status.1.name=lemaker_guitar
web.statistics.1.name=lemaker_guitarinclude=/etc/rpimonitor/template/version.conf
include=/etc/rpimonitor/template/uptime.conf
include=/etc/rpimonitor/template/S500_ATC2603.conf
include=/etc/rpimonitor/template/memory.conf
include=/etc/rpimonitor/template/swap.conf
include=/etc/rpimonitor/template/sdcard.conf
include=/etc/rpimonitor/template/network.conf
include=/etc/rpimonitor/template/wlan.conf

创建软链接:

ln -sf /etc/rpimonitor/template/lemaker_guitar.conf /etc/rpimonitor/data.conf

重启rpimonitor服务

systemctl start rpimonitor

访问网页前端

假如Guitar的IP为192.168.1.111,那么在浏览器里输入192.168.1.111:8888 即可打开状态页面。经过配置可以远程访问Guitar之后,无论身处何地都可以及时监控Guitar的运行状态。
软件使用GPL3 协议,所以可以对界面进行一些改造。

自定义功能与添加模块

使用配置文件生成助手

2.6版本之后引入了一个新工具:RPi-Monitor交互式配置文件生成助手 (RPi-Monitor Interactive Configuration Helper),通过运行

rpimonitord -i

可以非常方便地创建自己的监视点。Via

添加传感器数据

以DHT温湿度传感器为例,可以监视温湿度变化,绘制折线图,修改之后可以显示诸多传感器数值。Via
官网截图

使用标签显示状态

2.7版本之后引入标签显示服务状态的功能,支持6种颜色:
61139011.jpg
效果如图所示:
89729018.jpg
根据模板修改/etc/rpimonitor/template/services.conf文件即可。稍加改造可以实现更多功能。
注意:最新2.10版/etc/rpimonitor/template/services.conf文件最后一行少一个")",需要自己补上。
nano中可通过Ctrl+E快速跳至行尾。Via

进阶用法

其他进阶用法及自定义功能。Via

其他模板

  • 全志A10/A13/A20
  • 全志H3
  • A64 (Pine64)
  • A83T/H8 (Banana Pi M3, Cubietruck +)
    via

    总结

转载于:https://www.cnblogs.com/sjqlwy/p/guitar_monitor.html

这篇关于使用RPi-Monitor监控、统计Guitar的运行状态的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/676706

相关文章

Java Spring 中 @PostConstruct 注解使用原理及常见场景

《JavaSpring中@PostConstruct注解使用原理及常见场景》在JavaSpring中,@PostConstruct注解是一个非常实用的功能,它允许开发者在Spring容器完全初... 目录一、@PostConstruct 注解概述二、@PostConstruct 注解的基本使用2.1 基本代

C#使用StackExchange.Redis实现分布式锁的两种方式介绍

《C#使用StackExchange.Redis实现分布式锁的两种方式介绍》分布式锁在集群的架构中发挥着重要的作用,:本文主要介绍C#使用StackExchange.Redis实现分布式锁的... 目录自定义分布式锁获取锁释放锁自动续期StackExchange.Redis分布式锁获取锁释放锁自动续期分布式

springboot使用Scheduling实现动态增删启停定时任务教程

《springboot使用Scheduling实现动态增删启停定时任务教程》:本文主要介绍springboot使用Scheduling实现动态增删启停定时任务教程,具有很好的参考价值,希望对大家有... 目录1、配置定时任务需要的线程池2、创建ScheduledFuture的包装类3、注册定时任务,增加、删

使用Python实现矢量路径的压缩、解压与可视化

《使用Python实现矢量路径的压缩、解压与可视化》在图形设计和Web开发中,矢量路径数据的高效存储与传输至关重要,本文将通过一个Python示例,展示如何将复杂的矢量路径命令序列压缩为JSON格式,... 目录引言核心功能概述1. 路径命令解析2. 路径数据压缩3. 路径数据解压4. 可视化代码实现详解1

Pandas透视表(Pivot Table)的具体使用

《Pandas透视表(PivotTable)的具体使用》透视表用于在数据分析和处理过程中进行数据重塑和汇总,本文就来介绍一下Pandas透视表(PivotTable)的具体使用,感兴趣的可以了解一下... 目录前言什么是透视表?使用步骤1. 引入必要的库2. 读取数据3. 创建透视表4. 查看透视表总结前言

Python 交互式可视化的利器Bokeh的使用

《Python交互式可视化的利器Bokeh的使用》Bokeh是一个专注于Web端交互式数据可视化的Python库,本文主要介绍了Python交互式可视化的利器Bokeh的使用,具有一定的参考价值,感... 目录1. Bokeh 简介1.1 为什么选择 Bokeh1.2 安装与环境配置2. Bokeh 基础2

Android使用ImageView.ScaleType实现图片的缩放与裁剪功能

《Android使用ImageView.ScaleType实现图片的缩放与裁剪功能》ImageView是最常用的控件之一,它用于展示各种类型的图片,为了能够根据需求调整图片的显示效果,Android提... 目录什么是 ImageView.ScaleType?FIT_XYFIT_STARTFIT_CENTE

Java学习手册之Filter和Listener使用方法

《Java学习手册之Filter和Listener使用方法》:本文主要介绍Java学习手册之Filter和Listener使用方法的相关资料,Filter是一种拦截器,可以在请求到达Servl... 目录一、Filter(过滤器)1. Filter 的工作原理2. Filter 的配置与使用二、Listen

Pandas使用AdaBoost进行分类的实现

《Pandas使用AdaBoost进行分类的实现》Pandas和AdaBoost分类算法,可以高效地进行数据预处理和分类任务,本文主要介绍了Pandas使用AdaBoost进行分类的实现,具有一定的参... 目录什么是 AdaBoost?使用 AdaBoost 的步骤安装必要的库步骤一:数据准备步骤二:模型

Pandas统计每行数据中的空值的方法示例

《Pandas统计每行数据中的空值的方法示例》处理缺失数据(NaN值)是一个非常常见的问题,本文主要介绍了Pandas统计每行数据中的空值的方法示例,具有一定的参考价值,感兴趣的可以了解一下... 目录什么是空值?为什么要统计空值?准备工作创建示例数据统计每行空值数量进一步分析www.chinasem.cn处