Skip to content

Commit

Permalink
Fix loadavg on systems without /proc/loadavg.
Browse files Browse the repository at this point in the history
  • Loading branch information
kiarn committed Apr 22, 2023
1 parent 812cebd commit 847b089
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plugins/dashboard/widgets/loadavg.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ def get_value(self, config):
if os.path.exists('/proc/loadavg'):
return [float(open('/proc/loadavg').read().split()[x]) * k for x in range(3)]

tokens = subprocess.check_output(['uptime']).split()
return [float(x.strip(',')) * k for x in tokens[-3:]]
tokens = subprocess.check_output(['uptime']).decode().split()
return [float(x.strip(',').replace(',', '.')) * k for x in tokens[-3:]]

0 comments on commit 847b089

Please sign in to comment.