run-y
run-y
is the command to run Ylang script.
It is a wrapper around the orxray Ylang subcommand, but is much easier to use
Usage
Usage: run-y [OPTIONS] [ylang file]
OPTIONS:
-a, --agent integer Agent ID. Specify the agent to run the ylang script.
-e string Y language script. Only one of ylang file and -e option can be specified.
-v, --verbose Print verbose informations.
-q, --quiet Avoid print verbose informations.
--print-job-uri Print the job URI after running the script.
-p, --pid integer Target process ID. Specify the process ID to be analyzed by the ylang.
-f, --file string Process file. Specify the path to the process file to be analyzed in ylang.
-c, --command string Command will be run and the process will be analyzed by ylang.
--cmd-args string Specify the command args when you use command mode.
Example
1. run Ylang script by -e option
You can execute a Ylang statement specified with the -e option.
$ run-y -e '_probe _begin { printf("Hello, world!\n"); _exit(); }'
Start tracing...
Hello, world!
2. run Ylang script by Ylang file
Prepare a Ylang script file.
$ cat hello.y
_probe _begin { printf("Hello, world!\n"); _exit(); }
And use run-y to execute the script.
$ run-y hello.y
Start tracing...
Hello, world!
~/.orxray/config
3. run Ylang script on the specified agent, the default agent set in $ run-y hello.y -a 1294
Start tracing...
Hello, world!
4. run Ylang script and print verbose information
You can use -v option to print verbose information.
$ run-y hello.y -v
info: start to run job(4371497725) on the console side
info: job directory: 2021-12-08/07/job-4371497725
info: analyze the whole system
info: job runtime: stap
info: start to compile opslang in cli-tool-34539
info: sending the compiled opslang to agent
info: agent: start to run the tool: cli-tool-34539
info: agent: start to collect process build info
info: agent: build info hit the cache
info: agent: orxray_cli_tool_87441_XXXXXXX.ko hit the cache
info: agent: start to run the tool
info: agent: running tool cli-tool-34539 ...
Start tracing...
Hello, world!
real 0m0.382s
user 0m0.013s
sys 0m0.043s
5. run Ylang script and print job URI
Use –print-job-uri option to print job-uri after execute the script.
You can use this URI to view charts and task details
$ run-y hello.y --print-job-uri
Start tracing...
Hello, world!
Goto https://xxxx.xray.xxx.com/targets/1294/history/4371497759