DX Application Performance Management

Expand all | Collapse all

New MM through script

Jump to Best Answer
  • 1.  New MM through script

    Posted 03-22-2018 03:56 PM
      |   view attached

    Hi team,

    We have written a shell script to create a MM on the fly.
    In order to achieve that we have performed the below mentioned step in the script.
    Note: Our domain.xml file is prepopulated the with name of the domains and its agent mapping.(This is the input to this script)
    1. Create a folder inside module folder and rename the folder to the domain name specified in the domain.xml file.
    2. Copy the defaultMM.jar from module folder and paste it inside the new folder (FCBN) created with the domain name.
    3. Rename of defaultMM to the name of the domain name (FCBN) specified in the domain.xml file.
    4. Unzip the newly created jar file (FCBN.jar) and get into the managementmodule.xml
    5. In managementmodule.xml of the newly created MM (FCBN.jar) Change the agent expression to the agent mapping specified in the domain.xml file
    6. Again zip the unzip the jar file (FCBN.jar)
    7. Restart the MoM.

    Everything is working  fine at the backend. But after creation of the FCBN MM in the server, I am not able to see that in the Workstation under Management Module editor.

    I just want know to whether i am missing any steps or some configuration that will link the newly created MM to Workstation.

    Also attaching the code snippet for your reference.

    Cheers
    Jay
    Cell No:551-263-9681

    Attachment(s)

    zip
    MMCodeSnippet.txt.zip   937B 1 version


  • 2.  Re: New MM through script

    Posted 03-23-2018 11:15 AM

    Do you see any errors in the MOM logs after restarting? During the startup process, an EM parses each Management Module in the /modules directly and will report warnings if any problems are detected. You should see a reason logged there as to a why a module is not loaded. 



  • 3.  Re: New MM through script
    Best Answer

    Posted 03-26-2018 01:14 AM

    HI Jay,

    I used your script to build a new FCBN.jar and I see this error in the EM log

    ===

    3/26/18 10:16:24.184 AM IST [ERROR] [main] [Manager.Bootstrap] Could not read Management Module file /root/Introscope10.5.2.15_mom/config/modules/FCBN
    3/26/18 10:16:24.184 AM IST [VERBOSE] [main] [Manager.Bootstrap]

    java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
    at java.util.zip.ZipFile.<init>(ZipFile.java:219)
    ===

    I think that is because you are using "tar -zcvf" to create the final FCBN.jar file, so the file format is invalid. The java jar command also confirms.

    ===

    # jar tvf FCBN.jar
    java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
    ===

     

    I would suggest you build the final file using "jar cvf" or using recursive zip "zip -r" should also be valid.

    Hope that helps.

     

    Regards,

     

    Lynn



  • 4.  Re: New MM through script

    Posted 03-27-2018 04:14 PM

    Hi Lynn,

     

    I tried to use "jar cvf" to build the final file but the jar file is not getting created and getting the below mentioned error in the console

    [3/27/2018 4:07 PM] Koritikanti Ramesh (YWK3DYP):

    inflating: ManagementModule.xml   

      inflating: resources/Picture1.png 

      inflating: resources/caret.png #5 #3 

      inflating: resources/caret.png #3 #7 #5 

      inflating: resources/gear.png     

      inflating: resources/caret.png #2 #6 #4 

      inflating: resources/caret.png #3 #7 #5 #2 

    successfully updated managementmodule.xml

    ./newtest.sh: line 38: jar: command not found

    But the below mentioned command is working fine while building the final file

    "tar --remove-files -zcvf"

    Please confirm whether you are able to see all the newly created MM in you Management module editor of workstation.

     

    Cheers

    Jay

    Cell No:551-263-9681

     

     



  • 5.  Re: New MM through script

    Posted 03-27-2018 05:15 PM

    Hi Jay,

    To confirm it was the file syntax I manually extracted the file from the FCBN.jar file built with the script using  "tar -zxvf" and then I rebuilt a new FCBN.jar using "jar cvf". After MOM restart the FCBN MM was then visible in the UI.

    Your original script probably needs changes to accommodate the use of "jar cvf" instead of "tar -zcvf" and just a straight swap of the commands is not working. I will have a look at it later and get back to you.

     

    Regards,

     

    Lynn



  • 6.  Re: New MM through script

    Posted 03-29-2018 04:59 PM

    Hi Lynn,

    I think the problem is in Sixth Step.( Mentioned in my 1st communication above) 

    1. When I used tar -zcvf command in my script.

    It is working but in my Enterprise manager logs showing Could not read Management Module file /opt/ca/Introscope10.5.2.15/config/modules/FCBN .

    2. When I used  jar cvf  instead of above command in my script.

    It showing Error while running the script  like this " unzip:  cannot find or open FCBN.jar, FCBN.jar.zip or FCBN.jar.ZIP."

     

    Suggest me an alternate for above commands or how to used  "jar cvf"  in a different ways to successfully execute my script.

     

    Cheers

    Jay

    Cell No:551-263-9681



  • 7.  Re: New MM through script

    Posted 04-03-2018 02:52 AM

    Hi Jay, 

    Sorry for the delay.

    In your original script near the end I commented 2 lines and added 3 lines (in bold) as follows:

    ===

    .........

    #cd ..

    #tar -zcvf $App_name$append $App_name

    jar cvf $App_name$append *
    mv $App_name$append ..
    cd ..

    rm -rf $App_name

    #change the file as jar file

    mkdir $App_name

    mv $App_name$append $path_dst

    ====

    NOTE the jar command needs to be run while inside temp directory $path_dst and not one level above it which you did when running tar command. Then you can move the jar file to the directory above and move to that directory to complete the script, although the final 3 lines seem to be redundant as they are just removing and recreating the FCBN directory and moving the FCBN.jar file back there.

    The modified script created a jar file that my EM processed successfully.

     

    Hope that helps

     

    Lynn



  • 8.  Re: New MM through script

    Posted 04-03-2018 06:33 PM

    ... actually it is the last 5 commands that are redundant because the domain jar file $App_name$append is already being created in domain directory $path_dst so no need to move it up and back to $path_dst  again i.e. this shortened end to the script should also work:

    ====

    .........

    #cd ..

    #tar -zcvf $App_name$append $App_name

    jar cvf $App_name$append *

    ====