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.xml5. In managementmodule.xml of the newly created MM (FCBN.jar) Change the agent expression to the agent mapping specified in the domain.xml file6. 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.
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.
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/FCBN3/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.jarjava.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.
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: resources/caret.png #5 #3
inflating: resources/caret.png #3 #7 #5
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.
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.
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.
Sorry for the delay.
In your original script near the end I commented 2 lines and added 3 lines (in bold) as follows:
#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
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
... 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:
jar cvf $App_name$append *