前言

之前发在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

开始页面

统计页面

安装配置

添加rpimonitor源

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

安装升级RPi-Monitor

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

停止服务添加自定义模块

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

输入以下内容:

  1. ########################################################################
  2. # Extract S500/ATC2603 information
  3. # Page: 1
  4. # Information Status Statistics
  5. # - cpu frequency - yes - yes
  6. # - cpu load 1, 5, 15 - yes - yes
  7. # - cpu scaling governor - yes - no
  8. # - power in voltage - yes - yes
  9. # - power in consumption - yes - yes
  10. # - USB OTG voltage - yes - yes
  11. # - USB OTG consumption - yes - yes
  12. # - battery consumption - yes - yes
  13. # - total consumption - yes - yes
  14. # - power in current - yes - yes
  15. # - USB OTG current - yes - yes
  16. # - soc temperature - yes - yes
  17. # - pmu temperature - yes - yes
  18. ########################################################################
  19. dynamic.1.name=cpu_frequency
  20. dynamic.1.source=/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
  21. dynamic.1.regexp=(.*)
  22. dynamic.1.postprocess=$1/1000
  23. dynamic.1.rrd=GAUGE
  24. dynamic.2.name=load1,load5,load15
  25. dynamic.2.source=/proc/loadavg
  26. dynamic.2.regexp=^(\S+)\s(\S+)\s(\S+)
  27. dynamic.2.postprocess=
  28. dynamic.2.rrd=GAUGE
  29. dynamic.3.name=scaling_governor
  30. dynamic.3.source=/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
  31. dynamic.3.regexp=(.*)
  32. dynamic.3.postprocess=
  33. dynamic.3.rrd=
  34. dynamic.4.name=ac_voltage
  35. dynamic.4.source=/sys/devices/b0170000.i2c/i2c-0/0-0065/atc2603c-hwmon.0/wall_voltage
  36. dynamic.4.regexp=(.*)
  37. dynamic.4.postprocess=sprintf("%.2f", $1/1000)
  38. dynamic.4.rrd=GAUGE
  39. dynamic.5.name=ac_consumption
  40. dynamic.5.source=/sys/devices/b0170000.i2c/i2c-0/0-0065/atc2603c-hwmon.0/wall_current
  41. dynamic.5.regexp=(.*)
  42. dynamic.5.postprocess=sprintf("%.2f", $1/153 * $this->{'dynamic'}->{'ac_voltage'})
  43. dynamic.5.rrd=GAUGE
  44. dynamic.6.name=usb_voltage
  45. dynamic.6.source=/sys/devices/b0170000.i2c/i2c-0/0-0065/atc2603c-hwmon.0/vbus_voltage
  46. dynamic.6.regexp=(.*)
  47. dynamic.6.postprocess=sprintf("%.2f", $1/1000)
  48. dynamic.6.rrd=GAUGE
  49. dynamic.7.name=usb_consumption
  50. dynamic.7.source=/sys/devices/b0170000.i2c/i2c-0/0-0065/atc2603c-hwmon.0/vbus_current
  51. dynamic.7.regexp=(.*)
  52. dynamic.7.postprocess=sprintf("%.2f", $1/1000 * $this->{'dynamic'}->{'usb_voltage'})
  53. dynamic.7.rrd=GAUGE
  54. dynamic.8.name=battery_consumption
  55. dynamic.8.source=/sys/devices/b0170000.i2c/i2c-0/0-0065/atc2603c-hwmon.0/bat_current
  56. dynamic.8.regexp=(.*)
  57. dynamic.8.postprocess=sprintf("%.2f", $1/1000)
  58. dynamic.8.rrd=GAUGE
  59. dynamic.9.name=total_consumption
  60. dynamic.9.source=/sys/devices/b0170000.i2c/i2c-0/0-0065/atc2603c-hwmon.0/bat_voltage
  61. dynamic.9.regexp=(.*)
  62. dynamic.9.postprocess=sprintf("%.2f", $1/1000 + $this->{'dynamic'}->{'ac_consumption'} + $this->{'dynamic'}->{'usb_consumption'})
  63. dynamic.9.rrd=GAUGE
  64. dynamic.10.name=usb_current
  65. dynamic.10.source=/sys/devices/b0170000.i2c/i2c-0/0-0065/atc2603c-hwmon.0/vbus_current
  66. dynamic.10.regexp=(.*)
  67. dynamic.10.postprocess=sprintf("%.2f", $1/1000)
  68. dynamic.10.rrd=GAUGE
  69. dynamic.11.name=ac_current
  70. dynamic.11.source=/sys/devices/b0170000.i2c/i2c-0/0-0065/atc2603c-hwmon.0/wall_current
  71. dynamic.11.regexp=(.*)
  72. dynamic.11.postprocess=sprintf("%.2f", $1/153)
  73. dynamic.11.rrd=GAUGE
  74. dynamic.12.name=soc_temp
  75. dynamic.12.source=/sys/devices/virtual/thermal/thermal_zone1/temp
  76. dynamic.12.regexp=(.*)
  77. dynamic.12.postprocess=sprintf("%.1f", $1/1000)
  78. dynamic.12.rrd=GAUGE
  79. dynamic.13.name=pmu_temp
  80. dynamic.13.source=/sys/devices/b0170000.i2c/i2c-0/0-0065/atc2603c-hwmon.0/ic_temperature
  81. dynamic.13.regexp=(.*)
  82. dynamic.13.postprocess=sprintf("%.1f", $1/1000)
  83. dynamic.13.rrd=GAUGE
  84. web.status.1.content.1.name=CPU
  85. web.status.1.content.1.icon=cpu.png
  86. web.status.1.content.1.line.1="Loads: <b>" + data.load1 + "</b> [1min] - <b>" + data.load5 + "</b> [5min] - <b>" + data.load15 + "</b> [15min]"
  87. web.status.1.content.1.line.2="CPU frequency: <b>" + data.cpu_frequency + "MHz</b> Governor: <b>" + data.scaling_governor + "</b>"
  88. web.status.1.content.2.name=PMU
  89. web.status.1.content.2.icon=pmu.png
  90. web.status.1.content.2.line.1="Total PMU Consumption: <b>" + data.total_consumption + " W</b>"
  91. 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>"
  92. web.status.1.content.3.name=Temperature
  93. web.status.1.content.3.icon=cpu_temp.png
  94. 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)
  95. web.statistics.1.content.1.name=Load / cpufreq / Consumption
  96. web.statistics.1.content.1.graph.1=load1
  97. web.statistics.1.content.1.graph.2=load5
  98. web.statistics.1.content.1.graph.3=load15
  99. web.statistics.1.content.1.graph.4=total_consumption
  100. web.statistics.1.content.1.graph.5=cpu_frequency
  101. web.statistics.1.content.1.ds_graph_options.load1.label=Load 1 min
  102. web.statistics.1.content.1.ds_graph_options.load5.label=Load 5 min
  103. web.statistics.1.content.1.ds_graph_options.load15.label=Load 15 min
  104. web.statistics.1.content.1.ds_graph_options.total_consumption.label=Consumption (W)
  105. web.statistics.1.content.1.ds_graph_options.cpu_frequency.label=Clock speed (MHz)
  106. web.statistics.1.content.1.ds_graph_options.cpu_frequency.yaxis=2
  107. web.statistics.1.content.1.graph_options.y2axis={ position: "right" }
  108. web.statistics.1.content.2.name=PMU current/voltage
  109. web.statistics.1.content.2.graph.1=ac_voltage
  110. web.statistics.1.content.2.graph.2=usb_voltage
  111. web.statistics.1.content.2.graph.3=ac_current
  112. web.statistics.1.content.2.graph.4=usb_current
  113. web.statistics.1.content.2.graph.5=battery_consumption
  114. web.statistics.1.content.2.ds_graph_options.ac_voltage.label=Voltage PWR in (V)
  115. web.statistics.1.content.2.ds_graph_options.usb_voltage.label=Voltage USB OTG (V)
  116. web.statistics.1.content.2.ds_graph_options.ac_current.label=Current PWR in (A)
  117. web.statistics.1.content.2.ds_graph_options.usb_current.label=Current USB OTG (mA)
  118. web.statistics.1.content.2.ds_graph_options.battery_consumption.label=Consumption Battery (W)
  119. web.statistics.1.content.2.ds_graph_options.ac_voltage.yaxis=1
  120. web.statistics.1.content.2.ds_graph_options.usb_voltage.yaxis=1
  121. web.statistics.1.content.2.ds_graph_options.ac_current.yaxis=2
  122. web.statistics.1.content.2.ds_graph_options.usb_current.yaxis=2
  123. web.statistics.1.content.2.ds_graph_options.battery_consumption.yaxis=1
  124. web.statistics.1.content.2.graph_options.y1axis={ position: "left", min: 1.5, max: 11 }
  125. web.statistics.1.content.2.graph_options.y2axis={ position: "right" }
  126. web.statistics.1.content.3.name=Temperature / Consumption
  127. web.statistics.1.content.3.graph.1=pmu_temp
  128. web.statistics.1.content.3.graph.2=soc_temp
  129. web.statistics.1.content.3.graph.3=total_consumption
  130. web.statistics.1.content.3.ds_graph_options.pmu_temp.label=PMU temperature C)
  131. web.statistics.1.content.3.ds_graph_options.soc_temp.label=SoC temperature C)
  132. web.statistics.1.content.3.ds_graph_options.total_consumption.label=Consumption (W)
  133. web.statistics.1.content.3.ds_graph_options.total_consumption.yaxis=2
  134. web.statistics.1.content.3.graph_options.y1axis={ position: "left", min: 0, max: 125 }
  135. web.statistics.1.content.3.graph_options.y2axis={ position: "right" }
  1. nano /etc/rpimonitor/template/lemaker_guitar.conf

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

  1. web.page.icon='img/logo.png'
  2. web.page.menutitle='RPi-Monitor <sub>('+data.hostname+')</sub>'
  3. web.page.pagetitle='RPi-Monitor ('+data.hostname+')'
  4. web.status.1.name=lemaker_guitar
  5. web.statistics.1.name=lemaker_guitar
  6. include=/etc/rpimonitor/template/version.conf
  7. include=/etc/rpimonitor/template/uptime.conf
  8. include=/etc/rpimonitor/template/S500_ATC2603.conf
  9. include=/etc/rpimonitor/template/memory.conf
  10. include=/etc/rpimonitor/template/swap.conf
  11. include=/etc/rpimonitor/template/sdcard.conf
  12. include=/etc/rpimonitor/template/network.conf
  13. include=/etc/rpimonitor/template/wlan.conf

创建软链接:

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

重启rpimonitor服务

  1. 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),通过运行

  1. rpimonitord -i

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

添加传感器数据

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

使用标签显示状态

2.7版本之后引入标签显示服务状态的功能,支持6种颜色:



效果如图所示:



根据模板修改/etc/rpimonitor/template/services.conf文件即可。稍加改造可以实现更多功能。

注意:最新2.10版/etc/rpimonitor/template/services.conf文件最后一行少一个")",需要自己补上。

nano中可通过Ctrl+E快速跳至行尾。Via

进阶用法

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

其他模板

总结

使用RPi-Monitor监控、统计Guitar的运行状态的更多相关文章

  1. Druid Monitor监控Java Web和Java SE项目

    Druid Monitor 对于数据源,大家已经接触了不少了.比如c3p0.dhcp.proxool等,之后又发现使用tomcat-jdbc可以大大的提高性能.但是针对于我们的高并发的系统来说,总希望 ...

  2. 运用Real Spy Monitor监控网络

    Real Spy Monitor是一个监测互联网和个人电脑,以保障其安全的软件.包括键盘敲击.网页站点.视窗开关.程序执行.屏幕扫描以及文件的出入等都是其监控的对象. 1.添加使用密码 在使用Real ...

  3. Springboot项目配置druid数据库连接池,并监控统计功能

    pom.xml配置依赖 <!-- https://mvnrepository.com/artifact/com.alibaba/druid --> <dependency> & ...

  4. Jmeter性能测试之Monitor监控(SSHMon Samples Collector)

    前面写的一篇Monitor监控有缺陷, 这篇文章使用Jmeter4.0+的版本, 使用插件SSHMon Samples Collector来做资源监控 1. 官网下载插件: plugins-manag ...

  5. 数据库阿里连接池 Druid配置详解以及web监控统计

    java程序很大一部分要操作数据库,为了提高性能操作数据库的时候,有不得不使用数据库连接池.数据库连接池有很多选择,c3p.dhcp.proxool等,druid作为一名后起之秀,凭借其出色的性能,也 ...

  6. JUC - Monitor监控ThreadPoolExecutor

    JUC - Monitor监控ThreadPoolExecutor 一个自定义Monitor监控ThreadPoolExecutor的执行情况 TASK WokerTask class WorkerT ...

  7. Process Monitor监控进程操作注册表如何实现?

    http://zhidao.baidu.com/link?url=Kqav4qkQSprC5FnpHPOGJvhqvY9fJ9-Vdx9g_SWh4w5VOusdRJo4Vl7qIdrG4LwRJvr ...

  8. 基于.NetCore开发博客项目 StarBlog - (16) 一些新功能 (监控/统计/配置/初始化)

    系列文章 基于.NetCore开发博客项目 StarBlog - (1) 为什么需要自己写一个博客? 基于.NetCore开发博客项目 StarBlog - (2) 环境准备和创建项目 基于.NetC ...

  9. 字节跳动 DanceCC 工具链系列之Xcode LLDB耗时监控统计方案

    作者:李卓立 仲凯宁 背景介绍 在<字节跳动 DanceCC 工具链系列之Swift 调试性能的优化方案>[1]一文中,我们介绍了如何使用自定义的工具链,来针对性优化调试器的性能,解决大型 ...

随机推荐

  1. 【STL初步】不定长数组:vector + 集合:set + 映射:map

    一.vector 为了节省空间,有时我们会使用动态数组vector. 定义动态数组 vector<类型名>变量名 vector<int>que //定义que为一个int类型的 ...

  2. http协议工作原理(转)

     WWW是以Internet作为传输媒介的一个应用系统,WWW网上最基本的传输单位是Web网页.WWW的工作基于客户机/服务器计算模型,由Web 浏览器(客户机)和Web服务器(服务器)构成,两者之间 ...

  3. 服务不支持 chkconfig 的解决方法

    “服务不支持 chkconfig”: 请注意检查脚本的前面,是否有完整的两行:#chkconfig: 2345 80 90    #description:auto_run 在脚本前面这两行是不能少的 ...

  4. Python 前端 Html基础

    概述 HTML是英文Hyper Text Mark-up Language(超文本标记语言)的缩写,他是一种制作万维网页的标准语言.相当于定义统一 的规则.大家都来遵守它,这样就可以让浏览器根据标记语 ...

  5. loj2143 「SHOI2017」组合数问题

    大傻逼题--就是求 \(nk\) 个元素选出一些元素,选出的元素的个数要满足模 \(k\) 余 \(r\),求方案数. 想到 \(\binom{n}{m}=\binom{n-1}{m-1}+\bino ...

  6. rocketmq 问题

    1. 收不到消息-consumerOffset.json 信息错位 这种情况一般是,手动删除了store/commitlog目录里的数据等非常规手段造成了consumerOffset.json中记录的 ...

  7. python 多线程、多进程、协程性能对比(以爬虫为例)

    基本配置:阿里云服务器低配,单核2G内存 首先是看协程的效果: import requests import lxml.html as HTML import sys import time impo ...

  8. LINUX远程强制重启/proc/sys/kernel/sysrq /proc/sysrq-trigger

    1.     # echo 1 > /proc/sys/kernel/sysrq 2.     # echo b > /proc/sysrq-trigger 1. /proc/sys/ke ...

  9. Redis常见配置redis.conf

    redis的配置文件.相信学过SSH或SSM的读者都知道,配置文件的使用在当下开发已十分普遍,希望大家要熟悉习惯这 种开发方式,废话不多说,来开始我们今天的内容吧. 首先得找到 redis 的配置文件 ...

  10. bzoj 4401 块的计数 思想+模拟+贪心

    块的计数 Time Limit: 10 Sec  Memory Limit: 256 MBSubmit: 455  Solved: 261[Submit][Status][Discuss] Descr ...