Create monitors
StackState Self-hosted v5.1.x
Last updated
StackState Self-hosted v5.1.x
Last updated
Monitors can be attached to any number of elements in the StackState topology to calculate a health state based on 4T data. Each monitor consists of a monitor definition and a monitor function. Monitors are created and managed by StackPacks, you can also create custom monitors and monitor functions outside of a StackPack without having to modify any configuration.
The example on this page creates a CPU metric monitor using an example monitor function.
➡️
To create the example CPU metric custom monitor in StackState we will:
You can place multiple monitors on the same STJ file. You can also add other node types on the same import file.
The invocation of the get
helper function will automatically resolve to the ID of the desired function during import time.
The parameters are different for each monitor function. In the case of Metric above threshold
we need to populate threshold
, metrics
and topologyIdentifierPattern
:
Similar to the function
, parameters can be referred to by utilizing the get
helper function.
This can be achieved by using the dedicated StackState CLI command:
From StackState v5.0, the old sts
CLI has been renamed to stac
and there is a new sts
CLI. The command(s) provided here are for use with the new sts
CLI.
An alternative way is to include the newly created monitor in a custom StackPack and installing it.
You can check if your monitor is working correctly by invoking the CLI command:
From StackState v5.0, the old sts
CLI has been renamed to stac
and there is a new sts
CLI. The command(s) provided here are for use with the new sts
CLI.
You can also preview the results it generates by invoking the CLI command:
From StackState v5.0, the old sts
CLI has been renamed to stac
and there is a new sts
CLI. The command(s) provided here are for use with the new sts
CLI.
➡️
A monitor node of type Monitor
needs to be added to the import file. This type of node is supported in API version 1.0.39 and above. The required fields are the name
, identifier
and description
. The identifier
should be a value that uniquely identifies this specific monitor definition. intervalSeconds
, function
and determine what validation rule and how often it's run. An optional parameter of remediationHint
can be specified - it's a Markdown-encoded instruction of what to do if this monitor produces an unhealthy health state. It's displayed on the interface together with the monitor result panel.
Configuring the monitor function is best done by utilizing the paired with the identifier
of the function itself. In this example the function is named Metric above threshold
and its identifier is urn:system:default:monitor-function:metric-above-threshold
.
➡️
For further details of defining arguments in the monitor definition and how to work with commonly used parameters such as a metrics query or topology identifier, see .
➡️
➡️
➡️