Acknowledge Solarwinds alert by email

Version 3

    This Powershell script allows end users to acknowledge or comment upon a Solarwinds alert via email. The script assumes that your organization uses Exchange as its email platform.

     

    Prerequisites:

    • An email account ("the email account") for the default reply-to address used by your Solarwinds installation. This should be a dedicated account that isn't used by any other applications or users.
    • A Solarwinds individual account ("the Solarwinds account") that can acknowledge alerts. This account must have the following permissions in Solarwinds:
      • Allow alert management rights = yes
      • Allow account to disable actions = yes
      • Allow account to disable alerts = yes
      • Allow account to disable all actions = yes
      • Allow Account to Clear Events, Acknowledge Alerts and Syslogs = yes
    • MS Exchange Web Services Managed API installed on the server that will run the script. Download the script from the MS Download Center.

     

    Configuration:

    1. Edit the script as follows.
      1. Edit the line
        $exchangeEmail    = "solarwinds@mydomain.com"
        and replace "solarwinds@mydomain.com" with the address of the email account.

      2. Edit the line

        $exchangeUsername = "ORG-MYUNIT-Solarwinds"

        and replace "ORG-MYUNIT-Solarwinds" with the login name associated with the email account.
      3. Edit the line

        $exchangePassword = "ORG-MYUNIT-Solarwinds_password"
        and replace "ORG-MYUNIT-Solarwinds_password" with the password for the email account.

      4. Edit the line
        $exchangeDomain  = "DOMAINNAME"
        and replace "DOMAINNAME" with the Active Directory domain name associated with the email account user.

      5. Edit the line

        $SWUsername = "Solarwinds_user"

        and replace "Solarwinds_user" with the user name of the Solarwinds account.
      6. Edit the line
        $SWPassword = "Solarwinds_users_password"
        and replace "Solarwinds_users_password" with the password of the Solarwinds account.

      7. Edit the line
        $SWServer = "solarwinds.mydomain.com"
        and replace "solarwinds.mydomain.com" with the fully-qualified domain name or IP address of your Solarwinds server

    2. Copy the script to your Solarwinds server. You can run the script from the Powershell IDE to test it.
    3. Configure a task manager job to run the script at the desired interval. I run it once per minute to ensure that acknowledgement/comment emails are processed quickly enough to satisfy my end users.

     

    Use:

    This script assumes that the first word in the email message is a command verb such as ack or comment. Any text between the command and a return and/or newline character(s) is treated as a comment, and it will be appended to the alert in Solarwinds.

     

    Message syntax:

    At minimum, the email message must contain these elements, formatted as described below. These elements can appear anywhere in the message body.

    Alert definition ID: A GUID in brackets, formatted like this:</>

        [AlertDefinition=D1A5279D-B27D-4CD4-A05E-EFDD53D08E8D]

    Object ID: A string of digits, in brackets, formatted like this:

        [ObjectID=99999]

    Object Type: A string representing a valid Solarwinds object type, formatted like this:

        [ObjectType=APM: Application]

     

    Commands:

    The command must be the first word in the message body.

    ack:    Acknowledge the alert and append a comment if one is supplied.

    comment: Append a comment to the alert

     

    Comments:

    Comments are optional. Any text between the command verb and a newline or return character will be treated as a comment. There are no formatting requirements for comments.

     

    Example 1:

    This message would acknowledge an alert and append a comment.

     

        Ack Kurt is looking into this

        ~~~~~~~~~~~~~~~~~~~~~

        Me, Senior Systems Administrator

        ~~~~~~~~~~~~~~~~~~~~~~

        From: Solarwinds

        Sent: Friday, October 02, 2015 12:33 PM

        To: Me <me@myemail.com>

        Subject: Solarwinds Alert: Oracle database disk utilization KURTSDB on Node kurtsserver.mydomain.com is Down

     

        When replying, type your text above this line

        ________________________________________

     

        To acknowledge this alert, click here or reply to this message with "ack" as the first word in the body.

     

        Alert details:

        Oracle database disk utilization KURTSDB on Node kurtsserver.mydomain.com is Down at Friday, October 2, 2015 12:32 PM.

     

        When replying, do not delete text below

        ________________________________________

     

        [AlertDefinition=535d1493-a543-4df0-acbf-6b43770aceeb] [ObjectID=1271][ObjectType=APM: Application]

     

     

    Example 2:

    This message would also acknowledge an alert and append a comment

     

        Ack  Third alert comment from ME

        [AlertDefinition=535d1493-a543-4df0-acbf-6b43770aceeb] [ObjectID=673] [ObjectType=APM: Application]