it-novum / openitcockpit-agent-go

Cross-Platform Monitoring Agent for openITCOCKPIT written in Go
https://openitcockpit.io/download_agent/
Apache License 2.0
5 stars 2 forks source link

Swap Usage calculation on Windows sometimes wrong #56

Closed exa-mk closed 3 years ago

exa-mk commented 3 years ago

Agent Mode:

Versions

Operating system Windows Server 2019 Datacenter

Describe the bug In some circumstances then swap usage is calculated wrong somehow:

    "swap": {
        "total": 1324351488,
        "percent": 149.32699920823435,
        "used": 1977614336,
        "free": 3641704448,
        "sin": 0,
        "sout": 0
    },

image

There is more free than total and used together... ;) (Usage 150% :D )

To Reproduce Good question... no idea. It's a Windows Terminal Server with some web services. On our other Windows Servers it seems to be fine.

Expected behavior Proper calculation; no misleading alarms.

nook24 commented 3 years ago

This looks like an integer overflow. Windows uses an uint32 in Megabytes to report the current swap usage. We converted Megabytes into bytes but still using a uint32 which results in a maximum swap filesize of 4GB. I think this is the issue.

I will change this to an uint64

nook24 commented 3 years ago

Fixed with 3.0.6: https://github.com/it-novum/openitcockpit-agent-go/releases/tag/3.0.6