hjelev / rpi-mqtt-monitor

Raspberry Pi MQTT Monitor gathers system information and sends it to a MQTT server.
GNU General Public License v3.0
176 stars 42 forks source link

Unable to get it work on Ubuntu Server #18

Closed P-Stenbumling closed 1 year ago

P-Stenbumling commented 1 year ago

Linux raspberrypi4 5.19.0-1009-raspi #16-Ubuntu SMP PREEMPT Thu Nov 24 13:38:20 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux

``pi@raspberrypi4:~/rpi-mqtt-monitor/src$ /usr/bin/python3 /home/pi/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py awk: cmd. line:1: (FILENAME=- FNR=1) fatal: division by zero attempted Traceback (most recent call last): File "/home/pi/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py", line 318, in swap = check_swap() File "/home/pi/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py", line 71, in check_swap swap = round(float(swap.decode("utf-8").replace(",", ".")), 1) ValueError: could not convert string to float: ''

ezhische commented 1 year ago

Can you exicute from console and post the output: free -t |grep -i swap | awk 'NR == 1 {print $3/$2*100}'

olexs commented 1 year ago

Set the following in your config.py:

sys_clock_speed = False
swap = False

The code for those measurements is RaspberryPi-specific and doesn't work on other systems. With those two disabled, I run the monitor on multiple VPS's with Ubuntu Server with no issues.

hjelev commented 1 year ago

I have updated the script and now both wifi, swap and sys_clock_speed are also working on Ubuntu.