#wrapper #ecli #client #stop #start #logging #http-client

app ecli-rs

ecli 的客户端包装器

6 个版本

0.2.9 2023 年 8 月 19 日
0.2.8 2023 年 7 月 18 日
0.2.6 2023 年 6 月 25 日
0.2.3 2023 年 5 月 21 日

#1711网络编程

Download history 20/week @ 2024-03-28 20/week @ 2024-04-04

每月 102 次下载

MIT 许可证

33KB
505 代码行

ecli / ecli-client

充当 HTTP 客户端

在端点上启动程序

$ ./ecli client start ./execve.wasm
1

在端点上列出正在运行的程序

$ ./ecli client list 
1 bpf-program-1682439684 Running
2 bpf-program-1682439688 Running

从端点获取日志

$ ./ecli client log 1

16:21:49 EXEC  sudo             52904   51113   /usr/bin/sudo
16:21:49 EXEC  ecli             52907   52906   target/debug/ecli
16:21:49 EXIT  ecli             52907   52906   [0] (419ms)
16:21:49 EXIT  sudo             52906   52904   [1]
16:21:49 EXIT  sudo             52904   51113   [0] (438ms)

停止程序

$ ./ecli client stop 1
$ ./ecli client list
2 bpf-program-1682439688 Running

用法

$ ./ecli client --help
Client operations

Usage: ecli client [OPTIONS] <COMMAND>

Commands:
  start   Start an ebpf program on the specified endpoint
  stop    Stop running a task on the specified endpoint
  log     Fetch logs of the given task
  pause   Pause the task
  resume  Resume the task
  list    List tasks on the server
  help    Print this message or the help of the given subcommand(s)

Options:
  -e, --endpoint <ENDPOINT>  API endpoint [default: http://127.0.0.1:8527]
  -h, --help                 Print help

充当原生客户端

  • 需要功能 native
$ ecli run ./ecli-lib/tests/bootstrap.wasm
TIME     EVENT COMM             PID     PPID    FILENAME/EXIT CODE
16:24:34 EXIT  sleep            53566   53561   [0]
16:24:34 EXEC  sed              53567   53561   /usr/bin/sed
16:24:34 EXIT  sed              53567   53561   [0] (1ms)
16:24:34 EXEC  cat              53568   53561   /usr/bin/cat
16:24:34 EXIT  cat              53568   53561   [0] (0ms)
16:24:34 EXIT  cpuUsage.sh      53569   53561   [0]

依赖项

~13–34MB
~567K SLoC