Slack - Alert Integration - Interface

Version 14

    This article shows how to setup this script as an alert action. Please take time to review the main overview article if you have not already done so: Slack Alert Integration - Overview. The main overview article contains information necessary to completely setup this script.

     

    Trigger Condition

    This script is specifically designed for interface based alerts.

    11.png

     

    My alert trigger condition is different than the one that comes out of the box. Instead of setting a hard percentage value for utilization, I added these values/variables that allow me to use the thresholds defined on the node itself.

    2016-05-09 08_30_26-Edit Alert - _ SMS_Slack Alert me of Interface issues (custom)_.png

     

    Trigger Action

    In the Trigger Actions I added 'Execute an External Program' action.

    6.png

     

    This is the full text in the 'Network path to external program' field.

    • C:\windows\system32\windowspowershell\v1.0\powershell.exe -ExecutionPolicy unrestricted -command "<C:\path\to\script>\Slack_Alert_Trigger_Action_Interface.ps1 '${N=SwisEntity;M=Node.DisplayName}' '${N=SwisEntity;M=InterfaceName}' '${N=SwisEntity;M=OutPercentUtilizationThreshold.IsLevel1State;F=TrueFalse}' '${N=SwisEntity;M=InPercentUtilizationThreshold.IsLevel1State;F=TrueFalse}' '${N=SwisEntity;M=OutPercentUtilizationThreshold.IsLevel2State;F=TrueFalse}' '${N=SwisEntity;M=InPercentUtilizationThreshold.IsLevel2State;F=TrueFalse}' '${N=SwisEntity;M=Outbps}' '${N=SwisEntity;M=Inbps}' '${N=Alerting;M=AlertDetailsUrl}' '${N=SwisEntity;M=Node.DetailsUrl} ' '${N=SwisEntity;M=DetailsUrl}' '${N=Alerting;M=AcknowledgeUrl}' '${N=Generic;M=DateTime;F=OriginalValue}'"

     

    **You will need to update the <C:\path\to\script> in the above line to the location that you have the script saved.**

     

    I'm passing in the following Orion variables:

    • Node Name: ${N=SwisEntity;M=Node.DisplayName}
    • Interface Name: ${N=SwisEntity;M=InterfaceName}
    • Transmit Warning Value Reached: ${N=SwisEntity;M=OutPercentUtilizationThreshold.IsLevel1State;F=TrueFalse}
    • Receive Warning Value Reached: ${N=SwisEntity;M=InPercentUtilizationThreshold.IsLevel1State;F=TrueFalse}
    • Transmit Critical Value Reached: ${N=SwisEntity;M=OutPercentUtilizationThreshold.IsLevel2State;F=TrueFalse}
    • Receive Critical Value Reached: ${N=SwisEntity;M=InPercentUtilizationThreshold.IsLevel2State;F=TrueFalse}
    • Interface Status: ${N=SwisEntity;M=Status}
    • Interface Transmit: ${N=SwisEntity;M=Outbps}
    • Interface Receive: ${N=SwisEntity;M=Inbps}
    • Alert Details Page: ${N=Alerting;M=AlertDetailsUrl}
    • Node Details Page: ${N=SwisEntity;M=Node.DetailsUrl}
    • Interface Details Page: ${N=SwisEntity;M=DetailsUrl}
    • Auto Acknowledge URL: ${N=Alerting;M=AcknowledgeUrl}
    • Orion Date/Time: ${N=Generic;M=DateTime;F=OriginalValue}

     

    Once that alert action is completed then copy it to Reset Actions.

     

    Finish editing the alert and you should be done.

     

    **Change Log**

    • 2016-03-18 : Initial release
    • 2016-03-22 : Removed Alert Name variable from alert action.
    • 2016-05-06 : Major overhaul. revamped message to Slack attachments for better formatting. Please also update your 'Network path to external program' in the alert action as some variables have been changed/added.
    • 2016-05-09 : Updated status calculations. Please also update your 'Network path to external program' in the alert action as some variables have been changed/added.

     

    If you find this useful feel free to rate this article.