Home > Storage > Data Storage Essentials > Storage Resource Manager (SRM) > Dell SRM: Automating Incident Management in ServiceNow > SRM alert definition via external process action
The alert definition ServiceNow notification via external process contains filtered-entry and external-process-action components.
Figure 24. Alert definition with external process action
The filtered-entry component filters on alerts received by Mail Forwarder Adapter on the SRM PBE server, which is the listening socket for consolidated alerts. These alerts are written to the events database on the SRM PBE server and are candidates to be sent as notifications to external systems.
By default, all alerts are captured.
The external process component invokes a script stored on the SRM PBE server (/opt/APG/bin/srm-servicenow-https-post.sh).
Script arguments are processed by the script and posted to ServiceNow as request body in https post.
The Script (Command parameter from the preceding action configuration) is a mandatory field.
srm-pbe> chmod +x /opt/APG/bin/srm-servicenow-https-post.sh
#!/bin/bash
# get script arguments to construct curl https post
# example open alert: https://dev78342.service-now.com/api/653807/srm_alerts,Unity-A007_Pool_Test-Pool93_Threshold Exceeded,1,DURABLE,1623841270,Unity-A007,UnifiedArray,Pool,Test-Pool93,Unity-GenericEvent,Capacity,Storage pool Test-Pool93 has exceeded its critical threshold of 95%,true,N/A,N/A
# example close alert: https://dev78342.service-now.com/api/653807/srm_alerts,Unity-A007_Pool_Test-Pool93_Threshold Exceeded,1,DURABLE,1623841270,Unity-A007,UnifiedArray,Pool,Test-Pool93,Unity-GenericEvent,Capacity,Storage pool Test-Pool93 has exceeded its critical threshold of 95%,false,N/A,N/A
snow_uri=$(echo ${1} | sed 's/"//g') # https://dev78342.service-now.com/api/653807/srm_alerts
alertId=$(echo ${2} | sed 's/"//g') # Unity-A007_Pool_Test-Pool93_Threshold Exceeded
severity=$(echo ${3} | sed 's/"//g') # 1,2,3,4,5 or N/A
eventType=$(echo ${4} | sed 's/"//g') # DURABLE
timestamp=$(echo ${5} | sed 's/"//g' | awk '{print substr($0,1,10)}') # convert ms to s: 1623841270000 to 1623841270
systemName=$(echo ${6} | sed 's/"//g') # Unity-A007
systemType=$(echo ${7} | sed 's/"//g') # UnifiedArray
componentType=$(echo ${8} | sed 's/"//g') # Pool
componentName=$(echo ${9} | sed 's/"//g') # Test-Pool93
src=$(echo ${10} | sed 's/"//g') # Unity-GenericEvent
category=$(echo ${11} | sed 's/"//g') # Capacity
description=$(echo ${12} | sed 's/"//g') # Storage pool Test-Pool93 has exceeded its critical threshold of 95%.
active=$(echo ${13} | sed 's/"//g') # true or false
acknowledged=$(echo ${14} | sed 's/"//g') # yes or no or N/A
owner=$(echo ${15} | sed 's/"//g') # string or N/A
curl "${snow_uri}" \
--request POST \
--header "Accept:application/json" \
--header "Content-Type:application/json" \
--data "{
\"alertId\":\"${alertId}\",
\"severity\":\"${severity}\",
\"eventType\":\"${eventType}\",
\"timestamp\":\"${timestamp}\",
\"systemName\":\"${systemName}\",
\"systemType\":\"${systemType}\",
\"componentType\":\"${componentType}\",
\"componentName\":\"${componentName}\",
\"source\":\"${src}\",
\"category\":\"${category}\",
\"description\":\"${description}\",
\"active\":\"${active}\",
\"acknowledged\":\"${acknowledged}\",
\"owner\":\"${owner}\"
}" > /opt/APG/srm-servicenow.log 2>&1
The script arguments (Command parameters from the preceding action configuration) are comma-separated.
<snow_uri>,PROP.'Name',PROP.'severity',PROP.'eventtype',PROP.'OpenedAt',PROP.'device',PROP.'devtype',PROP.'parttype',PROP.'part',PROP.'Source',PROP.'category',PROP.'fullmsg',PROP.'active',PROP.'acknowledged',PROP.'owner'
<snow_uri>: ServiceNow URI (example: https://dev78342.service-now.com/api/653807/srm_alerts)
PROP.'Name': unique alert name (example: Unity-A007_Pool_Test-Pool93_Threshold Exceeded)
PROP.'severity': alert severity (1,2,3,4,5 or N/A)
PROP.'eventtype': DURABLE or MOMENTARY
PROP.'OpenedAt': timestamp in seconds
PROP.'device': device name (example: Unity-A007) or N/A
PROP.'devtype': device type (example: Array, FabricSwitch, Host, VirtualMachine) or N/A
PROP.'parttype': part type (example: LUN, Disk, Port, FileSystem) or N/A
PROP.'part': part name (example: LUN123, Disk567, Port323, /storage/log) or N/A
PROP.'Source': collector name (example: VxRail-Collector, Huawei-Oceanstor) or N/A
PROP.'category': Capacity, Performance, Availability, Error, Configuration, Miscellaneous, Environment or N/A
PROP.'fullmsg': alert description (example: Storage pool Test-Pool93 has exceeded its critical threshold of 95%) or N/A
PROP.'active': true or false
PROP.'acknowledged': yes or no or N/A
PROP.'owner': string or N/A
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AlertingConfig xmlns="http://www.watch4net.com/Alerting">
<definition-list name="Examples/ServiceNow notification via external process" enabled="false" hidden="false" id="2688140534343879">
<description>Alert notification definition for sending https post</description>
<entry-point-list>2688140191502579</entry-point-list>
</definition-list>
<entry-point-list id="2688140191502579">
<name>ServiceNow notification filter</name>
<class>com.watch4net.alerting.operation.FilteredEntryPoint</class>
<filter>adapterName=='Mail Forwarder Adapter'</filter>
<description>ServiceNow notification entry point</description>
<action-list from="output" to="entry">2688140191724393</action-list>
</entry-point-list>
<action-list id="2688140191724393">
<name>SRM https post via curl to ServiceNow</name>
<class>com.watch4net.alerting.action.ExternalProcessAction</class>
<description>External script contains curl cmd with http post</description>
<param-list name="command">/opt/APG/bin/srm-servicenow-https-post.sh</param-list>
<param-list name="parameters"><snow_uri>,PROP.'Name',PROP.'severity',PROP.'eventtype',PROP.'OpenedAt',PROP.'device',PROP.'devtype',PROP.'parttype',PROP.'part',PROP.'Source',PROP.'category',PROP.'fullmsg',PROP.'active',PROP.'acknowledged',PROP.'owner'</param-list>
</action-list>
</AlertingConfig>
The alert definition ServiceNow notification via external process appears under the selected folder:
Figure 27. Alert definition with external process action in folder
From the moment of alert definition enablement, incidents are created, updated, closed, and reopened in ServiceNow based on SRM alerts.