Resource routes

Review this topic to learn about resource routes.

Description

Resources are entities gathered by data collectors and sent in to the Performance Monitoring server. Resources are largely unstructured, but have the following common fields:

The resource routes allow querying for resources and the data associated with them. For more information, see Swagger document.

RBAC

Cluster Administrators and Account Administrators have full access to resources. Team administrators and operators have access only to the resources that their team has been granted access to. Groups can be used as a mechanism to grant access to resources.

Examples

In the examples that follow, these fields are defined:

export ACCESS_TOKEN="Bearer <access_token>"
export ACCOUNT_ID="<account>"
export BASE_URL="<route-to-service>"

Query for resources by type

The backend supports filtering by type. Resources will be fetched one page at a time. Use the nextOffset property in the result to fetch additional pages. The nextOffset property is an empty string when no additional pages remain.

Note: Do not rely on a set number of results being returned in one page.

Command to get query for resources by type

curl -X GET "${BASE_URL}/applicationmgmt/v2/resources?filter=type=k8sPod&field=uid" \
  -H "Authorization: ${ACCESS_TOKEN}" \
  -H "X-TenantID: $ACCOUNT_ID"

Output for resources query (shortened for brevity)

{
  "items":[
    {
      "uid":"ec37c45a7f4e5b0e56cee4e203be5b84_kube-system_k8sPod_multicluster-hub-findings-pruning-1582271940-b29d7"
    },
    {
      "uid":"ec37c45a7f4e5b0e56cee4e203be5b84_kube-system_k8sPod_icp-mongodb-0"
    }
  ],
  "nextOffset":"some-string"
}

Pagination

Resources are fetched one page at a time. Use the nextOffset property in the result to fetch additional pages. The nextOffset property is an empty string when no additional pages remain. To retrieve the next page, use nextOffset from the previous result.

Remember: Do not rely on a set number of results being returned in one page.

Command to get resources based on pagination

curl -X GET "${BASE_URL}/applicationmgmt/v2/resources?filter=type=k8sPod&field=uid&offset=some-string" \
  -H "Authorization: ${ACCESS_TOKEN}" \
  -H "X-TenantID: $ACCOUNT_ID"

Output for resources (shortened for brevity)

{
  "items":[
    {
      "uid":"ec37c45a7f4e5b0e56cee4e203be5b84_cert-manager_k8sPod_cert-manager-webhook-cainjector-77ff49d78d-d65bf"
    },
    {
      "uid":"ec37c45a7f4e5b0e56cee4e203be5b84_multicluster-endpoint_k8sPod_endpoint-topology-weave-scope-app-5fff875d54-g7vhg"
    }
  ],
  "nextOffset":""
}

Because nextOffset is an empty string, no additional results remain.

Fetch resources by tag

Command to fetch resources by tag

curl -X GET "${BASE_URL}/applicationmgmt/v2/resources?filter=tags=k8sLabel_heritage:Tiller&field=uid" \
  -H "Authorization: ${ACCESS_TOKEN}" \
  -H "X-TenantID: $ACCOUNT_ID"

Output for resources by tag (shortened for brevity)

{
  "items":[
    {
      "uid":"ec37c45a7f4e5b0e56cee4e203be5b84_kube-system_k8sReplicaSet_helm-repo-66f87cb964"
    },
    {
      "uid":"ec37c45a7f4e5b0e56cee4e203be5b84_kube-system_k8sDeployment_oidcclient-watcher"
    },
    {
      "uid":"ec37c45a7f4e5b0e56cee4e203be5b84_multicluster-endpoint_k8sDeployment_endpoint-connmgr"
    }
  ],
  "nextOffset":"some-string"
}

See Query for resources by type for a pagination example.

Fetch a resource by its uid

Command to fetch a resource by its uid

curl -X GET "${BASE_URL}/applicationmgmt/v2/resources/ec37c45a7f4e5b0e56cee4e203be5b84_kube-system_k8sDeployment_oidcclient-watcher?field=uid" \
  -H "Authorization: ${ACCESS_TOKEN}" \
  -H "X-TenantID: $ACCOUNT_ID"

Output

{"uid":"ec37c45a7f4e5b0e56cee4e203be5b84_kube-system_k8sDeployment_oidcclient-watcher","_executionTime":17}