mirror of
https://github.com/openziti/ziti.git
synced 2026-10-11 23:12:35 +00:00
3.3 KiB
3.3 KiB
Runtime Operations Agent
The ziti controller and ziti router can both be introspected at runtime using the ziti command line tool.
Available Operations
- Get the stack traces of all go-routines the running process
ziti ps stack
- Force garbage collection
ziti ps gc
- View memory statistics
ziti ps memstats- Example:
$ ziti ps memstats alloc: 22.89MB (24005552 bytes) total-alloc: 1.49GB (1602895000 bytes) sys: 75.02MB (78660608 bytes) lookups: 0 mallocs: 23141725 frees: 22895477 heap-alloc: 22.89MB (24005552 bytes) heap-sys: 63.00MB (66060288 bytes) heap-idle: 34.71MB (36397056 bytes) heap-in-use: 28.29MB (29663232 bytes) heap-released: 31.31MB (32833536 bytes) heap-objects: 246248 stack-in-use: 1.00MB (1048576 bytes) stack-sys: 1.00MB (1048576 bytes) stack-mspan-inuse: 500.44KB (512448 bytes) stack-mspan-sys: 576.00KB (589824 bytes) stack-mcache-inuse: 20.34KB (20832 bytes) stack-mcache-sys: 32.00KB (32768 bytes) other-sys: 2.97MB (3109868 bytes) gc-sys: 5.70MB (5974840 bytes) next-gc: when heap-alloc >= 24.58MB (25776064 bytes) last-gc: 2020-11-30 16:35:46.766977147 -0500 EST gc-pause-total: 10.939682ms gc-pause: 228800 num-gc: 140 enable-gc: true debug-gc: false
- Get the go version used to build the executable
ziti ps goversion
- Gets snapshot of the heap
ziti ps pprof-heap
- Run cpu profiling for 30 seconds and returns the results
ziti ps pprof-cpu
- Get Go runtime statistics such as number of goroutines, GOMAXPROCS, and NumCPU
ziti ps stats- Example:
$ ziti ps stats goroutines: 50 OS threads: 19 GOMAXPROCS: 12 num CPU: 12 - Run tracing for 5 seconds and return the result
ziti ps trace
- Set the GC target percentage
ziti ps setgc <percentage>
Disabling the Agent
The agent is enabled by default. It can be disabled using --cliagent false.
Configuring Agent
By default, the agent will listen on a Unix socket at /tmp/gops-agent.<pid>.sock. You can change this to a custom unix socket or use a network socket instead.
Examples:
ziti-controller --cli-agent-addr unix:/tmp/my-special-agent-file.sockziti-controller --cli-agent-addr tcp:127.0.0.1:10001
The agent uses unix sockets to limit security risk. Only the user on the machine who started the application, or the root user should be able to access the socket.
Selecting Agent
When running ziti ps, the target agent may be specified in a few different ways.
- If no target is provided it will scan in
/tmpfor valid sockets. If only one is found, that one will be used. If multiple are found and error will be reported along with the different running processes. - The target can be listed by name. So if you have a ziti-controller and a ziti-router running, you can do
ziti ps goversion ziti-routerit will find the ziti-router and talk with that. If you have multiple ziti-routers running, this will fail. - You can specify the application PID. Example:
ziti ps goversion 1224770 - If you are using network sockets you can specify the address. Example:
ziti ps goversion tcp:my-host:10001