> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flexagon.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Health Monitoring

> Health Monitoring allows the configuration of Alerts to monitor specific metrics related to the health of the FlexDeploy application. Available metric

### Health Monitoring allows the configuration of **Alerts** to monitor specific metrics related to the health of the FlexDeploy application. Available metrics vary from resource consumption to execution statistics.

## Alert Definitions

Health Monitoring is driven through the configuration of Alerts. Each Alert monitors a metric that is measured at regular intervals with the Condition script being evaluated each interval and triggering Alert Notifications if appropriate.

![image-20250403-181305.png](https://mintcdn.com/flexagon-llc-ce77a95c/NkeZh5D-Nf8j_WaD/images/fd111/12590922172.png?fit=max\&auto=format\&n=NkeZh5D-Nf8j_WaD\&q=85\&s=16c49f9bb398d302635f62c93c2b9d61)

Each Alert Definition consists of:

* **Active** - Whether the alert is active or inactive. Inactive Alerts will still be displayed in the table but will not monitor or send any notifications.

* **Metric** - The specific metric that will be monitored in this Alert. See [below](#) for a complete list of metrics.

* **Condition** - Each metric will produce a unique set of results during a monitoring window. The Condition script can evaluate these results via the `results` variable and return `true` if an alert should be triggered. The script can also return a text value or string, which will trigger an alert with the text value in the alert message. See [Editing Alerts](#) below for a more in depth look at the Condition script.

* **User Recipients** - Specific Users that notification alerts should be sent to.

* **Group Recipients** - Specific FlexDeploy Groups that notification alerts should be sent to.

### Adding Alerts

To add a new Alert, simply click the ![(blue star)](https://flexagon.atlassian.net/wiki/s/-510684821/6452/64e1779b1cc4eed32fd26c0f5af1f87b02d05b81/_/images/icons/emoticons/72/2795.png) **ADD ALERT** button.

![image-20250403-184258.png](https://mintcdn.com/flexagon-llc-ce77a95c/NkeZh5D-Nf8j_WaD/images/fd111/12590922175.png?fit=max\&auto=format\&n=NkeZh5D-Nf8j_WaD\&q=85\&s=fa649b8c76a80972f66f06a1e17e9b26)

This will insert a new row into the table where it can be configured.

![image-20250403-184332.png](https://mintcdn.com/flexagon-llc-ce77a95c/NkeZh5D-Nf8j_WaD/images/fd111/12590922181.png?fit=max\&auto=format\&n=NkeZh5D-Nf8j_WaD\&q=85\&s=35ea940a0e7826599408737787c5d10b)

After entering all required values, denoted by the **\*** in the column headers, click the save :save: button.

#### Alert Templates

Several Alert Templates are available that provide quick configuration for common scenarios in Alert monitoring. To select a template click the ![(blue star)](https://flexagon.atlassian.net/wiki/s/-510684821/6452/64e1779b1cc4eed32fd26c0f5af1f87b02d05b81/_/images/icons/emoticons/72/2795.png) **ADD TEMPLATE ALERT** button.

![image-20250404-133756.png](https://mintcdn.com/flexagon-llc-ce77a95c/NkeZh5D-Nf8j_WaD/images/fd111/12590922178.png?fit=max\&auto=format\&n=NkeZh5D-Nf8j_WaD\&q=85\&s=64b71f51e289578f287d6c6e0c0d931f)

Each template provides any number of inputs that need to be specified. After confirming your inputs, click the **ADD** button. The template alert will automatically create an Alert Definition with the metric and condition script pre-populated. Simply add your recipients and save :save: the Alert.

### Editing Alerts

To edit an existing Alert, click the edit :Pencil\_Edit: button or right click and select **Edit** from the context menu. This will enable the row for editing.

![image-20250404-134905.png](https://mintcdn.com/flexagon-llc-ce77a95c/NkeZh5D-Nf8j_WaD/images/fd111/12590922184.png?fit=max\&auto=format\&n=NkeZh5D-Nf8j_WaD\&q=85\&s=fe102abfa05bf6bb520b9a03bb6d5065)

Make any necessary changes to the Alert and click the save :save: button when finished.

#### Editing the Alert Condition

The Alert Condition script should return 1 of 3 things:

* `return true` - Triggers an alert notification. The notification by default will display the results found during the monitoring period

* `return false` - Does not trigger an alert

* `return "More Details"` - Triggers an alert with a custom message “More Details”. The results during the monitoring period will still be included in the notification.

There are several variables available that can be used by the Condition script to determine if an alert should be triggered:

<table><colgroup><col /><col /></colgroup><tbody><tr><th>**Variable**</th><th>**Description**</th></tr><tr><td>results</td><td>The object containing the results measured during the monitoring window. Each results object contains `results.getMeasuredAt()` which returns a datetime when the measurement occurred. Apart from `getMeasuredAt` each results object contains different information depending upon the Metric being measured.</td></tr><tr><td>previousResults</td><td>An identical object to the `results` object but contains results for the previous measuring window.`previousResults` is wrapped in an Optional object as it may not be present during the first monitoring window\.Accessing `previousResults` should be done like the following:<pre>if(previousResults.isPresent())
\{
previousResults.get().getMeasuredAt()
}</pre>Or alternatively<pre>if(!previousResults.isPresent()) return false
def previous = previousResults.get()
// previous can now be access safely and freely just like results</pre></td></tr><tr><td>MONITORING</td><td>A helper library that provides any common functions for use within Condition scripts.</td></tr></tbody></table>

> [!NOTE]
>
> Keep in mind that adding an Alert from a template can be used as a starting point. The template will generate a sensible default Condition script that can be modified as needed.

### Deleting Alerts

To delete an Alert, click the delete :delete: button. This cannot be undone, if you would only like to temporarily stop Alert notifications, consider inactivating the Alert instead.

![image-20250404-150633.png](https://mintcdn.com/flexagon-llc-ce77a95c/NkeZh5D-Nf8j_WaD/images/fd111/12590922187.png?fit=max\&auto=format\&n=NkeZh5D-Nf8j_WaD\&q=85\&s=edd1c122033aabf9acbb3e970b33b715)

## Configuration and Metrics

Each Alert is monitoring a specific “Metric” that is measured at regular intervals. This interval is customizable by Metric on the **Configuration** tab.

![image-20250404-150904.png](https://mintcdn.com/flexagon-llc-ce77a95c/NkeZh5D-Nf8j_WaD/images/fd111/12590922190.png?fit=max\&auto=format\&n=NkeZh5D-Nf8j_WaD\&q=85\&s=5be2355ffe6768d7942a99f4105addcb)

> [!NOTE]
>
> Metric intervals can only be in increments of 5 minutes, for example 5, 10, 15 etc.

## Customizing Notifications

Each Alert will trigger a notification when the Condition script returns 1 of the following 2 values

* `return true`

* `return "some custom message"`

Each notification will be default include a table of the metric results during the measuring window. An example can be seen below for the **High CPU Time** Alert template.

![image-20250404-151715.png](https://mintcdn.com/flexagon-llc-ce77a95c/NkeZh5D-Nf8j_WaD/images/fd111/12590922193.png?fit=max\&auto=format\&n=NkeZh5D-Nf8j_WaD\&q=85\&s=ab9c4591fdfaa3675fb94d0793745132)

Notifications can be customized by changing the text/string return value in the Condition script or by creating a custom Notification Template for the **Health Metric Alert** event.

See [Notification Templates](https://docs.flexagon.com/flexdeploy-11-2-documentation/flexdeploy-users-guide/administration/notification-templates.md) for more information.
