Count metrics API

Overview

Count metrics let you measure the number of objects that satisfy a particular set of conditions every day. To integrate data of count metrics with external systems, the Portal provides an API to query the details of count metrics. The details of count metrics list the objects that took part in the count, along with any additional display fields that were selected for the metric.

The client of the Count Metrics API must trust the certificate in the primary Appliance (the Portal).

To authenticate the client, the Count Metrics API uses Basic Authentication. Nexthink recommends creating a local account to exclusively authenticate clients of the API.

Finding out available metrics

To interactively look for the details of count metrics that are available through the API:

  1. Point a web browser to the following address:

    https://<Portal_DNS_FQDN>/api/metrics/v1​
  2. Log in to the discovery tool of the API as a user with the right to see count metrics (either because the user can see all metrics or because the metric is part of a module that is included in the roles of the user).

    • Type in the user credentials whenever asked by the web browser.

    • The discovery tool displays only the available metrics in the view domain of the user.

    • Depending on the data privacy settings of the user, the names and other identifying attributes of the objects in the details of the count metrics may be anonymized.

  3. Select a metric from the table.

  4. Select an available hierarchy.

  5. Optional: Select a node (in the Select Path column) to restrict the output to a node of the hierarchy. Repeat for each level of the hierarchy.

  6. Optional: To select particular time scope, click the link under the Scopes column. The choice of scope is also displayed when you navigate down the hierarchy and you reach the lowest level (the Entity level).

    1. Under Select scope choose among:

      • day

      • week

      • month

      • quarter

    2. Depending on the selected scope, choose the Period. To retrieve data from the past, ensure that you reserved enough disk space for the details of count metrics. Three options which demonstrate the three different ways of specifying a period are available:

      • default period - last

      • offset - three ago

      • specific

  7. Click any of the links under the columns labeled API link () to get the details of the count metric for the selected path, scope, and period. If you did not select any scope or period, the default values are applied (see table below in querying the API).

    • table (HTML table)

    • json

    • csv

Once you have reached the desired details of the metric, note down the URL built by the discovery tool to programmatically query the API later with the same request or use it as a base for your own requests.

Querying the API

To query the Count metrics API, send a GET request to a URL that includes the following parameters:

Example of a query URL:

https://<Portal_DNS_FQDN>/api/metrics/v1/details?​
metric=7bfae274-6c0d-406f-8c02-d1932fdf6e89&​
hierarchy=DefaultHierarchy&​
path=Europe&path=Switzerland&path=Lausanne&​
scope=day&​
period=2019-08-22​&
format=table

The Count Metrics API uses Basic Authentication. To test the API from a Nexthink appliance, you can use curl, for instance:

curl https://<Portal_DNS_FQDN>/api/metrics/v1/details?... -u username:password

Output of the Count Metrics API

The output of the API is similar to the details of count metrics that you can explore in the Portal.

Find below the complete list of outputs of the Count Metrics API:


RELATED TASKS

RELATED REFERENCE

Last updated