Viewing Connector HealthData

Getting started

To use the HealthData APIs, each API request must contain the following fields:

  • CCAuth Token: Secure HTTP requests sent to Citrix Cloud (CC) use a custom Authorization header that contains a CC bearer token. Bearer tokens are required for actions that take place on behalf of a user.
  • Citrix Customer ID: The Customer ID is passed using the custom Citrix-CustomerId Header in the request.
  • Citrix Connector ID: The Connector ID is passed using the custom Citrix-ConnectorId Header in the request.

CC Auth Token

You can obtain a CC Auth token from the API Client ID and Secret. For more information, see the Getting Started section.

Customer ID

Customer ID is a mandatory parameter that must be passed in the Citrix-CustomerId header of the request. To get the Customer ID:

  1. Log in to the Citrix Cloud console.
  2. Select the Identity and Access Management option from the menu.
  3. Click API Access tab. You can see the customer ID in the description above the Create Client button.

Connector ID

Connector ID is a mandatory parameter that must be passed in the Citrix-ConnectorId header of the request. To get the connector ID:

  1. Log in to the Citrix Cloud console.
  2. Select the Resource Locations option from the menu.
  3. Select the resource location containing the connector you are interested in.
  4. Select View Connector Data on the connector in which you are interested
  5. The URL of Connector Data page will contain the ID of the connector.

Get metric data for a connector

This demonstrates how to issue a REST request to retrieve all the metric data for a connector.

Request

GET https://api.cloud.com/healthdata/metrics HTTP/1.1
Authorization: CwsAuth Bearer=<token-from-call-to-trust>
Accept: application/json
Citrix-CustomerId: <CustomerId>
Citrix-ConnectorId: <ConnectorId>
<!--NeedCopy-->

Note:

Replace CustomerId and ConnectorId in the request above with the ID of the customer and connector you wish to query.

Response

HTTP/1.1 200 OK
Cache-Control: no-cache
Content-Length: 8571
Content-Type: application/json; charset=utf-8
Date: Fri, 13 Jan 2023 15:24:16 GMT
x-cws-transactionid: c0a9bc16-6a55-4563-aee3-f1eef9c86b49

{
    "cpuData": [
        {
            "identifier": null,
            "alert": false,
            "subtype": "\\Processor(0)\\% Processor Time",
            "data": {
                "1673538206": 3.83044338,
                "1673541807": 3.82269049,
                "1673545407": 3.83231139,
                "1673549007": 3.81026769,
                "1673552608": 3.44340563,
                "1673556208": 3.41506648,
                "1673559808": 3.5283215,
                "1673563408": 3.49377179,
                "1673567009": 3.513845,
                "1673570609": 3.479175,
                "1673574209": 3.55315447,
                "1673577810": 3.57821846,
                "1673581410": 3.58536386,
                "1673585010": 3.6157372,
                "1673588610": 3.62093019,
                "1673592241": 3.60159469,
                "1673595810": 3.78742,
                "1673599410": 3.67533946,
                "1673603011": 4.48120546,
                "1673606611": 4.212815,
                "1673610211": 4.076293,
                "1673613812": 4.024987,
                "1673617417": 4.04589558,
                "1673621017": 3.96808529
            },
            "maxValue": 100.0,
            "unit": null,
            "chartType": "Line"
        },
        {
            "identifier": null,
            "alert": false,
            "subtype": "\\Processor(1)\\% Processor Time",
            "data": {
                "1673538206": 3.773996,
                "1673541807": 3.79821777,
                "1673545407": 3.78251,
                "1673549007": 3.74487281,
                "1673552608": 3.276492,
                "1673556208": 3.28611135,
                "1673559808": 3.5003624,
                "1673563408": 3.48354268,
                "1673567009": 3.5470643,
                "1673570609": 3.51648116,
                "1673574209": 3.57196021,
                "1673577810": 3.60704637,
                "1673581410": 3.60925078,
                "1673585010": 3.6356225,
                "1673588610": 3.63668418,
                "1673592241": 3.60916162,
                "1673595810": 3.81564331,
                "1673599410": 3.60980129,
                "1673603011": 4.358875,
                "1673606611": 4.13552427,
                "1673610211": 4.16337252,
                "1673613812": 4.08536673,
                "1673617417": 4.086117,
                "1673621017": 3.96865344
            },
            "maxValue": 100.0,
            "unit": null,
            "chartType": "Line"
        },
        {
            "identifier": null,
            "alert": false,
            "subtype": "\\Processor(_Total)\\% Processor Time",
            "data": {
                "1673538206": 3.79912853,
                "1673541807": 3.807314,
                "1673545407": 3.804279,
                "1673549007": 3.77441478,
                "1673552608": 3.357189,
                "1673556208": 3.34763646,
                "1673559808": 3.51160812,
                "1673563408": 3.48594618,
                "1673567009": 3.52775264,
                "1673570609": 3.49503541,
                "1673574209": 3.55976534,
                "1673577810": 3.58985233,
                "1673581410": 3.59451,
                "1673585010": 3.62284946,
                "1673588610": 3.62595558,
                "1673592241": 3.60253263,
                "1673595810": 3.79793835,
                "1673599410": 3.63901,
                "1673603011": 4.416372,
                "1673606611": 4.170683,
                "1673610211": 4.116429,
                "1673613812": 4.051854,
                "1673617417": 4.06271648,
                "1673621017": 3.96513128
            },
            "maxValue": 100.0,
            "unit": null,
            "chartType": "Line"
        }
    ],
    "memoryData": [
        {
            "identifier": null,
            "alert": false,
            "subtype": "\\Memory\\Available MBytes",
            "data": {
                "1673538206": 926.0062,
                "1673541806": 925.5116,
                "1673545406": 926.801758,
                "1673549007": 926.751648,
                "1673552607": 926.579834,
                "1673556207": 925.946655,
                "1673559807": 925.2132,
                "1673563408": 923.1965,
                "1673567008": 920.217346,
                "1673570608": 917.5735,
                "1673574209": 915.5464,
                "1673577809": 916.266357,
                "1673581409": 918.0135,
                "1673585010": 921.6882,
                "1673588610": 924.169434,
                "1673592240": 925.4478,
                "1673595810": 925.9856,
                "1673599411": 926.254456,
                "1673603011": 922.3902,
                "1673606611": 920.419067,
                "1673610212": 918.2355,
                "1673613812": 916.745544,
                "1673617417": 917.953735,
                "1673621012": 917.4862
            },
            "maxValue": 4087.039,
            "unit": null,
            "chartType": "Line"
        }
    ],
    "networkData": [
        {
            "identifier": null,
            "alert": false,
            "subtype": "\\Network Interface(XenServer PV Network Device _0)\\Bytes Total/sec",
            "data": {
                "1673538206": 7609.03955,
                "1673541807": 7445.62939,
                "1673545407": 7611.879,
                "1673549012": 7534.901,
                "1673552608": 7403.955,
                "1673556208": 7363.656,
                "1673559808": 7583.072,
                "1673563408": 7624.59375,
                "1673567009": 6834.60938,
                "1673570609": 5604.63965,
                "1673574210": 8288.448,
                "1673577810": 9436.139,
                "1673581410": 10106.6836,
                "1673585010": 10205.31,
                "1673588611": 10355.7783,
                "1673592241": 10573.4619,
                "1673595811": 10344.4531,
                "1673599412": 9944.942,
                "1673603012": 9880.492,
                "1673606612": 9565.367,
                "1673610212": 9330.491,
                "1673613813": 9339.264,
                "1673617413": 9800.397,
                "1673621013": 9955.202
            },
            "maxValue": 1E+11,
            "unit": null,
            "chartType": "Line"
        },
        {
            "identifier": null,
            "alert": false,
            "subtype": "\\Network Interface(Microsoft ISATAP Adapter)\\Bytes Total/sec",
            "data": {
                "1673538206": 0.0,
                "1673541807": 0.0,
                "1673545407": 0.0,
                "1673549012": 0.0,
                "1673552608": 0.0,
                "1673556208": 0.0,
                "1673559808": 0.0,
                "1673563408": 0.0,
                "1673567009": 0.0,
                "1673570609": 0.0,
                "1673574210": 0.0,
                "1673577810": 0.0,
                "1673581410": 0.0,
                "1673585010": 0.0,
                "1673588611": 0.0,
                "1673592241": 0.0,
                "1673595811": 0.0,
                "1673599412": 0.0,
                "1673603012": 0.0,
                "1673606612": 0.0,
                "1673610212": 0.0,
                "1673613813": 0.0,
                "1673617413": 0.0,
                "1673621013": 0.0
            },
            "maxValue": 100000.0,
            "unit": null,
            "chartType": "Line"
        }
    ],
    "diskData": [
        {
            "identifier": null,
            "alert": false,
            "subtype": "\\LogicalDisk(C:)\\Free Megabytes",
            "data": {
                "1673538206": 72178.0,
                "1673541807": 72185.0,
                "1673545407": 72187.0,
                "1673549007": 72180.0,
                "1673552608": 72174.0,
                "1673556208": 72160.0,
                "1673559808": 71888.0,
                "1673563408": 71871.0,
                "1673567009": 71874.0,
                "1673570609": 71865.0,
                "1673574209": 71848.0,
                "1673577810": 71881.0,
                "1673581410": 71873.0,
                "1673585010": 71858.0,
                "1673588610": 71855.0,
                "1673592241": 71847.0,
                "1673595811": 71845.0,
                "1673599411": 71844.0,
                "1673603012": 71824.0,
                "1673606612": 71810.0,
                "1673610212": 71806.0,
                "1673613812": 71817.0,
                "1673617413": 71894.0,
                "1673621013": 71889.0
            },
            "maxValue": 101770.0,
            "unit": null,
            "chartType": "Line"
        }
    ],
    "providersData": {}
}
<!--NeedCopy-->

C# Example

The following example illustrates how to query a connector’s metric data.

public static async Task<RecordsResult> GetMetricData(string bearerToken, string customerId, string connectorId)
{
    var client = new HttpClient();
    client.DefaultRequestHeaders.Accept.ParseAdd("application/json");
    client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("CwsAuth", "Bearer=" + bearerToken);
    client.DefaultRequestHeaders.Add("Citrix-CustomerId", customerId);
    client.DefaultRequestHeaders.Add("Citrix-ConnectorId", connectorId);


    var response = await client.GetAsync(
        $"https://api.cloud.com/healthdata/metrics"
    );

    response.EnsureSuccessStatusCode();

    var content = await response.Content.ReadAsStringAsync();
    return JsonConvert.DeserializeObject<MetricDataEntity>(content);
}

public class MetricDataResponsesModel
{
    /// <summary>
    /// Data for CPU.
    /// </summary>
    public IList<MetricDataResponseModel> CpuData { get; set; }

    /// <summary>
    /// Data for memory.
    /// </summary>
    public IList<MetricDataResponseModel> MemoryData { get; set; }

    /// <summary>
    /// Data for network.
    /// </summary>
    public IList<MetricDataResponseModel> NetworkData { get; set; }

    /// <summary>
    /// Data for disk.
    /// </summary>
    public IList<MetricDataResponseModel> DiskData { get; set; }

    /// <summary>
    /// Data for providers.
    /// </summary>
    public IDictionary<string, IDictionary<string, IList<MetricDataResponseModel>>> ProvidersData { get; set; }
}

public class MetricDataResponseModel
{
    /// <summary>
    /// Metric data identifier.
    /// </summary>
    public string Identifier { get; set; }

    /// <summary>
    /// Raise alert for this metric
    /// </summary>
    public bool Alert { get; set; }

    /// <summary>
    /// SubType
    /// </summary>
    public string Subtype { get; set; }

    /// <summary>
    /// Data dictionary. 
    /// </summary>
    public IDictionary<ulong, float> Data { get; set; }

    /// <summary>
    /// The max value the data set can have
    /// </summary>
    public float MaxValue { get; set; }

    /// <summary>
    /// Measurement unit (e.g. calls/minute).
    /// </summary>
    public string Unit { get; set; }

    /// <summary>
    /// Chart type.
    /// </summary>
    public ChartType ChartType { get; set; }
}
<!--NeedCopy-->

Trigger a new health check

To trigger a new health check, you can make a POST request to:

https://cws.citrixworkspacesapi.net/{customerId}/healthdatarequests
<!--NeedCopy-->

with body:

{
    "objectIdentifier": "{connectorId}",
    "objectType": "EdgeServers"
}
<!--NeedCopy-->

The result will be included in subsequent requests to the first API above.

Resources
Viewing Connector HealthData OpenAPI Specification
Copy Download
Getting started