|
1 | | -# yc-data-script |
2 | | - |
3 | | - |
4 | | - |
5 | | -## What does the yc-data-script do? |
6 | | - |
7 | | -yc-data-script is a simple Golang script that captures 16 different artifacts from your application in a **pristine** manner. These artifacts will be highly useful to troubleshoot performance problems. Below is the list of artifacts captured: |
8 | | - |
9 | | -1. Garbage collection log |
10 | | -2. Thread dump |
11 | | -3. Heap dump |
12 | | -4. Heap substitute |
13 | | -5. top |
14 | | -6. ps |
15 | | -7. top -H |
16 | | -8. Disk usage |
17 | | -9. dmesg |
18 | | -10. netstat |
19 | | -11. ping |
20 | | -12. vmstat |
21 | | -13. iostat |
22 | | -14. Kernel parameters |
23 | | -15. Application Log |
24 | | -16. Metadata |
25 | | - |
26 | | -## How to run the yc-data-script? |
27 | | - |
28 | | -1. Download latest yc-data-script from [this](https://tier1app.com/dist/ycrash/yc-agent-latest.zip) location |
29 | | -2. Unzip the downloaded ```yc-agent-latest.zip``` file. (Say you are unzipping in '/opt/workspace/yc-agent-latest' folder) |
30 | | -3. In the unzipped folder you will find yc-data-script by operating system: |
31 | | - |
32 | | -a) ```linux/yc``` - If you are running on Unix/Linux, then use this script. |
33 | | - |
34 | | -b) ```windows/yc.exe``` - If you are running on Windows, then use this script. |
35 | | - |
36 | | -c) ```mac/yc``` - If you are running on MAC, then use this script. |
| 1 | +### Usage of argument options: |
| 2 | +```bash |
| 3 | +Usage of yc: |
| 4 | + -a string |
| 5 | + The APP Name of the target |
| 6 | + -c string |
| 7 | + The config file path to load |
| 8 | + -cmd value |
| 9 | + The command to be executed, should be paired with '-urlParams' together |
| 10 | + -d Delete logs folder created during analyse, default is false |
| 11 | + -gcPath string |
| 12 | + The gc log file to be uploaded while it exists |
| 13 | + -hd |
| 14 | + Capture heap dump, default is false |
| 15 | + -hdPath string |
| 16 | + The heap dump file to be uploaded while it exists |
| 17 | + -j string |
| 18 | + The java home path to be used. Default will try to use os env 'JAVA_HOME' if 'JAVA_HOME' is not empty, for example: /usr/lib/jvm/java-8-openjdk-amd64 |
| 19 | + -k string |
| 20 | + The API Key that will be used to make API requests, for example: tier1app@12312-12233-1442134-112 |
| 21 | + -p int |
| 22 | + The process Id of the target, for example: 3121 |
| 23 | + -s string |
| 24 | + The server url that will be used to upload data, for example: https://ycrash.companyname.com |
| 25 | + -tdPath string |
| 26 | + The thread dump file to be uploaded while it exists |
| 27 | + -urlParams value |
| 28 | + The params to be added at the end of upload request url, should be paired with '-cmd' together |
| 29 | + -version |
| 30 | + Show the version of this program |
37 | 31 |
|
38 | 32 | ``` |
39 | | -./yc -j {JAVA_HOME} -onlyCapture -p {PID} -hd |
| 33 | +### Example of config file: |
| 34 | +```yaml |
| 35 | +version: "1" |
| 36 | +options: |
| 37 | + a: name |
| 38 | + d: false |
| 39 | + hd: false |
| 40 | + j: /usr/lib/jvm/java-8-openjdk-amd64 |
| 41 | + k: buggycompany@e094aasdsa-c3eb-4c9a-8254-f0dd107245cc |
| 42 | + p: 3121 |
| 43 | + s: https://gceasy.io |
| 44 | + gcPath: /var/log/gc.log |
| 45 | + hdPath: /var/log/heapdump.log |
| 46 | + tdPath: /var/log/threaddump.log |
| 47 | + cmds: |
| 48 | + - urlParams: dt=vmstat |
| 49 | + cmd: vmstat 1 1 |
40 | 50 | ``` |
41 | | -Where, |
42 | | - |
43 | | -**JAVA_HOME** is the home directory where JDK is installed |
44 | | - |
45 | | -**PID** is the target JVM's process ID |
46 | | - |
47 | | -**Example:** |
48 | | - |
49 | | -``` |
50 | | -./yc -j /usr/java/jdk1.8.0_141 -onlyCapture -p 15326 -hd |
51 | | -``` |
52 | | - |
53 | | -When you pass the above arguments, yc-data-script will capture all the application level and system level artifacts/logs from the server from the target JVM & host for analysis. Captured artifacts will be compressed into a zip file and stored in the current directory where the above command was executed. The zip file will have the name in the format: 'yc-YYYY-MM-DDTHH-mm-ss.zip'. |
54 | | - |
55 | | -**Example:** 'yc-2021-03-06T14-02-42.zip'. |
56 | | - |
57 | | -## How to analyze the artifacts generated by the yc-data-script? |
58 | | - |
59 | | -You can analyze the artifacts captured by yc-data-script either manually or through [yCrash server](https://ycrash.io/). yCrash server analyzes all the captured data and generates a root cause analysis report instantly. You can use the [Bundle upload](https://docs.ycrash.io/ycrash-features/bundle-upload.html#step-1-go-to-upload-incident-form) feature in the yCrash server to analyze the captured 360-degree data. |
60 | | - |
61 | | -### Advanced launch modes |
62 | | - |
63 | | -You can launch yc-data-script in following [3 different modes](https://docs.ycrash.io/ycrash-agent/launch-modes.html#launch-modes): |
64 | | - |
65 | | -1. **On-demand Mode:** In this mode you can directly transmit 360-degree artifacts from your server to yCrash server for analysis. |
66 | | -2. **API Mode:** In this mode you can integrate yc-data-script with your current monitoring tools such as AppDynamics, New Relic, Dynatrace, … |
67 | | -3. **M3 (Micro-metrics Monitoring) mode:** In this mode, yc-data-script proactively detect performance outages much earlier before it surfaces |
68 | | - |
69 | | -## How to build the yc-data-script? |
70 | | - |
71 | | -Please refer to any one of the following links if you want to build the yc-data-script in that corresponding operating system: |
72 | 51 |
|
73 | | -1. Build yc-data-script in [Windows](/docs/Build%20yc%20agent%20in%20Windows.pdf) |
74 | | -2. Build yc-data-script in [Linux](/docs/build-yc-agent-linux.md) |
75 | | -3. Build yc-data-script in [MacOS](/docs/build-yc-agent-macos.md) |
| 52 | +The config file is using yaml format. The name of the option keys is same as the name of argument options. |
| 53 | +
|
| 54 | +'-s': the server url that will be used to upload data. |
| 55 | +'-k': the API key that will be used to make API requests. |
| 56 | +'-j': the java home path to be used. Default will try to use os env 'JAVA_HOME' if 'JAVA_HOME' is not empty. |
| 57 | +'-a': the app name of the target. |
| 58 | +'-p': the pid of the target. |
| 59 | +'-d': delete logs folder created during analyse, default is false. |
| 60 | +'-hd': capture heap dump, default is false. |
| 61 | +'-gcPath': the gc log file to be uploaded while it exists, otherwise it will captures one if failed to get the path from '-Xlog:gc' or '-Xloggc'. |
| 62 | +'-hdPath': the heap dump file to be uploaded while it exists. |
| 63 | +'-tdPath': the thread dump file to be uploaded while it exists, otherwise it will captures one. |
| 64 | +
|
| 65 | +Only for argument options: |
| 66 | +'-version' show the version of this program. |
| 67 | +'-c': the config file path to load. |
| 68 | +
|
| 69 | +### Example to capture info from target with pid 3121: |
| 70 | +
|
| 71 | +`yc -p 3121 -s https://gceasy.io -k testCompany@e094a34e-c3eb-4c9a-8254-f0dd107245cc -j /usr/lib/jvm/java-11-openjdk-amd64 -c ./config.yaml` |
| 72 | +
|
| 73 | +### Example to execute custom commands after the capturing: |
| 74 | +
|
| 75 | +- By arguments. One '-urlParams' should be paired with one '-cmd'. |
| 76 | +`yc ... -urlParams dt=vmstat -cmd "vmstat 1 1" -urlParams dt=pidstat -cmd "pidstat 1 1" ...` |
| 77 | +- By config file. |
| 78 | +```yaml |
| 79 | + cmds: |
| 80 | + - urlParams: dt=vmstat |
| 81 | + cmd: vmstat 1 1 |
| 82 | +``` |
0 commit comments