Skip to content

Instance network metrics calculation with API #9967

Closed

Description

@meisammaleki
ISSUE TYPE
  • Other
COMPONENT NAME

CLOUDSTACK VERSION 4.17.2

CONFIGURATION
OS / ENVIRONMENT
SUMMARY

I need to calculate the amount of downloaded and uploaded traffic on each instance for accounting purpose
For example if Download value for an instance reach 20 GB in a week (Download a 1GB file for 20 times)

STEPS TO REPRODUCE

EXPECTED RESULTS

I have downloaded this file with "wget" which it is approximately 2 GB with an instance and I except that the API show me a same value but was not same acctually. here is the like for download file

https://github.com/szalony9szymek/large/releases/download/free/large

this is returned values form api :
"networkread": "41.20 MiB",
"networkwrite": "0.91 MiB",


ACTUAL RESULTS

Activity

  1. modified the milestones: 4.19.4, 4.20.2 on Sep 2, 2025
  2. modified the milestones: 4.20.2, 4.20.3 on Oct 23, 2025
  3. added theissue type on Jan 6, 2026
  4. Pearl1594 commented on Jan 13, 2026

    @Pearl1594
    Contributor

    @meisammaleki Could you also please let us know which API are you referring to where you see the discrepancy? If you are referring to the listVirtualMachineMetrics API response, please pass the accumulate parameter and set it to true, to see the correct value. When you call the API without accumulate=true, the networkread value (e.g., "41.20 MiB") represents only the inbound traffic in the last 60 seconds - essentially the current download rate, not the cumulative total. This is why it appears much lower than expected. To see the correct total inbound traffic that your VM has received, you must add accumulate=true to your API call: cloudmonkey list virtualmachinemetrics id= accumulate=true. This will return the sum of all network traffic across the stats retention period.

  5. modified the milestones: 4.20.3, 4.20.4 on Feb 16, 2026
  6. modified the milestones: 4.20.4, unplanned on Mar 2, 2026
  7. DaanHoogland commented on Mar 2, 2026

    @DaanHoogland
    Contributor

    this sounds like a functional discussion...

  8. pinned this issue on Mar 2, 2026
  9. unpinned this issue on Mar 2, 2026
  10. locked and limited conversation to collaborators on Mar 2, 2026
  11. converted this issue into a discussion #12727 on Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions