1 2 Previous Next 26 Replies Latest reply on Mar 6, 2018 12:43 AM by Ramalakshmana Padala

    Control-M v8.0 integration with ServiceNow

    Tomasz Podlesny

      Hello,

       

      Presently, operators on our batch monitoring team are forced to manually create incident tickets in ServiceNow for all Control-M alerts.

      Does anyone have any experience with integration ServiceNow and Control-M in order to set up incident ticket auto cutting?

       

      Thank you in advance.

      Tom

        • 1. Re: Control-M v8.0 integration with ServiceNow
          Zach Warren

          Yeah we migrated our auto generated tickets from TSRM to ServiceNow about a year ago.  The best way to do this (in my opinion) is to setup the "Send Alarm to Script" parameter.  The "script" it refers to will have to be something you create.  I have mine setup to create tickets on failures, exectime, late time/late sub, and custom. 

           

          Firstly, you may want to contact your ServiceNow admin or support group and see if they currently offer a solution for auto creating tickets.  We drop a string of text on a MQ queue and that is translated into a Web Service call to ServiceNow.  All I had to do was give them the appropriate fields needed to map to items in ServiceNow within that string of text I'm passing.

           

          After the method of creating a ticket is determined, you can work on your back end script.

           

          The way it works is that every time an alert is generated, the alert fields are passed to the script via the gateway.  To see all the fields coming thru - assuming you are on a UNIX system, the initial script could have this:  echo $*

          --- Check the gateway log to see the results after an alert hits the alert panel.

           

          You would then build your script to parse out the fields you want and in turn pass to ServiceNow via Web Service or thru the method that support team would want you to follow.  I would post up mine but it's so site specific that it wouldn't really make any sense to go thru it.  The good thing is that using the "Send Alarm to Script" allows you to easily hook up to a new problem/change tool if ever needed in the future.

           

          Hopefully this will get you started.  Thx

          1 of 1 people found this helpful
          • 2. Re: Control-M v8.0 integration with ServiceNow
            Tomasz Podlesny

            Hello Zach,

             

            Wow! I feel like a kid in a candy store. Hahaha! This is very hefty trove of information. I will dig into it and come back with some questions, if you don't mind, as I already see a couple of points I'm not really grasping entirely.

            Thank you very much. Really appreciate it.

             

            Have a great day. We talk soon.

             

            Tom

            1 of 1 people found this helpful
            • 3. Re: Control-M v8.0 integration with ServiceNow
              Tomasz Podlesny

              Hello again Zach,

               

              Well, got all the info from the SN side. It will be a simple webservice call. I will feed all the necessary and properly formatted data through an xml file.

              But, I got one issue, you say every time an alert is generated in the GAS Alerts window, there is a gateway log that is updated. I tried to locate that log, without success. I only got the following that I see on the EM server:log files.jpg

              None of them were modified after an alert came in.

              What is the filename of the log you're referring to?

               

              Thanks a bunch!

              Tom

              • 4. Re: Control-M v8.0 integration with ServiceNow
                Zach Warren

                You are in the right place, it will be in the gtw_log* file. 

                 

                Question - did you update the "Send Alarm to script" sys parm to point to your script and then recycle Enterprise Manager?  It takes that recycle to make that parm take effect.

                 

                Let me know..  thx

                1 of 1 people found this helpful
                • 5. Re: Control-M v8.0 integration with ServiceNow
                  Tomasz Podlesny

                  Ohh, I think I misunderstood just a tad...I taught that "Send Alarm to script" meant this:

                  shout.jpg

                  I ran tests and it launches the script I am testing....lol.

                  Sorry, don't know the product from the admin side that well. More of an Autosys guy.

                   

                  So, If I got this right, in order have the gtw_log* file updated with each alert, I need to get the "Send Alarm to script" parm set to active?

                   

                  Thanks.

                  • 6. Re: Control-M v8.0 integration with ServiceNow
                    Zach Warren

                    You can do it this way too, I actually use a combo of both. 

                     

                    The shout message to script may look something like this:

                    FAIL [short SN queue name] 3 2 %%JOBNAME %%ORDERID %%COMPSTAT

                     

                    FAIL = just a keyword to indicate this is going to create an abend ticket.  Expand on this in the future with keywords like LONG, LATE, etc to create tickets for different events - all controlled via the shout message on a job.

                     

                    Short SN queue name = Unless the SN queue names have no spaces, I had to create what I call a translation file where I mapped a short name to the real SN queue name.  In the shout message, my queue name would be no more than 10 characters.  Something like FINANCE.  In a separate file, I mapped FINANCE to the real SN queue name which would be something like Corporate Finance Oncall (for example).  My script goes out and finds the mapping in order to build the data to send to SN.

                     

                    3 = SN Impact, put it on the shout message so you can control it... some people might want a Sev2 for their jobs for example

                     

                    2 = SN Urgency, these 2 combos of 3&2 are the lowest priority ticket.

                     

                    %%JOBNAME = the job name

                     

                    %%ORDERID = Order ID so that if there are multiple jobs with the same name, support can easily find it based on this value.

                     

                    %%COMPSTAT = the return code of the failure, nice to put in the ticket if it means something to support.

                     

                    I use all this data in the script to build the ServiceNow ticket summary to say something like this:

                    JobABCxyz (OrderID: 11111) failed with Return Code=1 (Nov 15, 2015 02:00:00)

                     

                    The ticket description will be canned, define that in your script and pull the UNIX system date for the time of the failure.  Package all that up in your XML and ship it on over to SN.

                    1 of 1 people found this helpful
                    • 7. Re: Control-M v8.0 integration with ServiceNow
                      Tomasz Podlesny

                      I am having an issue with passing any parameters to the script by using the shout message. It seems they are not getting through at all. I can launch the script all right, but that's it. Is it there where "Send Alarm to script" comes into play, meaning allows the parms to be passed through the shout message? To be truthfull, I'm unsure of what "Send Alarm to script" really does? If the result is that all alerts hitting the Alert server are forwarded to the script, where and how do you specify which script to target?

                      • 8. Re: Control-M v8.0 integration with ServiceNow
                        Zach Warren

                        Hi Tomasz, did you define the shout destination on your Control-M server?  If not you'll need to do that so Control-M knows where to send it.  Define this thru Config manager > Shout destinations

                         

                        Here is an example below.  Once defined here, you can then set the destination of the shout message on your job to the 'logical name' you define for it.  In the example below I would send shout messages to "KILLJOB" on each job I want to use it on.

                        1 of 1 people found this helpful
                        • 9. Re: Control-M v8.0 integration with ServiceNow
                          Tomasz Podlesny

                          Hello Zach,

                           

                          Yup, got all that set up:

                          The test script is extra simple:

                          Shout set up like this:

                           

                          But, the result I get is this:

                          I get the server on which the job runs in PARM1, got the three items from the Shout Message in PARM2 and 'Urgent' in PARM3....

                          Don't understand how those three parms got populated this way.

                          • 10. Re: Control-M v8.0 integration with ServiceNow
                            Zach Warren

                            Yep that is correct, Agent hostname will come in as PARM1 so you have to adjust a little.

                             

                            Something like this:

                            TicketType=$(print $2)

                            Jobname=$(print $3)

                            ReturnCode=$(print $4)

                             

                            And build in the rest of your XML data from there.

                            1 of 1 people found this helpful
                            • 11. Re: Control-M v8.0 integration with ServiceNow
                              Tomasz Podlesny

                              I still get all the items from the Shout Message bundled into $2:

                              job:

                              script:

                              result:

                               

                              Tested just to print $parm1, which should only contain 'FAIL' but I still get everything from the Shout Message.

                              • 12. Re: Control-M v8.0 integration with ServiceNow
                                Zach Warren

                                That is odd.  Try a little different syntax:

                                ------------------------------------------------------------

                                #!/bin/ksh

                                parm1=${2}

                                parm2=${3}

                                parm3=${4}

                                 

                                /bmc/controlm/ctm_agent/ctm/exe/ctmshout -USER ECS -MESSAGE "$parm1"

                                ------------------------------------------------------------

                                 

                                Or try this:

                                #!/bin/ksh

                                parm1=$(echo $* | awk '{print $2}')

                                parm2=$(echo $* | awk '{print $3}')

                                parm3=$(echo $* | awk '{print $4}')

                                 

                                /bmc/controlm/ctm_agent/ctm/exe/ctmshout -USER ECS -MESSAGE "$parm1"

                                1 of 1 people found this helpful
                                • 13. Re: Control-M v8.0 integration with ServiceNow
                                  Tomasz Podlesny

                                  Same result with:

                                  parm1=${2}

                                  parm2=${3}

                                  parm3=${4}

                                   

                                  BUT WORKED MARVELOUSLY(!!!) WITH:

                                  parm1=$(echo $* | awk '{print $2}')

                                  parm2=$(echo $* | awk '{print $3}')

                                  parm3=$(echo $* | awk '{print $4}')

                                   

                                  I tested it one by one, 1 parm, 2 parms, 3 parms, all shows up as expected:

                                  Thank you very much! It is very appreciated. I'm just wondering what would be the source of this.

                                   

                                  Now, that this is behind us, I just have one thing that seems unclear to me. I will REALLY try not to bug you anymore after this.

                                  I am talking about the "Send Alarm to script" sys parm that you referred to before. Where is this located? With what do you updated it? And what is the result once this parm is updated?

                                   

                                  Thank you!

                                  • 14. Re: Control-M v8.0 integration with ServiceNow
                                    Zach Warren

                                    Excellent!  So the 'Send Alarm to Script' is an Enterprise Manager sys parm that could be set within Config Manager.  Choosing this option would send every single alert that hits the Alert window to a script.  I use this because we have Mainframe systems and I can't put a script over there as a shout destination.  This allows me to create tickets from both the Mainframe and Distributed Control-M's because even the mainframe shout messages will be picked up by my ticket script.

                                     

                                    It's unrelated to the shout destination that you have setup but they can be used together.  To accomplish the auto tickets, you have 3 options in my opinion --- (1) Shout destination like you have setup (2) Send alarm to script EM parm (3) Both used together.  You could pick any of these you wanted based on your need or change later if you need to expand.  I only mentioned it first in case you had mainframes in your environment.

                                     

                                    I would stick to what you have setup so far and not worry about the 'Send alarm to script' sysparm.  The path you are on is going to lead to auto ticket creation!  You are almost there!

                                    1 of 1 people found this helpful
                                    1 2 Previous Next