Skip to content

Commit

Permalink
Add support for systems with German language (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
hjelev authored May 8, 2024
1 parent 0d1ae21 commit a64c631
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,15 +200,15 @@ You need to edit the service file and update the path to the script and the user
Then copy the service file to ```/etc/systemd/system/``` and enable it:

```bash
sudo cp rpi-cpu2mqtt.service /etc/systemd/system/
sudo systemctl enable rpi-cpu2mqtt.service
sudo cp rpi-mqtt-monitor.service /etc/systemd/system/
sudo systemctl enable rpi-mqtt-monitor.service
```

To test that the service is working you can run:

```bash
sudo service rpi-cpu2mqtt start
sudo service rpi-cpu2mqtt status
sudo service rpi-mqtt-monitor start
sudo service rpi-mqtt-monitor status
```

## Schedule Raspberry Pi MQTT Monitor execution with a cron
Expand Down
3 changes: 3 additions & 0 deletions src/rpi-cpu2mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ def check_swap():
def check_memory():
full_cmd = "free | grep -i mem | awk 'NR == 1 {print $3/$2*100}'"
memory = subprocess.Popen(full_cmd, shell=True, stdout=subprocess.PIPE).communicate()[0]
if memory == '':
full_cmd = "free | grep -i speicher | awk 'NR == 1 {print $3/$2*100}'"
memory = subprocess.Popen(full_cmd, shell=True, stdout=subprocess.PIPE).communicate()[0]
memory = round(float(memory.decode("utf-8").replace(",", ".")))

return memory
Expand Down

0 comments on commit a64c631

Please sign in to comment.