What you will learn in this TP
- Run bpftrace
- Write one-liners
- Use the bcc tools
All steps and instructions are shown. Recommended for this lab: guided
Introduction #
Context. A server “crawls” from time to time and the usual metrics do not explain why. You use eBPF to observe in detail what is going on.
Prerequisites: Linux host (VM or physical machine, kernel 5.8+), root access · Estimated time: 40 min
Your first eBPF diagnostics.Hands-on #
Guided steps, with their solutions.
1. Check the kernel
Why? eBPF depends on kernel features: check them first before looking for a problem elsewhere.
Display the kernel version and check that BTF is available.2. Run bpftrace
Why? The container avoids installing packages on a production server.
Run bpftrace in a privileged container and list the tracepoints related toopenat.3. Who opens which files?
Why? Seeing which files are opened often reveals a configuration file re-read in a loop or a missing file.
Display opened files live, then keep only those of a single process (for examplesshdornginx).4. Count and measure
Why? In-kernel aggregations give a statistical view without flooding the terminal.
Count system calls per process for 10 s, then plot the latency histogram ofvfs_read.5. The bcc tools
Why? These tools answer the most common questions in a single command.
Installbpfcc-tools, runexecsnoopin one terminal and executefor i in $(seq 5); do date; donein another. Then runbiolatencyduring a file copy.
Validate your work
Check that each goal above is reached and that you get the result described in the introduction.
Difficulty level : ●●○○○ (2/5)
My progress
Sign in to track your progress and take notes. Sign in
💬 Questions about this lesson
No questions yet: be the first to ask for help or share your configuration.
Recommended Articles
eBPF explained: programs in the Linux kernel to observe without instrumenting
What eBPF is, how a program is verified and then run in the kernel, hook points (kprobes, uprobes...
Diagnosing with bpftrace and the bcc tools
Everyday eBPF diagnostic tools: bpftrace one-liners (system calls, files, latencies), bcc tools (...
Processes, memory and performance: monitoring and troubleshooting a Linux server
Understand and control Linux processes (ps, top, signals, nice, jobs), interpret load, memory and...
Backup, monitoring and troubleshooting of a Linux server
Operate a Linux server day to day: 3-2-1 backup strategy with rsync, tar, LVM snapshots and resti...
Linux server security and hardening
Harden a Linux server: least privilege, updates, secure SSH, firewall, fail2ban, SELinux and AppA...
Linux vs Unix: the complete guide to commands and distributions
Understand the differences between Linux and Unix, explore distributions (server, desktop, lightw...
Linux administration best practices
Checklist for administering Linux servers: accounts and sudo, SSH, updates, systemd services, sto...
Linux system architecture: kernel, boot and directory tree
Understand how a Linux server works: kernel and user space, the UEFI, GRUB, initramfs and systemd...
Networking on Linux: configuration, diagnosis, firewall and SSH
Configure and troubleshoot Linux networking: ip, ss, netplan and NetworkManager, DNS, layered dia...