|
| 1 | +Key features |
| 2 | +Automatic problem creation: The script uses a GlideAggregate query to count the number of incidents opened for a specific CI. |
| 3 | +Time-based threshold: Problems are only created if more than five incidents are opened within a 60-minute window. |
| 4 | +Targeted incidents: The script focuses on incidents related to the same CI, making it effective for identifying recurring infrastructure issues. |
| 5 | +Customizable conditions: The number of incidents and the time frame are easily configurable within the script. |
| 6 | +Efficient performance: The use of GlideAggregate ensures the database is queried efficiently, minimizing performance impact. |
| 7 | + |
| 8 | +How it works |
| 9 | +The script is designed to be executed as a server-side script, typically within a Business Rule. When an incident is inserted or updated, the script performs the following actions: |
| 10 | +Queries incidents: It executes a GlideAggregate query on the incident table. |
| 11 | +Sets conditions: The query is filtered to count all incidents that meet the following conditions: |
| 12 | +Same CI: The incident's cmdb_ci matches the cmdb_ci of the current record. |
| 13 | +Within the last hour: The opened_at time is within the last 60 minutes. |
| 14 | +Evaluates count: After the query is run, the script checks if the count of matching incidents exceeds the threshold (in this case, 5). |
| 15 | +Creates problem: If the threshold is exceeded, a new problem record is initialized. |
| 16 | +The short_description is automatically populated with a descriptive message. |
| 17 | +The cmdb_ci is linked to the new problem record. |
| 18 | +The new record is then inserted into the database. |
| 19 | +Implementation steps |
| 20 | +Create a Business Rule: |
| 21 | +Navigate to System Definition > Business Rules. |
| 22 | +Click New. |
| 23 | +Configure the Business Rule: |
| 24 | +Name: Auto Create Problem from Multiple Incidents |
| 25 | +Table: Incident [incident] |
| 26 | +Advanced: true |
| 27 | +When to run: Select after and check the Insert and Update checkboxes. This ensures the script runs after an incident has been saved. |
| 28 | +Filter conditions: Optionally, you can add conditions to limit when the script runs (e.g., cmdb_ci is not empty). |
| 29 | +Add the script: |
| 30 | +Navigate to the Advanced tab. |
| 31 | +Copy and paste the script into the Script field. |
| 32 | +Customize (optional): |
| 33 | +Number of incidents: Change the > 5 value to adjust the threshold. |
| 34 | +Time frame: Adjust the gs.minutesAgoStart(60) value to change the time window. |
| 35 | +Other conditions: If you need to check for specific incident statuses or categories, add more addQuery lines to the GlideAggregate call. |
| 36 | +Save the Business Rule. |
| 37 | +Customization examples |
0 commit comments