Initial knowledge Ali Open Source diagnostic Tool Arthas

Source: Internet
Author: User

Last month, Ali Open source a monitoring tool called Arthas. In the near future, I am writing a multi-threading business, so I think of a problem.

If you are developing debugging natively, the IDE can see the current active thread, such as IntelliJ idea, whether the thread is running or hibernating, as debugger→threads can see. How can you see the threads running on the test server if the code is written and built on the test environment?

The front is finished, tutorial GitHub above also have, here is mainly about the individual in the deployment process and stepped on the pit. For reference only.

Github:https://github.com/alibaba/arthas

Docs:https://alibaba.github.io/arthas/index.html

The author uses CentOS7 bare metal. After reading the tutorial, follow the steps to execute the command:

Curl-l https://alibaba.github.io/arthas/install.sh | Sh

Download a script named as.sh, execute the script and discover:

[Email protected] arthas]#/as.sh arthas script Version:3.0.4illegal ENV, set $JAVA _home to jdk6+

Since it is Java monitoring, it is impossible to run without the Java runtime (this is not nonsense). Install the JDK configuration environment variable now ... The writer here is jdk8u181.

Jdk:https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Extract to/usr/java, execute vi/etc/profile config environment variable

Export Java_home=/usr/java/jdk1.8.0_181export classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar: $JAVA _ Home/jre/lib/rt.jarexport path= $PATH: $JAVA _home/bin

: Wq Save exit, then execute command to make the configured variable take effect

Source/etc/profile

Go back to the directory you just started, Arthas.

[[email protected] ~]# cd /usr/local/arthas/[[email protected] arthas]# ./ As.sh arthas script version: 3.0.4error: no available java process  to attach. Usage:    ./as.sh [-b [-f script_file]] [debug] [--use-version  version] [--attach-only] <pid>[@IP: Telnet_port:http_port]    [debug]          : start the agent in debug  mode    <PID>            : the target Java Process ID    [IP]             : the target ' s IP     [Telnet_port]   : the target ' s port for telnet     [http_port]&Nbsp;    : the target ' s port for http    [-b]             : batch mode, which  will disable interactive process selection.    [-f]             : specify the path to  Batch script file.    [--attach-only] : only attach the  arthas agent to target jvm.    [--use-version] : use  the specified arthas version to attach. EXAMPLE:&NBSP;&NBSP;&NBSP;&NBSP;./AS.SH&NBSP;&LT;PID&GT;&NBSP;&NBSP;&NBSP;&NBSP;./AS.SH&NBSP;&LT;PID&GT;@[IP]     ./as.sh <PID>@[IP:PORT]    ./as.sh debug < Pid>    ./as.sh -b <pid>    ./as.sh -b -f /path/to/script    ./as.sh -- attach-only <pid>    ./as.sh --use-version 2.0.20161221142407  <pid>here is the list of possible java process (es)  to  Attatch:

The results found no Java processes available. Then start a (Dig the Booger), continue ...

[[email protected] arthas]# ./as.sh arthas script version: 3.0.4found  EXISTING&NBSP;JAVA&NBSP;PROCESS,&NBSP;PLEASE&NBSP;CHOOSE&NBSP;ONE&NBSP;AND&NBSP;HIT&NBSP;RETURN.*&NBSP;[1]:  1244 test.jarupdating version 3.0.4 ...############################################# ########################### 100.0%./as.sh: line 182: unzip: command not  foundmv: cannot stat  '/tmp/temp_3.0.4_1265 ': no such file or  Directoryupdate fail, ignore this update. Calculating attach execution time ... attaching to 1244 using version 3.0.4...error: unable to access  jarfile /root/.arthas/lib/3.0.4/arthas/arthas-core.jarattach to target jvm  (1244)  failed, check /root/logs/arthas/arthas.log or stderr of target jvm  for any exceptiOns. 

However, the program did not run successfully as expected.

......

Through degrees Niang Google various ways, read the FAQ, the author recommends manual installation + manual stitching command line start. But, some trouble, do not like (wayward)

Back, see this Issue:Error:Unable to access Jarfile/root/.arthas/lib/3.0.4/arthas/arthas-core.jar. Hey, isn't that the brother of my fair? Get in now. See the big God ralf0131 answer, immediately latrine Seton Open:

First, please ensure/root/.arthas/lib/3.0.4/arthas/arthas-core.jar does exist.

CD to/root/.arthas/lib/3.0.4, there is no jar package in the Discovery directory. Can't taste this melon a bit not reconciled, had to manually installed (really fragrant ~)

The current latest package is 3.0.4. Download, unzip:

[Email protected] 3.0.4]# wget https://maven.aliyun.com/repository/public/com/taobao/arthas/arthas-packaging/ 3.0.4/arthas-packaging-3.0.4-bin.zip ... [Email protected] 3.0.4]# unzip Arthas-packaging-3.0.4-bin.zip-bash:unzip:command not found

All right, I'm faking, I unzip ...

[[email protected] 3.0.4]# yum-y install Unzip[[email protected] 3.0.4]# unzip Arthas-packaging-3.0.4-bin.zip

Suddenly found, just not said/root/.arthas/lib/3.0.4/arthas path under the wooden jar bag, just I unpacked jar package to/root/.arthas/lib/3.0.4, as long as the new Arthas directory, It's OK to move the 4 jar packs in again.

[Email protected] 3.0.4]# mkdir arthas[[email protected] 3.0.4]# mv *.jar arthas/[[email protected] arthas]#./as.sh

The merit tells ... You think it's over? There is still a problem ...

Arthas Script Version:3.0.4found Existing Java process, please choose one and hit return.* [1]: 1244 test.jarcalculating Attach Execution time ... Attaching to 1244 using version 3.0.4...real0m0.620suser0m0.148ssys0m0.043sattach success. Connecting to Arthas server ... current timestamp was 1539615611./as.sh:line 423:type:telnet:not found ' telnet ' is Requir Ed.

Also to install telnet-client ...

[Email protected] 3.0.4]yum-y install telnet.x86_64

Finally start again, enter, done!

[[email protected] arthas]# ./as.sh arthas script version: 3.0.4found  EXISTING&NBSP;JAVA&NBSP;PROCESS,&NBSP;PLEASE&NBSP;CHOOSE&NBSP;ONE&NBSP;AND&NBSP;HIT&NBSP;RETURN.*&NBSP;[1]:  1244 test.jarcalculating attach execution time ... Attaching to 1244 using version 3.0.4...real0m0.132suser0m0.050ssys0m0.113sattach  success. connecting to arthas server... current timestamp is 1539615853trying  127.0.0.1...connected to 127.0.0.1.escape character is  ' ^] ' .  ,---.    ,------.  ,--------.,--.   ,--.   ,---.    ,---.                        &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;/&NBSP;&NBSP;O&NBSP;&NBSP;\&NBSP;|&NBSP;&NBSP:--.   '--.    .--' |   '--'   | /  o  \  '    .-'                            |   .-.  | |    '--'. ' &NBSP;&NBSP;&NBSP;|&NBSP;&NBSP;|&NBSP;&NBSP;&NBSP;|&NBSP;&NBSP:--.   | |   .-.  | ' .   '-.                           |  |  |  | |   |\  \    |  |   |  |  |   | |   | |  |. -'     |                           '--'   '--'--'   '--'      '--'     '--'    '--'--'   '--'-----'   wiki: https://alibaba.github.io/arthasversion: 3.0.4pid:  1244timestamp: 1539615854095$

Then you can order various kinds of gestures to get a variety of ...

Summarize:

    1. Before installing Arthas, you need to install JDK, configure environment variables such as Java_home, and Telnet. Unzip look at the situation, if you finish the decompression and then upload to the server, also line ...

    2. Do not know whether it is a bug or God horse situation, according to the steps of the document once again installed on the test server, the program runs normally, there is no report error:unable to access jarfile/root/.arthas/lib/3.0.4/arthas/ Arthas-core.jar error, 4 jar packages are in the expected path. To put it simply, some machines run./as.sh is due to the small Jar packet error, some will be normal operation, the specific situation of specific analysis. Continue to follow Arthas's GitHub dynamics and see the latest developments in the project.

Just the sauce. Go to bed......

Initial knowledge Ali Open Source diagnostic Tool Arthas

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.