usage
This is an adapted version of opensnoop from bcc/libbpf-tools, you can check our source code here: examples/bpftools/opensnoop
example
This is an adapted version of opensnoop from bcc/libbpf-tools, you can check our source code here: examples/bpftools/opensnoop
Compile the opensnoop example locally like this:
$ cd examples/bpftools/opensnoop
$ docker run -it -v /userpath/eunomia-bpf/examples/bpftools/opensnoop:/src ghcr.io/eunomia-bpf/ecc-`uname -m`:latestuserpath needs to be replaced with your own repo path.
After compile the eBPF code, you can define a config file like this:
programs:
- name: opensnoop
metrics:
counters:
- name: eunomia_file_open_counter
description: test
labels:
- name: pid
- name: comm
- name: filename
from: fname
compiled_ebpf_filename: package.jsonuse the path to package.json as compiled_ebpf_filename in the config file. You can find the example at config.yaml.
Then, you can start the exporter:
$ ls
config.yaml eunomia-exporter package.json
$ sudo ./eunomia-exporter
Running ebpf program opensnoop takes 46 ms
Listening on http://127.0.0.1:8526
running and waiting for the ebpf events from perf event...
Receiving request at path /metricsDifferent from the bcc ebpf_exporter, the only thing you need to run on the deployment machine is the config file and package.json. There is no need to install LLVM/CLang for BCC.
The result is:
manage eBPF tracing program via API
start an eBPF exporter via web API:
$ curl -X POST http://127.0.0.1:8526/start -H "Content-Type: application/json" -d @examples/opensnoop/curl_post_example.json
{"id":1}see curl_post_example.json for the example of the request body.
list all running eBPF programs:
$ curl http://127.0.0.1:8526/list
[{"id":0,"name":"bootstrap"},{"id":1,"name":"opensnoop"}]stop an eBPF program:
$ curl -X POST http://127.0.0.1:8526/stop -H "Content-Type: application/json" -d '{"id": 1}'documents:
$ cargo build --release
$ target/release/eunomia-exporter -h
eunomia-exporter 0.1.0
USAGE:
eunomia-exporter [OPTIONS]
OPTIONS:
-c, --config <CONFIG> Sets a custom config file [default: config.yaml]
-h, --help Print help information
-V, --version Print version information继续阅读
返回索引
eunomia-bpf:简化并增强eBPF,支持CO-RE[^1]和WebAssembly[^2]
  ![DeepSource](https://deepsource.io/gh/eunomia-bpf/eunomia-bpf/?ref=reposi
上一篇 / 上一页
exporter
An prometheus and OpenTelemetry exporter for custom eBPF metrics, written in async rust: eunomia-exporter
下一篇 / 下一页
introduction
eunomia-bpf is a dynamic loading library/runtime and a compile toolchain framework, aim at helping you build and distribute eBPF programs easier.
- 最后更新
- 2026年3月8日
- 首次发布
- 2023年8月10日
- 贡献者
- 云微, oluceps
这个页面有帮助吗?