Slack Notify perl script

Version 2

    A Perl script that i use as an AlertAction (Execute Program);

    it rate-limits to 1 message/5 second (and discards any messages sent in the 5 seconds)

     

    I like to re-use actions, so below is what the alert action is defined as -- note it pulls 'Alert Message' from the alert itself

    c:\Perl64\bin\perl.exe c:\full_path\ServerScripts\SWslack-notify.pl -p ${N=Alerting;M=Severity} -t "${N=Alerting;M=AlertMessage}" -H ${Caption} -D "${N=Alerting;M=AlertDetailsUrl}"

     

    The Alert Severity determines if we get a one-like post (e.g. an interface down) or a multiline message with attached content.

     

    The Message comes from the Trigger action tab on the alert, and typically looks something like:

    Node Down ${N=SwisEntity;M=CustomProperties.Sector} ${N=SwisEntity;M=Caption} ${N=SwisEntity;M=CustomProperties.Building}

     

    I set this to trigger 10 minutes after the alert itself fires the main actions (e.g. create Ticket) and only if not acknowledged. So this really acts as a reminder to NOC staff to check for alerts if they have been distracted by something else,

     

    ----

     

    Note: in Slack you will need to create your own app and generate the URL for the script to post you your chat rooms -- this is how slack does authentication and authorization. Ask slackbot for help on this step.

     

    Richard Letts