---
sourceDocument: Xanadu IT Operations Management
sourceDocumentLink: https://www.servicenow.com/docs/r/xanadu/it-operations-management

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu IT Operations Management

ft:clusterId :

    - itom

bundleId :

    - itom

workflow :

    - Technology


---

# Create a self-health monitor to use custom health monitor script

# Create a self-health monitor to use custom health monitor script {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 4 minutes to read

You can create a self-health monitor to use custom health monitor script to monitor
specified Event Management
components.

## Before you begin

Role required: evt_mgmt_admin

## About this task

To augment the self-health monitors that are provided with the base system, you can create a self-health monitor to monitor the components that you specify. The health monitor scripts that are provided with the base system are listed in the following table. {#custom-configure-threshold-monitoring__table_d5c_tz4_4cb__entry__2}

| Health monitor script | Used by a monitor to: |
|-|-|
| Check delay in event processing | Monitor the duration of events \[in minutes\] that remain in Ready state and are not processed. |
| Connectors Monitor | Monitor: * Whether the time that a connector in idle state surpassed the threshold \[in minutes\] configured. * The active status of connectors. {#custom-configure-threshold-monitoring__ul_o21_qm2_scb} |
| Get Event Processing state | Monitor the time that events are in Ready state. Alerts are sent when this time exceeds the threshold. |
| MID Server Threshold Alerts | Monitor MID Server health. Events are sent when changes in MID Server state are detected. |
[Table 1. Health monitor scripts provided with the base system]

{#custom-configure-threshold-monitoring__table_d5c_tz4_4cb}You can create alert management rules to respond to and remediate the issues detected by self-health. Alerts are generated based on the specified severity and threshold. Navigate to Event ManagementAdministrationSelf-Health Monitoring for the monitors that are provided with the base instance to monitor the issues detected by self-health, which are:{#custom-configure-threshold-monitoring__table_z5y_qkq_1fb__entry__2}

| Monitor | Description |
|-|-|
| Connector's idle state monitoring | Monitor to verify whether any of the connectors were in idle state that surpassed the threshold \[in minutes\] that was configured. Health Monitor script selected: <kbd class="ph userinput">Connectors Monitor</kbd>. |
| Connectors Status | Monitor to track the active status of the connectors. Select only one threshold to configure which severity to invoke using 1 to select the threshold field or 0 to ignore the threshold field. For more information, see [Connector status example](https://www.servicenow.com/docs/HPeC~4kReT4XzOkTAFuq8g#configure-threshold-monitoring__threshold-example). Health Monitor script selected: <kbd class="ph userinput">Connectors Monitor</kbd>. |
| Delay in event processing | Monitor to track the duration of events \[in minutes\] that remain in Ready state and were not processed. This duration period initiates an alert for the event processing CI with severity according to the configured thresholds \[minutes\]. Health Monitor script selected: <kbd class="ph userinput">Check delay in event processing</kbd>. |
| Event Processing job | Monitor the state of the event processing jobs. An alert is generated when the idle time of a job exceeds the configured threshold. Health Monitor script selected: <kbd class="ph userinput">Get Event Processing state</kbd>. |
| MID Server MID Server Threshold Alerts | Monitor MID Server MID Server health. Events are sent when issues with MID Server availability and resource thresholds are detected. Health Monitor script selected: <kbd class="ph userinput">MID Server Threshold Alerts</kbd>. |
[ ]

{#custom-configure-threshold-monitoring__table_z5y_qkq_1fb}  
Note:  
To prevent a self-health monitor from detecting the connector status, at any time you can clear the Active check box of the monitor and then click Update.

## Procedure

1. Navigate to Event ManagementAdministrationSelf-Health Monitoring, and click New.
2. On the form, fill in the fields.  
   {#custom-configure-threshold-monitoring__table_xms_j2p_4cb__entry__2}

   | Field | Description |
   |-|-|
   | Name | Descriptive and meaningful name for the monitor. |
   | Description | Text narrative that describes the monitor. |
   | Active | Check box to enable the monitor. |
   | Monitoring job frequency \[seconds\] | Frequency that the monitoring job should run. Default: <kbd class="ph userinput">120</kbd> seconds. |
   | Last Run | Last run date and time. These values are automatically updated. |
   | Script | Monitoring script. Click the search icon. The existing scripts are listed in the Health Monitor Scripts screen, or click New to create a custom health monitor script. For more information about creating a custom health monitor script, see step [3](https://www.servicenow.com/docs/Uu~L9yBuzc7WV2orHor~2A#custom-configure-threshold-monitoring__step_4_custom). |
   | Note: Regarding all the following threshold configuration fields: All monitored values are compared against the thresholds. If a monitored value exceeds a threshold, an alert with the appropriate severity is issued. ||
   | Critical Threshold | Any point above the value is considered a critical consequence. |
   | Major Threshold | Any point above the value, but below the value of the Critical Threshold, is considered a major consequence. |
   | Minor Threshold | If exceeded, the value is considered a minor consequence. |
   | Warning Threshold | If the value is exceeded, a warning is issued. |
   | Additional information | Further information about the monitor. |
   [Table 2. Monitoring Configuration form]

   {#custom-configure-threshold-monitoring__table_xms_j2p_4cb}
3. To create a custom health monitor script, on the Monitoring Configuration form, next to the Script field, click the search icon to open the Health Monitor Scripts form, and click New. {#custom-configure-threshold-monitoring__step_4_custom}
{#custom-configure-threshold-monitoring__step_4_custom}
4. On the form, fill in the fields.  
   {#custom-configure-threshold-monitoring__table_w34_sg2_2fb__entry__2}

   | Field | Description |
   |-|-|
   | Active | Check box to enable the monitor. |
   | Description | Text narrative that describes the custom script. |
   | Name | Descriptive and meaningful name for the custom script. |
   | Script | Custom script to run when called from a monitor. A script template is provided as a guide. You can use the [Health monitor scripts provided with the base system](https://www.servicenow.com/docs/Uu~L9yBuzc7WV2orHor~2A#custom-configure-threshold-monitoring__table_d5c_tz4_4cb) as examples of how to author the script, and use the [script editor tools](https://www.servicenow.com/docs/access?context=c_SyntaxEditor&version=xanadu&pubname=xanadu-application-development&ft:locale=en-US). Ensure that the custom script includes: Run the monitor function, which is called according to the "monitoring job frequency" setting runUpdateHealthMonitorScripts(scriptId). Add this function to run the monitoring logic. Specify the configuration function that is called every hour runInsertHealthMonitorScripts(scriptId). Add the configuration logic and add a CI if needed. In the navigation pane search field, enter <kbd class="ph userinput">em_monitor_state.list</kbd>. In the Monitoring States \[em_monitor_state\] table, specify the initialization of the monitor record in the required record. Use the helper functions defined in EvtMgmtHealthMonitorCommon and EvtMgmtEventAlertGenerator script includes: * EvtMgmtHealthMonitorCommon * healthMonitorCommon.shouldRun * healthMonitorCommon.calculateSeverity * EvtMgmtEventAlertGenerato * openAlert * closeAlert {#custom-configure-threshold-monitoring__ul_ggm_tx2_2fb} |
   [Table 3. Health Monitor Script form]

   {#custom-configure-threshold-monitoring__table_w34_sg2_2fb}

   You can use the Monitoring Configurations \[em_monitor_conf\] table for
   self-health monitoring configuration, the Health Monitor Scripts
   \[em_monitor_scripts\] table for scripts, and Monitoring States
   \[em_monitor_state\] table for displaying the results of the monitor, as
   initialized inside runInsertHealthMonitorScripts.

   For more information about script includes and APIs, see:Script includes that
   are [installed with Event Management](https://www.servicenow.com/docs/9q~MmSizLEI3OO5Ma_135g#r_InstalledWithEventManagement "Activating the Event Management (com.glideapp.itom.snac) plugin adds several roles, scheduled jobs, and tables.")
5. Click Submit.

## Result

To monitor the Event Management components that you specify, you can configure a self-health monitor that uses the custom health monitor script that you created.

*[\>]: and then


