forked from docs/doc-exports
Reviewed-by: Mützel, Andrea <andrea.muetzel@t-systems.com> Co-authored-by: Li, Qiao <qiaoli@huawei.com> Co-committed-by: Li, Qiao <qiaoli@huawei.com>
40 lines
8.1 KiB
HTML
40 lines
8.1 KiB
HTML
<a name="apm_02_0004"></a><a name="apm_02_0004"></a>
|
|
|
|
<h1 class="topictitle1">Manually Installing Agents for Java Applications</h1>
|
|
<div id="body8662426"><div class="section" id="apm_02_0004__en-us_topic_0000001241035473_section8132103817447"><h4 class="sectiontitle">Prerequisites</h4><ul id="apm_02_0004__en-us_topic_0000001241035473_ul13757642302"><li id="apm_02_0004__en-us_topic_0000001241035473_li1757194216012">The network between your host and APM is normal.<p id="apm_02_0004__en-us_topic_0000001241035473_p7427107162418"><a name="apm_02_0004__en-us_topic_0000001241035473_li1757194216012"></a><a name="en-us_topic_0000001241035473_li1757194216012"></a>You can run the <strong id="apm_02_0004__en-us_topic_0000001241035473_b186312344147">Telnet</strong> command to check the network.</p>
|
|
<p id="apm_02_0004__en-us_topic_0000001241035473_p9420576249"></p>
|
|
</li></ul>
|
|
<ul id="apm_02_0004__en-us_topic_0000001241035473_ul1179813091714"><li id="apm_02_0004__en-us_topic_0000001241035473_li1075748191717">The AK/SK required for accessing JavaAgents have been obtained. To obtain them, log in to the APM console and choose <strong id="apm_02_0004__en-us_topic_0000001241035473_b774617587357">System Management</strong> > <strong id="apm_02_0004__en-us_topic_0000001241035473_b1174625819355">Access Keys</strong> in the navigation pane.<div class="fignone" id="apm_02_0004__en-us_topic_0000001241035473_fig54120529159"><span class="figcap"><b>Figure 1 </b>Obtaining an AK/SK</span><br><span><img id="apm_02_0004__en-us_topic_0000001241035473_image541652181519" src="en-us_image_0000001627629722.png" title="Click to enlarge" class="imgResize"></span></div>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="apm_02_0004__en-us_topic_0000001241035473_section2010313462448"><h4 class="sectiontitle">Procedure</h4><ol id="apm_02_0004__en-us_topic_0000001241035473_ol1351071614214"><li id="apm_02_0004__en-us_topic_0000001241035473_li151071613218"><span>Download <strong id="apm_02_0004__en-us_topic_0000001241035473_b1914567397">apm-javaagent</strong> to any directory of your host. For the download address, see <a href="apm_02_0007.html#apm_02_0007">JavaAgent Download Addresses</a>.</span><p><p id="apm_02_0004__en-us_topic_0000001241035473_p204291036131319">Example command:</p>
|
|
<p id="apm_02_0004__en-us_topic_0000001241035473_p1982220399136"><strong id="apm_02_0004__en-us_topic_0000001241035473_b136629271345">curl -O https://xxx/apm-javaagent-x.x.x.tar</strong></p>
|
|
</p></li></ol><ol start="2" id="apm_02_0004__en-us_topic_0000001241035473_ol149258107224"><li id="apm_02_0004__en-us_topic_0000001241035473_li10925151019228"><span>Run the <strong id="apm_02_0004__en-us_topic_0000001241035473_b791275415136">tar</strong> command to decompress the JavaAgent package.</span><p><p id="apm_02_0004__en-us_topic_0000001241035473_p16400415101716">Example command:</p>
|
|
<p id="apm_02_0004__en-us_topic_0000001241035473_p1370151611713"><strong id="apm_02_0004__en-us_topic_0000001241035473_b3689191293419">tar -xvf apm-javaagent-x.x.x.tar</strong></p>
|
|
</p></li></ol><ol start="3" id="apm_02_0004__en-us_topic_0000001241035473_ol9590183312221"><li id="apm_02_0004__en-us_topic_0000001241035473_li15590633102216"><span>Modify the <strong id="apm_02_0004__en-us_topic_0000001241035473_b42371537063">apm.config</strong> file in the JavaAgent package. Configure <strong id="apm_02_0004__en-us_topic_0000001241035473_b1965341911718">master.address</strong> by referring to <a href="apm_02_0008.html#apm_02_0008">Access Address (master.address)</a>, and add the AK/SK to the configuration file, as shown in the following figure.</span><p><div class="fignone" id="apm_02_0004__en-us_topic_0000001241035473_fig27531238155512"><span class="figcap"><b>Figure 2 </b>Adding the AK/SK</span><br><span><img id="apm_02_0004__en-us_topic_0000001241035473_image125131984515" src="en-us_image_0000001196275562.png" title="Click to enlarge" class="imgResize"></span></div>
|
|
</p></li></ol><ol start="4" id="apm_02_0004__en-us_topic_0000001241035473_ol1426015562210"><li id="apm_02_0004__en-us_topic_0000001241035473_li192616558224"><span>Modify the startup script of the Java process.</span><p><p id="apm_02_0004__en-us_topic_0000001241035473_p1251844613152">Add the path of the <strong id="apm_02_0004__en-us_topic_0000001241035473_b3684171163912">apm-javaagent.jar</strong> package and the component name of the Java process to the end of the Java command in the service startup script.</p>
|
|
<p id="apm_02_0004__en-us_topic_0000001241035473_p1431613368238">Example of adding <strong id="apm_02_0004__en-us_topic_0000001241035473_b26585317442">-javaagent</strong> parameters:</p>
|
|
<p id="apm_02_0004__en-us_topic_0000001241035473_p010062517563">java <strong id="apm_02_0004__en-us_topic_0000001241035473_b2100125165610">-javaagent:/xxx/apm-javaagent/apm-javaagent.jar=appName={appName}</strong></p>
|
|
<p id="apm_02_0004__en-us_topic_0000001241035473_p5955112895320">If your enterprise has a large number of services, you can add more complex configurations. For example:</p>
|
|
<div class="p" id="apm_02_0004__en-us_topic_0000001241035473_p1552553615144">java <strong id="apm_02_0004__en-us_topic_0000001241035473_b26335316201">-javaagent:/xxx/apm-javaagent/apm-javaagent.jar=appName=myApp</strong><strong id="apm_02_0004__en-us_topic_0000001241035473_b14301750202416">,env=myEnv,envTag=myTag,business=myBusiness,subBusiness=mySub</strong><div class="note" id="apm_02_0004__en-us_topic_0000001241035473_note777185944917"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="apm_02_0004__en-us_topic_0000001241035473_ul2140043162019"><li id="apm_02_0004__en-us_topic_0000001241035473_li12341425163812">The preceding parameters are built-in CMDB information of APM. For details, see <a href="apm_07_0050.html">CMDB Management</a>.</li><li id="apm_02_0004__en-us_topic_0000001241035473_li1626720479201">Due to historical reasons, the metadata of APM startup parameters conflicts with some CMDB concepts. The following shows the details.<p id="apm_02_0004__en-us_topic_0000001241035473_p9986143115618"><a name="apm_02_0004__en-us_topic_0000001241035473_li1626720479201"></a><a name="en-us_topic_0000001241035473_li1626720479201"></a>Generally, the startup parameter is set to <strong id="apm_02_0004__en-us_topic_0000001241035473_b1105152412214">-javaagent:D:\javaagent-package\apm-javaagent\apm-javaagent.jar=appName=xxx,env=yyy,business=zzz,subBusiness=sss,envTag=xxx</strong>. <strong id="apm_02_0004__en-us_topic_0000001241035473_b021773391220">appName</strong> indicates a component, <strong id="apm_02_0004__en-us_topic_0000001241035473_b123144061212">business</strong> indicates an application, <strong id="apm_02_0004__en-us_topic_0000001241035473_b87311245101216">subBusiness</strong> indicates a sub-application, and <strong id="apm_02_0004__en-us_topic_0000001241035473_b10763165261217">envTag</strong> indicates an environment tag.</p>
|
|
<p id="apm_02_0004__en-us_topic_0000001241035473_p103019071315">If <strong id="apm_02_0004__en-us_topic_0000001241035473_b10691622201312">business</strong> is not set on the web page, the system reports an error when the JavaAgent is started. If other parameters (<strong id="apm_02_0004__en-us_topic_0000001241035473_b594982611410">subBusiness</strong>, <strong id="apm_02_0004__en-us_topic_0000001241035473_b9870124391417">appName</strong>, <strong id="apm_02_0004__en-us_topic_0000001241035473_b4955603152">env</strong>, and <strong id="apm_02_0004__en-us_topic_0000001241035473_b12589154731419">envTag</strong>) are not set, the system automatically creates them when the JavaAgent is started.</p>
|
|
<p id="apm_02_0004__en-us_topic_0000001241035473_p2446800313">Component names are unique under an application.</p>
|
|
</li></ul>
|
|
</div></div>
|
|
</div>
|
|
</p></li><li id="apm_02_0004__en-us_topic_0000001241035473_li8360181332311"><span>Redeploy the application.</span></li></ol>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="apm_02_0002.html">Monitoring Java Applications</a></div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<script language="JavaScript">
|
|
<!--
|
|
image_size('.imgResize');
|
|
var msg_imageMax = "view original image";
|
|
var msg_imageClose = "close";
|
|
//--></script> |