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:
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.
Select a metric from the table.
Select an available hierarchy.
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.
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).
Under Select scope choose among:
day
week
month
quarter
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
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:
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 |
period | The period depends on the scope defined.
|
|
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 |
Example of a query URL:
The Count Metrics API uses Basic Authentication. To test the API from a Nexthink appliance, you can use curl
, for instance:
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:
|
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
Last updated