Skip to main content
Skip table of contents

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:

    CODE
    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 <scope>

      • offset - three <scopes> ago

      • specific <scope>

  7. Click any of the links under the columns labeled API link (<format>) 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:

Parameter

Description

Default value

metric

UID of the desired metric

(none)

hierarchy

Name of a hierarchy

The name of the first hierarchy in the Portal

scope

The

  • day

  • week

  • month

  • quarter

day

period

The period depends on the scope defined.

  • ISO 8601 compatible format:

    • For day: 2017-10-22

    • For week: 2017-W22

    • For month: 2017-03

    • For quarter: 2017-Q1

  • Relative expressions using now:

    • If scope=day, now - 2 is two days ago.

  • If scope=day, yesterday

  • If scope=week, last week

  • If scope=month, last month

  • If scope=quarter, last quarter

path

Name of a node in the hierarchy to limit the output. Chain several path elements to limit the output further down in the hierarchy levels.

The highest node in the view domain of the user

format

Output format, one of:

  • table (for an HTML table)

  • json

  • csv

table

Example of a query URL:

CODE
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:

CODE
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:

Output data

Description

Period

The value of the period selected as input. The column is labeled with the associated scope:

  • Date

  • Week

  • Month

  • Quarter

Hierarchy

The name of the hierarchy selected as input parameter.

Hierarchy nodes

The chain of nodes specified as path parameters in the input, where each node is displayed on a separate column that has the label of the corresponding hierarchy level.

Display fields

The attributes of the objects that constitute the details of the count metric and specified as display fields in the definition of the metric. Each value is displayed in a separate column and labeled with the name of the attribute.


RELATED TASKS

RELATED REFERENCE

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.