Try   HackMD

Set up SystemTap on Fedora

The document is here. The installation document is here. This document is created in Feodra Linux 37.

$ sudo dnf install systemtap systemtap-runtime
$ sudo stap-prep
$ cat ~/script/stap/hello.stp
#! /usr/bin/env stap
probe oneshot { println("Hello!") }
$ sudo stap ~/script/stap/hello.stp
Hello!

Add groups to run a stap script by a regular user

Check the stap groups exist in the /etc/group.

$ cat /etc/group | grep ^stap
stapusr:x:156:
stapsys:x:157:
stapdev:x:158:

Add stapdev and stapusr to run the stap script.

$ sudo usermod --append --groups stapdev,stapusr jaruga

$ cat /etc/group | grep ^stap
stapusr:x:156:jaruga
stapsys:x:157:
stapdev:x:158:jaruga

$ sudo reboot

$ id -nG 
jaruga wheel mock stapusr stapdev docker libvirt

Run the sample script above by a regular user.

$ stap ~/script/stap/hello.stp
Hello!

Run an example of the stap script

There are prepared examples for the stap scripts here.

The example files are in the systemtap-client RPM package, and managed in the /usr/share/systemtap/examples directory.

$ rpm -ql systemtap-client | grep examples

You can call it like this.

$ stap --example helloworld.stp
hello world