How to get machine level CPU and memory usage

Use Citrix Monitor Service API to get machine level CPU and memory usage.

Prerequisites

  • Read the Get started with Citrix Cloud APIs section to ensure that you have the bearer token.
  • Use the endpoint https://{ApiGatewayEndpoint}/monitorodata/ResourceUtilizationSummary, for your region specific API gateway endpoint, see Supported API Gateway endpoints.
  • Invoke the API described in this document from a client host.

Powered on machine CPU and memory usage at hourly level

  • Granularity = 60 represents hourly level metrics.
  • UptimeInMinutes > 0 represents the machine powered on in this hour.

Request

GET /monitorodata/ResourceUtilizationSummary?$filter=Granularity eq 60 and SummaryDate eq 2024-07-30T08:00:00Z and UptimeInMinutes gt 0 HTTP/1.1
Host: api.cloud.com
Authorization: CWSAuth bearer=<Token>
Citrix-CustomerId: <CustomerId>
<!--NeedCopy-->

Response

HTTP/1.1 200 OK
Date: Thu, 01 Aug 2024 06:23:00 GMT
Content-Type: application/json; odata.metadata=minimal
Content-Length: 5506
Connection: keep-alive
odata-version: 4.0

{
    "@odata.context": "https://api.cloud.com/monitorodata/$metadata#ResourceUtilizationSummary",
    "value": [
        {
            "MachineId": "31a02fb0-b673-4520-b94d-017fa2acd3b8",
            "Granularity": 60,
            "SummaryDate": "2024-07-30T08:00:00Z",
            "DesktopGroupId": "ad9e2d3d-44ac-49b0-a34b-7affb5ce3596",
            "AvgPercentCpu": 0.99298245335618651,
            "PeakPercentCpu": 3.5789473056793213,
            "AvgUsedMemory": 7918633224.9824562,
            "PeakUsedMemory": 7937829187.3684206,
            "AvgTotalMemory": 17170366464.0,
            "TotalSessionCount": 1,
            "AvgIcaRttInMs": null,
            "AvgLogOnDurationInMs": null,
            "UptimeInMinutes": 60,
            "CreatedDate": "2024-07-30T09:13:46.247Z",
            "ModifiedDate": "2024-07-30T09:13:46.247Z"
        }
    ]
}
<!--NeedCopy-->

Powered on machine CPU and memory usage at day level

  • Granularity = 1440 represents day level metrics.
  • UptimeInMinutes > 0 represents the machine powered on in this day.

Request

GET /monitorodata/ResourceUtilizationSummary?$filter=Granularity eq 1440 and SummaryDate eq 2024-07-30T00:00:00Z and UptimeInMinutes gt 0 HTTP/1.1
Host: api.cloud.com
Authorization: CWSAuth bearer=<Token>
Citrix-CustomerId: <CustomerId>
<!--NeedCopy-->

Response

HTTP/1.1 200 OK
Date: Thu, 01 Aug 2024 06:23:00 GMT
Content-Type: application/json; odata.metadata=minimal
Content-Length: 5506
Connection: keep-alive
odata-version: 4.0

{
    "@odata.context": "https://api.cloud.com/monitorodata/$metadata#ResourceUtilizationSummary",
    "value": [
        {
            "MachineId": "17f8b8f5-0f27-4852-a399-00194801a283",
            "Granularity": 1440,
            "SummaryDate": "2024-07-30T00:00:00Z",
            "DesktopGroupId": "ad9e2d3d-44ac-49b0-a34b-7affb5ce3596",
            "AvgPercentCpu": 1.1274837264250215,
            "PeakPercentCpu": 14.733333587646484,
            "AvgUsedMemory": 4474693852.6077623,
            "PeakUsedMemory": 4756543078.4,
            "AvgTotalMemory": 17170366464.0,
            "TotalSessionCount": 0,
            "AvgIcaRttInMs": null,
            "AvgLogOnDurationInMs": null,
            "UptimeInMinutes": 724,
            "CreatedDate": "2024-07-31T00:13:46.027Z",
            "ModifiedDate": "2024-07-31T00:13:46.027Z"
        }
    ]
}
<!--NeedCopy-->
Resources
Citrix Monitor Service API OpenAPI Specification
Copy Download
How to get machine level CPU and memory usage