View health state configuration functions
This page describes StackState version 4.3.
The StackState 4.3 version range is End of Life (EOL) and no longer supported. We encourage customers still running the 4.3 version range to upgrade to a more recent release.
Overview
A view health state configuration function is a user defined script that takes user parameters and has access to a viewSummary
variable that can be used to get summary information on the (states of) the components and relations in the view.
Create a custom view health state configuration function
To create, update or delete a view state configuration, go to Settings -> Functions -> View Health State Configuration Functions.
A view health state configuration function receives a viewSummary
as well as any User parameters named in the function. It needs to return value from the viewHealthStates
enum - one of UNKNOWN
, CLEAR
, DEVIATING
or CRITICAL
.
Available properties and methods
The viewSummary
is available to all view health state configuration functions and gives access to the following methods:
countHealthState
A count of all components with a specified state. See countHealthState and countPropagatedHealthState.
countPropagatedHealthState
A count of all elements with a specified propagated state. See countHealthState and countPropagatedHealthState.
viewSummary
A list of the states of all elements in the view. See ElementState.
countHealthState and countPropagatedHealthState
The methods countHealthState
and countPropagatedHealthState
return a count of all components in the view with a specified state. For example:
Note that countPropagatedHealthState
will return a count of all elements with a specified propagated state. As both the originating component and all relations have a propagated health state these will be included in the returned count. This means that a DEVIATING propagated health state count of a view with one deviating component will be three. Two for the components (originating and propagated) and one for the relation.
In the script example below, minCriticalHealthStates
and minDeviatingHealthStates
are user parameters. These are named in the view health state configuration function and set by the user when the view health state is configured.
ElementState
The states of all components and relations in the view can be accessed as a list from viewSummary
using ElementState
. ElementState
has the following properties:
elementId
stateId
name
layer
domain
A list of
environments
A list of
labels
Element
type
healthState
propagatedHealthState
This can be used to query particular elements in the view. In the example below, a CRITICAL state will be returned if any component of type DB reports a DEVIATING state. In all other cases a CLEAR state will be returned:
See also
Last updated