I'm running Alpine on my Raspi 5, it's free command doesn't support the "total" option -t. When using the Memory or Swap reporting, the script fails with the following error
BusyBox v1.36.1 (2023-11-07 18:53:09 UTC) multi-call binary.
Usage: free [-bkmgh]
Display free and used memory
Traceback (most recent call last):
File "/home/markus/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py", line 712, in <module>
gather_and_send_info()
File "/home/markus/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py", line 612, in gather_and_send_info
cpu_load, cpu_temp, used_space, voltage, sys_clock_speed, swap, memory, uptime_days, uptime_seconds, wifi_signal, wifi_signal_dbm, rpi5_fan_speed = collect_monitored_values()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/markus/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py", line 595, in collect_monitored_values
memory = check_memory()
^^^^^^^^^^^^^^
File "/home/markus/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py", line 86, in check_memory
memory = round(float(memory.decode("utf-8").replace(",", ".")))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: could not convert string to float: ''
Here's an example output of free as-is:
total used free shared buff/cache available
Mem: 8132632 5525592 156444 292000 2450596 2232356
Swap: 0 0 0
I can get it to work when removing the -t and filtering by Mem:
I'm running Alpine on my Raspi 5, it's
free
command doesn't support the "total" option-t
. When using the Memory or Swap reporting, the script fails with the following errorHere's an example output of
free
as-is:I can get it to work when removing the
-t
and filtering byMem
:For Swap, I also get the same issue as #11 (Division by Zero).