Linux observability with bpf pdf

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

License

VestiDev/linux-observability-with-bpf-book

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

Linux Observability with BPF code examples

This is the companion code repo for the book Linux Observability with BPF.

We believe that even if the examples included in the book were all tested and working when we wrote them, human error is possible and technology changes. For that reason, the purpose of this repo is to keep them as updated as possible and correct mistakes we made while writing the book.

Nota Bene: All the examples in this repository are adapted from the book to assume that you use the Vagrant environment we provide. Examples can be slightly different in this repository because of that. The reason is that we didn’t want to couple the book itself to Vagrant as a tool. If you don’t want a Vagrant based environment, make sure you have: bcc and clang

  • Please expand the details of the environment you want to work on.
  • Remember that the examples have been tested on the Vagrant based environment primarily.
  • Feel free to open an issue or a PR if you want to help in making this better for everyone!
Читайте также:  Android ndk linux bin

First, we need to install some build dependencies and all the tools needed for the examples:

sudo dnf install make glibc-devel.i686 elfutils-libelf-devel wget tar clang bcc strace kernel-devel -y

Then we need grab a copy of the source code of the current kernel.

In our case the kernel runing can be verified with uname .

Given that version, please notice the URL we fetch the sources from in the following command. Change it according to your version.

cd /tmp wget -c https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.0.9.tar.gz -O - | tar -xz

Now that we have the kernel source, we can move it to the /kernel-src folder.

NOTE THAT: All the examples using kernel sources in this repo assume that the kernel sources are available there. In case you don’t like it, make sure you do a search and replace!

At this point we move the kernel sources and compile libbpf . Again please notice the 5.0.9 here and change accordingly.

sudo mv linux-5.0.9 /kernel-src cd /kernel-src/tools/lib/bpf sudo make && sudo make install prefix=/ 

First, we need to install some build dependencies and all the tools needed for the examples:

sudo apt update sudo apt install build-essential git make libelf-dev clang strace tar bpfcc-tools linux-headers-$(uname -r) gcc-multilib

Note on Kernel version: make sure to have a recent kernel to run the examples, a version >=5.0.0 will do the job. Most Ubuntu 18.04 providers are shipping with the kernel 4.15 that doesn’t work for most of the examples. Upgrading options are left to the reader, we’ve been successful on aws by installing the linux-image-5.0.0-1019-aws package.

Читайте также:  Ip телефония настройка linux

After dependencies, we need grab a copy of the kernel source code for the current release. Since this assumes that you are running an updated Ubuntu 18.04 we can get it directly from the repo they provide.

cd /tmp git clone --depth 1 git://kernel.ubuntu.com/ubuntu/ubuntu-bionic.git 

Now that we have the kernel source, we can move it to the /kernel-src folder.

NOTE THAT: All the examples using kernel sources in this repo assume that the kernel sources are available at /kernel-src . In case you don’t like it, make sure you do a search and replace!

At this point we move the kernel sources and compile libbpf .

sudo mv ubuntu-bionic /kernel-src cd /kernel-src/tools/lib/bpf sudo make && sudo make install prefix=/usr/local 

Ubuntu doesn’t have the library path that the makefile expects so we need to move our libraries to its library path now.

sudo mv /usr/local/lib64/libbpf.* /lib/x86_64-linux-gnu/ 

Vagrant (recommended) We provide reproducible environment in the form of a Vagrantfile that installs all the needed to make the examples work.

The environment is based on Fedora 30.

To install Vagrant, follow the official guide here.

Once you have Vagrant installed, you will need to clone this repository and issue a vagrant up .

git clone https://github.com/bpftools/linux-observability-with-bpf.git cd linux-observability-with-bpf vagrant up

This Vagrant command, will start a Fedora 30 VM in Virtualbox, you can SSH into the machine using:

Before going on, make sure you download the kernel source tree in this repository. It is needed as a dependency for some examples. We will be downloading the code for Kernel 5.0.9 — We are avoiding a git clone here because the Git history of the kernel is very big.

cd /tmp wget -c https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.0.9.tar.gz -O - | tar -xz sudo mv linux-5.0.9 /kernel-src

At this point, we need to compile the libbpf library:

cd /kernel-src/tools/lib/bpf make && sudo make install prefix=/ 

Before going to the examples, it will be useful to have a copy of this repo in your environment.

git clone https://github.com/bpftools/linux-observability-with-bpf.git ~/linux-observability-with-bpf 

IMPORTANT NOTE: The examples assume that you clone the repo in your home folder ~/linux-observability-with-bpf , if you didn’t do please remember to change your commands!

Читайте также:  Ошибка загрузки компоненты moxel linux

Yay, at this point you have everything and can follow the following code examples.

Click on each example to follow the setup instructions.

Источник

Linux Observability with BPF: Advanced Programming for Performance Analysis and Networking [1 ed.] 1492050202, 9781492050209

Linux Observability with BPF: Advanced Programming for Performance Analysis and Networking [1 ed.] 1492050202, 9781492050209

Coding Language for Machine Learning and Artificial Intelligence.

BPF Performance Tools 0136554822, 9780136554820

BPF Performance Tools 0136554822, 9780136554820

Use BPF Tools to Optimize Performance, Fix Problems, and See Inside Running Systems BPF-based performance tools give yo

COMPUTER PROGRAMMING FOR BEGINNERS: 4 Books in 1. LINUX COMMAND-LINE + PYTHON Programming + NETWORKING + HACKING with KALI LINUX. Cybersecurity, Wireless, LTE, Networks, and Penetration Testing 9798651465019

COMPUTER PROGRAMMING FOR BEGINNERS: 4 Books in 1. LINUX COMMAND-LINE + PYTHON Programming + NETWORKING + HACKING with KALI LINUX. Cybersecurity, Wireless, LTE, Networks, and Penetration Testing 9798651465019

If you want to know more about Linux and Python Programming and get a good knowledge of Networking and Hacking, to prote

COMPUTER PROGRAMMING FOR BEGINNERS: 4 Books in 1. LINUX COMMAND-LINE + PYTHON Programming + NETWORKING + HACKING with KALI LINUX. Cybersecurity, Wireless, LTE, Networks, and Penetration Testing 9798651465019

COMPUTER PROGRAMMING FOR BEGINNERS: 4 Books in 1. LINUX COMMAND-LINE + PYTHON Programming + NETWORKING + HACKING with KALI LINUX. Cybersecurity, Wireless, LTE, Networks, and Penetration Testing 9798651465019

If you want to know more about Linux and Python Programming and get a good knowledge of Networking and Hacking, to prote

COMPUTER PROGRAMMING FOR BEGINNERS: 4 Books in 1. LINUX COMMAND-LINE + PYTHON Programming + NETWORKING + HACKING with KALI LINUX. Cybersecurity, Wireless, LTE, Networks, and Penetration Testing 9798651465019

COMPUTER PROGRAMMING FOR BEGINNERS: 4 Books in 1. LINUX COMMAND-LINE + PYTHON Programming + NETWORKING + HACKING with KALI LINUX. Cybersecurity, Wireless, LTE, Networks, and Penetration Testing 9798651465019

If you want to know more about Linux and Python Programming and get a good knowledge of Networking and Hacking, to prote

Mastering Python networking: advanced networking with Python 9781784397005, 1784397008, 2552552552

Mastering Python networking: advanced networking with Python 9781784397005, 1784397008, 2552552552

Become an expert in implementing advanced, network-related tasks with Python. About This Book — Build the skills to perf

Источник

Оцените статью
Adblock
detector