<h2>Alert Processing Explained</h2><br/><div style="overflow-x:auto"><div class="margin"> <h1 id="HEADING1"><span style="color: #000000;">Contents</span></h1> <ol style="list-style-position: inside;"><li style="color: #000000;"><a title="Overview" href="#HEADING1">Overview</a></li><li style="color: #000000;"><a title="What is an Alert?" href="#HEADING2">What is an Alert?</a></li><li style="color: #000000;"><a title="Alert Processing Flow" href="#HEADING3">Alert Processing Flow</a></li><li style="color: #000000;"><a title="The Alert States and Processing" href="#HEADING4">The Alert States and Processing</a></li><li style="color: #000000;"><a title="Additional Information" href="#HEADING5">Additional Information</a></li></ol> <h1 id="#HEADING1"><span style="color: #000000;">1. Overview</span></h1> <ul style="list-style-position: inside;"><li>This article will demonstrate details about what is an alert, how the alerts are created, handled by ServiceNow EM, processing life cycle, etc.</li></ul> <h1 id="#HEADING2"><span style="color: #000000;">2. What is an Alert?</span></h1> <ul style="list-style-position: inside;"><li>A notification to draw attention to one or more Events is what I call an <strong>Alert</strong>. Events trigger "alerts" to notify responsible parties to take actions before things go wrong. So the flow is as below</li></ul> <p style="padding-left: 120px;"><span style="color: #000000;">Data collection > Events > Alerts</span><br /><span style="color: #000000;">Lots of things > Some things > Few things</span><span style="background-color: #3366ff; color: #ffffff;"><br /></span></p> <ul style="list-style-position: inside;"><li>Any event that meets or exceeds defined condition/thresholds that require immediate attention/action by 'service providers' (sysadmins, DBAs, network engineers, product managers, service managers, service desk) are converted to alerts. </li><li>Please refer to <span style="color: #000000;"><a style="color: #000000;" title="Event Processing" href="/kb_view.do?sys_kb_id=298dae8bdbcf73402be0a851ca96199d">Event Processing</a></span> for more information on how the events are handled and processed.</li></ul> <h1 id="#HEADING3"><span style="color: #000000;">3. Alert Processing Flow</span></h1> <ul style="list-style-position: inside;"><li>The below diagram explains the alert processing flow based on different stages. <br /> </li></ul> <p style="padding-left: 80px;"><img style="border: 2px solid black; align: baseline;" src="sys_attachment.do?sys_id=40fe3b9adbab59105205e6be139619bb" width="743" height="410" align="baseline" border="2" /></p> <h3><span style="color: #000000;">Event Rules</span></h3> <ul style="list-style-position: inside;"><li>The event rule mechanism is used to categorize and process the event based on certain criteria. Each rule is defined has conditions like the source of event or maintenance state, etc.</li><li>If the condition is passed we either continue with processing the event or "Ignore the event".</li><li>The outcome of processing is an Alert. </li><li>Refer to <a title="Event Rules" href="https://docs.servicenow.com/bundle/madrid-it-operations-management/page/product/event-management/concept/create-event-rules.html">Event Rules</a> for more information on event rules.</li></ul> <h3><span style="color: #000000;">Alerts</span></h3> <ul style="list-style-position: inside;"><li>Post successful processing of events an alert record is generated.</li><li>The newly generated alert has 4 different states; Open, reopen, closed and flapping. </li><li>Each state has the execution flow which is explained in detail in the next section.</li></ul> <h3><span style="color: #000000;">Event to Alert Association:</span></h3> <ul style="list-style-position: inside;"><li>When an event is processed, system decides whether to create a new alert or get associated with the existing alert. This is decided by the value of the Message key. By default, each event is uniquely identified by the <span style="text-decoration: underline;"><strong>Message Key</strong></span>. </li><li>If the message of the event is the same as of any existing alert, the event gets associated with the alert else it will create a new Alert.</li><li>If an alert is closed then it reopens of the alert is dependent on the value defined in the "Active interval (in seconds), within which a new event reopens a closed alert" property present under Event Management properties.</li><li><strong><span style="text-decoration: underline;">If the Message Key is not populated</span></strong>, a concatenation of the <strong>Source</strong>, <strong>Type</strong>, <strong>Node</strong>, <strong>Resource</strong>, and <strong>Metric Name</strong> fields are used and these fields populate the Message Key. </li></ul> <h1 id="#HEADING4"><span style="color: #ff0000;"><span style="color: #000000;">4.</span> <span style="color: #000000;">The Alert States and Processing</span></span></h1> <ul style="list-style-position: inside;"><li>There are 4 alert states; Open, Closed, Reopen, and flapping. All these states have different execution flow and code associated. Below are the details of each state.</li></ul> <h3><span style="color: #000000;">Open</span></h3> <ul style="list-style-position: inside;"><li>The first stage in the processing of Alert is Open. When an event is processed successfully it creates an alert.</li><li>An alert is opened whenever an <span style="text-decoration: underline;">event is not ignored</span> or its <span style="text-decoration: underline;">threshold is exceeded</span> by an event rule, and <span style="text-decoration: underline;">de-duplication does not identify the event as belonging to an existing alert</span>.</li><li>These alerts are picked by the "<strong>Event Management - Evaluate Scoped Alert Rules Management</strong>" scheduled Job which is executed every 11 seconds</li><li>It calls the evalauteAlert() function of Script Include "EvtMgmtAlertManagementJob".</li><li>During the evaluation process, <a title="Alert Management" href="/kb_view.do?sys_kb_id=933c0d0bdbae33000be6a345ca961941">Alert Management</a> rules are used to filter the alerts and perform the remediation action accordingly.</li></ul> <p style="padding-left: 80px;"><span style="background-color: #ffffff; color: #000000;">Note</span> - Do not delete an open alert. Close an alert first and then delete it. Also note that info state alerts will close/resolve incidents currently the documentation does not reflect this but a documentation enhancement request has been submitted</p> <h3><span style="color: #000000;">Closed</span></h3> <ul style="list-style-position: inside;"><li>For an open alert if the Clear event is triggered then the corresponding alert associated is set to the "Closed" state.</li><li>Closing an alert also closes any related incident that is not already resolved or closed.</li><li>If there is no associated Incident, then no only state is changed to Closed and no further action is performed.</li></ul> <h3><span style="color: #000000;">Reopen</span></h3> <ul style="list-style-position: inside;"><li>When new additional events are generated which on processing finds existing closed alert then the alert is reopened. An alert can be reopened manually.</li><li>Reopening of existing closed alert by new events is controlled by property "<span style="text-decoration: underline;"><strong>evt_mgmt.active_interval</strong>"</span>.</li><li>By default value of this property is 14400 sec. This means that if an alert is closed and a new event is generated within 4 hours which matches the same message key then the existing alert is reopened.<br /><br /></li><li>When an alert is reopened, the related incident is processed as follows:<br /> <ul id="t_EMReopenAlert__ul_acy_kq4_1r" style="list-style-position: inside;"><li>If the incident is not Resolved or Closed, a work note is added to indicate that the related alert was reopened.</li><li>If the incident is Resolved or Closed, the incident is reopened, a new incident is created, or nothing is done, depending on the <strong>evt_mgmt.alert_reopens_incident property </strong>value.<br /> <ul id="t_EMReopenAlert__ul_fcy_kq4_1r" style="list-style-position: inside;"><li>If the incident is reopened, work notes are added to the incident.</li><li>If a new incident is created, any matching alert management rule, alert action rule, and task template apply to the incident.</li><li>If there is no matching alert rule or template, fields from the existing incident are copied to a new incident.</li></ul> </li></ul> </li><li>The business rule that gets executed post alert reopen is "<strong><span style="text-decoration: underline;">Reopen associated closed incident</span></strong>"</li><li>This BR calls for script include "<strong>EvtMgmtAlertManagementAlertReopenHandler</strong>" which again invoke the Alert Management process to find the correct rule and perform the remediation action.</li></ul> <h3><span style="color: #000000;">Flapping</span></h3> <ul style="list-style-position: inside;"><li>Flapping is a state when multiple open-closes events are generated for an associated closed alert. </li><li>The flapping state entry is determined using the value configured for "<strong>evt_mgmt.flap_interval</strong>" and "<span style="text-decoration: underline;"><strong>evt_mgmt.flap_frequency</strong></span>" .</li><li>An alert enters the flapping state when its <strong>current Flap Count</strong> value <span style="text-decoration: underline;">reaches or exceeds</span> the given <span style="text-decoration: underline;">evt_mgmt.flap_frequency property</span> value within the time period specified by the <span style="text-decoration: underline;">evt_mgmt.flap_interval</span> property.</li><li>There a scheduled Job "<strong>Event Management - close flapping alerts</strong>" which executes every 5 minutes and processes the flapping alerts.</li></ul> <h1 id="#HEADING5"><span style="color: #000000;">5. Additional Information</span></h1> <h3><span style="color: #000000;"><span style="font-size: 14pt;">Acknowledging Alert</span></span></h3> <ul style="list-style-position: inside;"><li>It denotes that the alert is known, and can temporarily be ignored.</li><li>Acknowledging the alert does not assign it to you, nor does it create a task like an incident or change request. It simply lets other operators know that you are aware of the issue. After you acknowledge it, you will take further action during the triage stage.</li></ul> <h3><span style="color: #000000;"><span style="font-size: 14pt;">Auto Closing Alert</span></span></h3> <ul style="list-style-position: inside;"><li>evt_mgmt.alert_auto_close_interval - An interval (in hours), within which open alerts will be automatically closed; Setting to 0 disables the feature.</li><li><span style="font-size: 13.3333px;">evt_mgmt.alert_closes_incident - Closing the alert will Resolve Incident or Close Incident or Do nothing.</span></li><li>evt_mgmt.alert_reopens_incident - Reopening alert will Create New Incident or Reopen Incident or Do nothing</li><li>evt_mgmt.incident_closes_alert - If true then resolving an incident closes the associated alerts, else no action will taken.</li></ul> <h3 style="text-align: left;"><span style="color: #000000;"><span style="font-size: 14pt;">Points to focus</span></span></h3> <ul style="list-style-position: inside; list-style-type: disc;"><li>Business rules created on alert tables should not take more than a few milliseconds. In place of using a business rule, consider if the same functionality can be achieved using a job.</li><li>Do not use business rules to associate an alert with a CI. Use event rules to do binding instead of using business rules.</li></ul> </div></div>