milhousevh / bcmstat Goto Github PK
View Code? Open in Web Editor NEWSimple Raspberry Pi monitoring tool
License: GNU General Public License v2.0
Simple Raspberry Pi monitoring tool
License: GNU General Public License v2.0
FYI: I just tested latest bcmstat and for Pi0 W it shows Pi1 Unknown rev. 1.1 so I made a small patch (one print) and discovered that pcb_base is 0x9000C1. So I patched for me self.models and self.pcbs but I don't how submit it here, etc... so I just want to send this info here.
Thanks for the script.
Is it possible to add the all voltages to the periodic logline or is there a configuration setting that I have missed? I see the voltage displayed at the start and the (e) option for core voltage on the logging. Is it possible to include the other voltages status? The one voltage that may not be available would the one from the power supply connection to help determine if the supply is failing or if the Pi is having an issue.
This is a useful script for identifying and troubleshooting if there are hardware issues.
It would be helpful for packaging this if you would tag versions.
On my Pi 4B I have set custom speed values for ARM and GPU. Setting gpu_freq sets core and v3d among others. While bcmstat reflects these settings correctly for the ARM, the CORE min freq is displayed in the header incorrectly (but uses correct colors in terms of limits). V3D however shows up in amber for min_freq:
alex@aws:~:(29)> bcm
Config: v0.5.5, args "-o+V3D,-CPUuser,-CPUnice,-CPUsys,+MEMaccum -gri", priority lowest (+19)
Board: 4 x cores available, schedutil governor (Pi4 Model B rev 1.2, BCM2838 SoC with 4GB RAM by Sony UK)
Memory: 1024MB (split 896MB ARM, 128MB GPU) plus 1024MB Swap
HW Block: | ARM | Core | H264 | SDRAM |
Min Freq: | 1300MHz | 250MHz | 0MHz | 3180MHz |
Max Freq: | 1700MHz | 600MHz | 600MHz | 3180MHz |
Voltages: | 0, 0.9223V | +0, 1.2000V |
Other: temp_limit=75, initial_turbo=60
Firmware: Jan 24 2022 18:00:30, version 94562b1518ca82ece28042cca1e5cdbbb43c8bda (clean) (release) (start)
Codecs: H264 MJPG PCM
Booted: Fri Jan 28 10:07:14 2022
Time ARM Core H264 V3D Core Temp (Max) IRQ/s %total GPUMem Free MemFreeKB / %used(SwUse)
======== ======= ======= ======= ======= =============== ====== ====== =========== ========================
21:37:18 1300Mhz 400Mhz 0Mhz 400Mhz 50.6C (50.63C) 4,422 33.45 102M ( 94%) 4,390,460 / 10.1%( 0.0%)
21:37:20 1300Mhz 600Mhz 0Mhz 600Mhz 48.7C (50.63C) 307 0.87 102M ( 94%) 4,390,860 / 10.0%( 0.0%)
21:37:22 1300Mhz 400Mhz 0Mhz 600Mhz 48.7C (50.63C) 304 0.79 102M ( 94%) 4,390,756 / 10.0%( 0.0%)
21:37:24 1300Mhz 400Mhz 0Mhz 400Mhz 49.7C (50.63C) 279 0.90 102M ( 94%) 4,390,860 / 10.0%( 0.0%)
21:37:26 1300Mhz 400Mhz 0Mhz 400Mhz 48.7C (50.63C) 273 0.78 102M ( 94%) 4,390,816 / 10.0%( 0.0%)
21:37:28 1300Mhz 400Mhz 0Mhz 400Mhz 48.7C (50.63C) 305 1.39 102M ( 94%) 4,390,668 / 10.1%( 0.0%)
21:37:30 1300Mhz 400Mhz 0Mhz 400Mhz 48.7C (50.63C) 294 0.75 102M ( 94%) 4,390,460 / 10.1%( 0.0%)^C
Peak Values: IRQ: 4422
alex@aws:~:(30)> vcgencmd get_config int | grep -e freq
arm_freq=1700
arm_freq_min=1300
gpu_freq=600
gpu_freq_min=400
In color, the v3d shows up in red for the 600Mhz max but in amber for the 400Mhz min freq... let me know if you have some idea.
When I run bcmstat in a smaller Tmux pane I'll get some ugly wrapping which makes the output hard to read. I know some fields are optional, but it seems like most of them are not. How can I only allow a few select fields?
bcmstat crashed the other day with the following output:
Traceback (most recent call last):
File "/home/daco/bin/bcmstat.sh", line 1433, in
main(sys.argv[1:])
File "/home/daco/bin/bcmstat.sh", line 1395, in main
getBCM283X(BCM)
File "/home/daco/bin/bcmstat.sh", line 495, in getBCM283X
[int(vcgencmd("measure_clock arm")),
File "/home/daco/bin/bcmstat.sh", line 301, in vcgencmd
return grep("", runcommand("%s %s" % (VCGENCMD, args)), 1, split_char="=")
File "/home/daco/bin/bcmstat.sh", line 270, in runcommand
return subprocess.check_output(command.split(" "), stderr=subprocess.STDOUT).decode("utf-8")[:-1]
File "/usr/lib/python3.5/subprocess.py", line 629, in check_output
*_kwargs).stdout
File "/usr/lib/python3.5/subprocess.py", line 696, in run
with Popen(_popenargs, **kwargs) as process:
File "/usr/lib/python3.5/subprocess.py", line 950, in init
restore_signals, start_new_session)
File "/usr/lib/python3.5/subprocess.py", line 1544, in _execute_child
raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: '/opt/vc/bin/vcgencmd'
I have never seen a crash in bcmstat before. Do you think the problem is with my side or the bcmstat side?
Thanks,
Paul Crawford
Could you develop a webui for this app?. it would be great for this pi .
I'm doing some testing with a network card eth1
(not the built-in eth0
interface), and I'm seeing 0
for both RX B/s
and TX B/s
.
Here's my proc/net/dev:
$ cat /proc/net/dev
Inter-| Receive | Transmit
face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed
lo: 5530 39 0 0 0 0 0 0 5530 39 0 0 0 0 0 0
eth0: 10010025 7702 0 0 0 0 0 549 193967 1558 0 0 0 0 0 0
wlan0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
eth1: 21375449369 17268488 0 0 0 0 0 1846 99991576856 66978432 0 0 0 0 0 0
Great script, only issue is core voltage (Vcore) is not displayed if selected as an output
./bcmstat.sh o+Vcore
The above is accepted as correct syntax as per the help output, but makes completely no change to the columns which are updated every second. It is displayed in the static voltage section in the prefix header but not in the rolling update columns.
Edit: - this is different to closed issue #11 - cpu core voltage will fluctuate depending upon cpu load/demands i.e. vcgencmd measure_volts core
Hey! I am not quite sure what this here means. I am trying to track down a memory leak in the GPU. Any advice?
Time UFT ARM Core H264 Core Temp (Max) IRQ/s RX kB/s TX kB/s Malloc Free Reloc Free MemFreeMB / %used(SwUse) Delta GPU B Mem kB Accum GPU B Mem kB
======== === ======= ======= ======= =============== ====== ======= ======= =========== =========== ======================== ======================= =======================
15:27:13 1400Mhz 400Mhz 300Mhz 47.24C (48.31C) 4,917 436 8 10M ( 83%) 61M ( 56%) 856 / 12.1%( 0.0%) 0 -104 0 -5,144
15:27:15 1400Mhz 400Mhz 300Mhz 47.24C (48.31C) 4,953 499 8 10M ( 83%) 61M ( 56%) 857 / 12.0%( 0.0%) 0 +708 0 -4,436
15:27:17 1400Mhz 400Mhz 300Mhz 46.70C (48.31C) 4,602 370 7 10M ( 83%) 61M ( 56%) 856 / 12.1%( 0.0%) 0 -444 0 -4,880
15:27:19 1400Mhz 400Mhz 300Mhz 47.24C (48.31C) 5,793 493 8 10M ( 83%) 61M ( 56%) 857 / 12.0%( 0.0%) 0 +508 0 -4,372
15:27:21 1400Mhz 400Mhz 300Mhz 47.24C (48.31C) 5,426 549 8 10M ( 83%) 61M ( 56%) 856 / 12.2%( 0.0%) 0 -1,360 0 -5,732
15:27:24 1400Mhz 400Mhz 300Mhz 47.24C (48.31C) 5,461 394 7 10M ( 83%) 61M ( 56%) 856 / 12.1%( 0.0%) 0 +684 0 -5,048
15:27:26 1400Mhz 400Mhz 300Mhz 47.24C (48.31C) 6,445 552 8 10M ( 83%) 61M ( 56%) 855 / 12.3%( 0.0%) 0 -1,716 0 -6,764
15:27:28 1400Mhz 400Mhz 300Mhz 46.70C (48.31C) 4,385 434 7 10M ( 83%) 61M ( 56%) 855 / 12.2%( 0.0%) 0 +792 0 -5,972
15:27:30 1400Mhz 400Mhz 300Mhz 47.24C (48.31C) 4,639 342 8 10M ( 83%) 61M ( 56%) 856 / 12.1%( 0.0%) 0 +1,092 0 -4,880
15:27:32 1400Mhz 400Mhz 300Mhz 47.24C (48.31C) 5,227 383 8 10M ( 83%) 61M ( 56%) 857 / 12.0%( 0.0%) 0 +548 0 -4,332
15:27:34 1400Mhz 400Mhz 300Mhz 47.24C (48.31C) 4,886 403 7 10M ( 83%) 61M ( 56%) 857 / 12.0%( 0.0%) 0 +8 0 -4,324
15:27:36 1400Mhz 400Mhz 300Mhz 47.24C (48.31C) 5,525 495 8 10M ( 83%) 61M ( 56%) 857 / 12.0%( 0.0%) 0 -252 0 -4,576
15:27:38 1400Mhz 400Mhz 300Mhz 47.77C (48.31C) 4,404 416 8 10M ( 83%) 61M ( 56%) 856 / 12.1%( 0.0%) 0 -520 0 -5,096
15:27:40 1400Mhz 400Mhz 300Mhz 47.24C (48.31C) 4,707 410 7 10M ( 83%) 61M ( 56%) 856 / 12.2%( 0.0%) 0 -724 0 -5,820
15:27:42 1400Mhz 400Mhz 300Mhz 47.24C (48.31C) 5,207 546 8 10M ( 83%) 61M ( 56%) 856 / 12.1%( 0.0%) 0 +300 0 -5,520
15:27:44 1400Mhz 400Mhz 300Mhz 47.24C (48.31C) 4,696 413 8 10M ( 83%) 61M ( 56%) 855 / 12.2%( 0.0%) 0 -552 0 -6,072
15:27:46 1400Mhz 400Mhz 300Mhz 47.24C (48.31C) 4,950 487 7 10M ( 83%) 61M ( 56%) 856 / 12.1%( 0.0%) 0 +752 0 -5,320
15:27:49 1400Mhz 400Mhz 300Mhz 47.24C (48.31C) 6,120 489 8 10M ( 83%) 61M ( 56%) 857 / 12.0%( 0.0%) 0 +988 0 -4,332
15:27:51 1400Mhz 400Mhz 300Mhz 47.24C (48.31C) 4,556 466 8 10M ( 83%) 61M ( 56%) 855 / 12.2%( 0.0%) 0 -1,688 0 -6,020
in Version v0.1.4 , Core Temp and Max are displayed as integers, so the 2 decimal places are always zero. Changing tCore and TMAX to type float as below (three places) fixes this issue, decimal places display correctly. The decimals are useful to spot trends more quickly than waiting for a 1 degree increment.
def getBCM2835(storage):
global TMAX
#Grab temp - ignore temps of 85C as this seems to be an occasional aberration in the reading
tCore = float(readfile("/sys/class/thermal/thermal_zone0/temp"))
tCore = 0 if tCore < 0 else tCore
TMAX = tCore if (tCore > TMAX and tCore < 85000) else TMAX
storage[2] = storage[1]
storage[1] = (time.time(),
[int(vcgencmd("measure_clock arm")),
int(vcgencmd("measure_clock core")),
int(vcgencmd("measure_clock h264")),
float(tCore),
float(TMAX)])
On PI 4B/4GB RAM:
root@localhost:bin# ./bcmstat.sh
Config: v0.5.5, args "", priority lowest (+19)
Board: 4 x cores available, ondemand governor (Pi1 Model B rev 1.1, BCM2835 SoC with 256MB RAM by Sony UK)
Memory: 1014MB (split 998MB ARM, 16MB GPU) plus 1913MB Swap
HW Block: | ARM | Core | H264 | SDRAM |
Min Freq: | 600MHz | 250MHz | 0MHz | 3200MHz |
Max Freq: | 1800MHz | 500MHz | 500MHz | 3200MHz |
Voltages: | +2, 0.9188V | +0, 1.2000V |
Other: temp_limit=85
Firmware: Oct 8 2020 16:53:11, version 98d4a47662dd4fe24f8637651a89a83665d99675 (clean) (release) (start_cd)
Codecs: none
Booted: Mon Dec 21 14:29:31 2020
Thank you for sharing a good code.
Could you suggest a solution?
input => ./bcmstat.sh xgpd10
Traceback (most recent call last):
File "./bcmstat.sh", line 1619, in
main(sys.argv[1:])
File "./bcmstat.sh", line 1481, in main
commands = vcgencmd("commands")[1:-1].split(", ")
File "./bcmstat.sh", line 347, in vcgencmd
return grep("", runcommand("%s %s" % (VCGENCMD, args)), 1, split_char="=")
File "./bcmstat.sh", line 318, in runcommand
return subprocess.check_output(command.split(" "), stderr=subprocess.STDOUT)[:-1]
File "/usr/lib/python2.7/subprocess.py", line 212, in check_output
process = Popen(stdout=PIPE, *popenargs, **kwargs)
File "/usr/lib/python2.7/subprocess.py", line 390, in init
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1024, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
Snipping out bits that aren't relevant, but I noticed the memory calculations aren't correct.
$ bcmstat.sh J1mrg -oGPUfree,MEMfree
Config: v0.5.5, args "J1mrg -oGPUfree,MEMfree", priority lowest (+19)
Board: 4 x ARMv7 cores available, ondemand governor (Pi4 Model B rev 1.1, BCM2838 SoC with 4GB RAM by Sony UK)
Memory: 1024MB (split 704MB ARM, 320MB GPU)
<snip>
Time GPUMem Free MemFreeKB / %used
======== =========== =================
20:17:08 295M ( 98%) 3,483,968 / 7.1%
bcmstat sees two different memory configurations and the Board matches what it actually polls via /proc/meminfo. The one in the header is wrong. The code that does it is:
MEM_ARM = int(vcgencmd("get_mem arm")[:-1])
MEM_GPU = int(vcgencmd("get_mem gpu")[:-1])
MEM_MAX = MEM_ARM + MEM_GPU
The documentation for vcgencmd says:
On a Raspberry Pi 4 with greater than 1GB of RAM, the arm option is inaccurate. This is because the GPU firmware which implements this command is only aware of the first gigabyte of RAM on the system, so the arm setting will always return 1GB minus the gpu memory value. To get an accurate report of the amount of ARM memory, use one of the standard Linux commands, such as free or cat /proc/meminfo
MEMTOTAL
is actually already pulled. I was thinking about swapping this value in for the header.
Thoughts?
./bcmstat.sh
Config: v0.4.4, args "", priority lowest (+19)
Board: 1 x ARMv6 core available, ondemand governor (Pi1 Unknown rev 1.1, BCM2835 SoC with 512MB RAM by Sony)
Memory: 512MB (split 448MB ARM, 64MB GPU) plus 100MB Swap
HW Block: | ARM | Core | H264 | SDRAM |
Min Freq: | 700MHz | 250MHz | 0MHz | 450MHz |
Max Freq: | 1000MHz | 400MHz | 300MHz | 450MHz |
Voltages: | 0, 1.3500V | +1, 1.2250V |
Other: temp_limit=85, disable_auto_turbo=1
Firmware: Apr 27 2017 17:19:34, version 17af5814bb19dbb7c70ccd2c845b80a160943811 (clean) (release)
Codecs: H264 H263 MPG4 MJPG PCM
Booted: Fri Apr 28 13:02:58 2017
Error: Network interface eth0 is not valid!
It seems that on Raspberry Pi 4 vcgencmd measure_clock h264
always returns 0. Maybe it would be useful to monitor the GPU frequencies by vcgencmd measure_clock v3d
?
The file bcmstat.sh has the extension .sh, which would make it a shell script. But it isn't a shell script, it is a python script.
I know that's not how extensions work in linux, but it would be nice to see what program it actually needs without having to open the file and look at the first line.
I have tried to run this with sh bcmstat.sh
so many times.
I have this error when trying to run the script:
# ./bcmstat.sh
Config: v0.4.9, args "", priority lowest (+19)
Board: 4 x cores available, ondemand governor (Pi1 Model B rev 1.1, BCM2835 SoC with 256MB RAM by Sony)
Memory: 1024MB (split 948MB ARM, 76MB GPU)
HW Block: | ARM | Core | H264 | SDRAM |
Min Freq: | 600MHz | 250MHz | 0MHz | 450MHz |
Max Freq: | 1200MHz | 400MHz | 300MHz | 450MHz |
Voltages: | 0, 1.2000V | +1, 1.2250V |
Other: temp_limit=85
Firmware: Aug 22 2017 14:16:17, version eb51b8b84ec11d98562dfbb7be53cdd216c0ea4c (clean) (release)
Codecs: H264 H263 MPG4 MJPG PCM
Booted: Fri Sep 7 11:05:31 2018Traceback (most recent call last):
File "./bcmstat.sh", line 1619, in <module>
main(sys.argv[1:])
File "./bcmstat.sh", line 1522, in main
getIRQ(IRQ)
File "./bcmstat.sh", line 440, in getIRQ
storage[1] = (time.time(), int(grep("dwc", readfile("/proc/interrupts"), 1)))
ValueError: invalid literal for int() with base 10: '72244\n2142141'
It seems that is incorrect detected as Raspberry pi 1 while instead it is a raspberry PI 3 :
# uname -a
Linux zenby 4.11.12-pi64+ #1 SMP PREEMPT Sun Aug 27 14:50:58 CEST 2017 aarch64 GNU/Linux``
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.