4 Replies Latest reply on Oct 5, 2019 12:09 AM by Abhay Bhagat

    Integration of TrueSight with SLACK

    Abhay Bhagat
      Share This:

      Dear Experts ,

       

      Did anyone integrated TrueSight Operations Manager with Slack . Where work happens | Slack

       

      Let me know the feedback

       

      Regards

      Abhay

        • 1. Re: Integration of TrueSight with SLACK
          Brendan Murray

          Hi Abhay,

           

          It always helps if you specify the direction and type of integration you are looking for. I will assume you want to send events from TSOM into a Slack channel.

           

          I did this integration recently in a Proof of Concept using a Python script. The first step is to set up an incoming webhook in Slack using the Slack API. You can find the instructions for this here.

           

          Once you have the webhook set up, you can test it with a REST client like Postman. Once you are sure it is working, then you can modify the URL in the Python script in the attached zip file to use the URL for your webhook. (The URL currently in the script is just a placeholder.)

           

          The attached zip archive contains the following files:

           

          mc_actions.mrl - A Remote Action definition that allows a TrueSight Console operator to send an event to Slack on command.

          send_to_slack.cmd - A Windows command file wrapper for the send_to_slack Python script.

          send_to_slack.mrl - A new rule that sends events to Slack if they have "sendtoslack" in the mc_object slot.

          send_to_slack_v1.1.py - A simple Python 2.7 script that takes a small set of TSIM slot values from the Windows environment, formats them for Slack and posts the result to a Slack channel.

          TSOM Event Integration with Slack.docx - A Microsoft Word document that explains the integration in more depth.

           

          Note that this integration was built for TSIM running on Windows. You will need to make some minor changes if your TSIM server runs on Linux.

           

          Regards,

           

          Brendan

          2 of 2 people found this helpful
          • 2. Re: Integration of TrueSight with SLACK
            Abhay Bhagat

            Dear Brendan Murray

             

            Thanks for the script ,I tried the same today and got these error , I already installed python,requests but still these error , did you faced these while developing , any suggestion on how to fix these

             

            Traceback (most recent call last): File "D:\BMC\TrueSight\pw\server\etc\NIUAT\kb\bin\w\send_to_slack_v1.1.py", line 108, in <module> main() File "D:\BMC\TrueSight\pw\server\etc\NIUAT\kb\bin\w\send_to_slack_v1.1.py", line 105, in main send_to_Slack(json_Data) File "D:\BMC\TrueSight\pw\server\etc\NIUAT\kb\bin\w\send_to_slack_v1.1.py", line 72, in send_to_Slack response = requests.post(url, data=payload, headers=headers, verify=False) File "C:\Python27\lib\site-packages\requests\api.py", line 109, in post return request('post', url, data=data, json=json, **kwargs) File "C:\Python27\lib\site-packages\requests\api.py", line 50, in request response = session.request(method=method, url=url, **kwargs) File "C:\Python27\lib\site-packages\requests\sessions.py", line 465, in request resp = self.send(prep, **send_kwargs) File "C:\Python27\lib\site-packages\requests\sessions.py", line 573, in send r = adapter.send(request, **kwargs) File "C:\Python27\lib\site-packages\requests\adapters.py", line 415, in send raise ConnectionError(err, request=request) requests.exceptions.ConnectionError: ('Connection aborted.', gaierror(11001, 'getaddrinfo failed'))

            • 3. Re: Integration of TrueSight with SLACK
              Brendan Murray

              Hi Abhay,

               

              With Python error messages, the last message is always the most meaningful. The key part of the message is this: requests.exceptions.ConnectionError: ('Connection aborted.', gaierror(11001, 'getaddrinfo failed')). This means the Python URL request was unable to connect to the server named in the URL. I did not encounter this problem during my testing of the script, so it is probably something specific to your environment. I Googled the error message and the consensus opinion was it is most likely a symptom of one of these issues: a bad hostname, a DNS issue that is preventing the hostname from being resolved to an IP address, or an HTTP proxy on your network that is intercepting the request.

               

              If the issue is an HTTP proxy server, you may need to modify the Python code to handle it. The requests module does have the ability to handle proxies, but I have never used those features. I would have to do some research. If there is a Python programmer in your company, he or she can probably help you modify the code to handle your proxy.

               

              Check with your network or security team to determine if there is an HTTP Proxy between your internal network and the Internet. If there is, and you can't find a Python programmer at your company to help you, update this thread and I will try to help you.

               

              Regards,

               

              Brendan

              • 4. Re: Integration of TrueSight with SLACK
                Abhay Bhagat

                Acknowledged Brendan , Thanks for your explanation , Yes there is a proxy in b/w , let me check with someone internally or google on the same to update the code to be used with proxy (with/without authentication).

                 

                Will update if I am able to successfully achieve the same .

                 

                Regards

                Abhay