Collect TCP metrics and send to InfluxDB
Go to file
2024-07-07 20:39:41 +02:00
Server Update project 2024-07-04 16:52:00 +02:00
common.h Update project 2024-07-07 20:39:41 +02:00
exec.sh Update project 2024-07-07 20:39:41 +02:00
ic.c First commit 2024-07-03 16:22:36 +02:00
ic.h First commit 2024-07-03 16:22:36 +02:00
influxdb.py Update project 2024-07-07 20:39:41 +02:00
load_bpf Update project 2024-07-07 20:39:41 +02:00
load_bpf.c Update project 2024-07-07 20:39:41 +02:00
main Update project 2024-07-07 20:39:41 +02:00
main.c Update project 2024-07-07 20:39:41 +02:00
main.py Update project 2024-07-07 20:39:41 +02:00
prometheus.py Update project 2024-07-07 20:39:41 +02:00
README.md First commit 2024-07-03 16:22:36 +02:00
tp_tcp_py.c Update project 2024-07-07 20:39:41 +02:00
tp_tcp.c Update project 2024-07-07 20:39:41 +02:00
tp_tcp.o Update project 2024-07-07 20:39:41 +02:00
vmlinux.h First commit 2024-07-03 16:22:36 +02:00

Introduction

This project collect some metrics for TCP. For doing that, I use eBPF.

Requirements

For executing and loading the eBPF program and to send data to InfluxDB, you need to install some packages:

Compile eBPF program

First, you need to dump the vmlinux header file, which contains all definitions codes of your Linux kernel:

sudo bpftool btf dump file /sys/kernel/btf/vmlinux format c > vmlinux.h

After that, you can compile the eBPF code:

$ clang-11 -g -O2 -target bpf -c tp_tcp.c -o tp_tcp.o

Now, I made a C script which can load the eBPF program and attach it:

$ gcc load_bpf.c -o load_bpf -lbpf

And you can execute it, but, you need to have the root privileges:

$ sudo ./load_bpf

InfluxDB

I use this project for sending data to InfluxDB.

The documentation of that project is here