System Load shows too many decimal places

Bug #1995805 reported by Terrance
10
This bug affects 2 people
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://us.archive.ubuntu.com/ubuntu jammy/main amd64 Packages
        100 /var/lib/dpkg/status

ProblemType: Bug
DistroRelease: Ubuntu 22.04
Package: landscape-common 19.12-0ubuntu13 [modified: usr/lib/python3/dist-packages/landscape/sysinfo/load.py]
ProcVersionSignature: Ubuntu 5.15.0-52.58-generic 5.15.60
Uname: Linux 5.15.0-52-generic x86_64
NonfreeKernelModules: nvidia_modeset nvidia
ApportVersion: 2.20.11-0ubuntu82.1
Architecture: amd64
CasperMD5CheckResult: unknown
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)

Revision history for this message
Terrance (kato223) wrote :
Revision history for this message
Terrance (kato223) wrote (last edit ):

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%

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in landscape-client (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.