System Load shows too many decimal places
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
landscape-client (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
When running the landscape-sysinfo command the System Load shows too many decimal places where the command of like top only shows 2.
System load: 0.17138671875 Processes: 334
Usage of /: 49.9% of 211.67GB Users logged in: 1
Memory usage: 10% IPv4 address for eth0: 10.0.0.100
Swap usage: 0%
lsb_release -rd
Description: Ubuntu 22.04.1 LTS
Release: 22.04
apt-cache policy landscape-common
landscape-common:
Installed: 19.12-0ubuntu13
Candidate: 19.12-0ubuntu13
Version table:
*** 19.12-0ubuntu13 500
500 http://
100 /var/lib/
ProblemType: Bug
DistroRelease: Ubuntu 22.04
Package: landscape-common 19.12-0ubuntu13 [modified: usr/lib/
ProcVersionSign
Uname: Linux 5.15.0-52-generic x86_64
NonfreeKernelMo
ApportVersion: 2.20.11-0ubuntu82.1
Architecture: amd64
CasperMD5CheckR
CurrentDesktop: XFCE
Date: Sun Nov 6 10:19:17 2022
InstallationDate: Installed on 2021-10-02 (399 days ago)
InstallationMedia: Xubuntu 20.04.3 LTS "Focal Fossa" - Release amd64 (20210819.1)
SourcePackage: landscape-client
UpgradeStatus: Upgraded to jammy on 2022-08-12 (86 days ago)
I actually found a way to fix this by modifying the /usr/lib/ python3/ dist-packages/ landscape/ sysinfo/ load.py file to the following:
import os
from decimal import *
from twisted. internet. defer import succeed
class Load(object):
def register(self, sysinfo):
self._ sysinfo = sysinfo
def run(self):
self._ sysinfo. add_header( "System load", str(Decimal( os.getloadavg( )[0]).quantize( Decimal( '.00')) ))
return succeed(None)
And now I get the correct info:
$ landscape-sysinfo
System load: 0.86 Processes: 335
Usage of /: 51.0% of 211.67GB Users logged in: 1
Memory usage: 12% IPv4 address for eth0: 10.0.0.100
Swap usage: 0%