Skip to main content
Redhat Developers  Logo
  • AI

    Get started with AI

    • Red Hat AI
      Accelerate the development and deployment of enterprise AI solutions.
    • AI learning hub
      Explore learning materials and tools, organized by task.
    • AI interactive demos
      Click through scenarios with Red Hat AI, including training LLMs and more.
    • AI/ML learning paths
      Expand your OpenShift AI knowledge using these learning resources.
    • AI quickstarts
      Focused AI use cases designed for fast deployment on Red Hat AI platforms.
    • No-cost AI training
      Foundational Red Hat AI training.

    Featured resources

    • OpenShift AI learning
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

    Red Hat AI Factory with NVIDIA

    • Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.
    • Explore the solution
  • Learn

    Self-guided

    • Documentation
      Find answers, get step-by-step guidance, and learn how to use Red Hat products.
    • Learning paths
      Explore curated walkthroughs for common development tasks.
    • Guided learning
      Receive custom learning paths powered by our AI assistant.
    • See all learning

    Hands-on

    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.
    • Interactive labs
      Learn by doing in these hands-on, browser-based experiences.
    • Interactive demos
      Click through product features in these guided tours.

    Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics

    Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
  • Build

    Get started

    • Red Hat build of Podman Desktop
      A downloadable, local development hub to experiment with our products and builds.
    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.

    Download products

    • Access product downloads to start building and testing right away.
    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset

    References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
  • Community

    Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions

    Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github

    Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

    Join the Red Hat Developer program

    • Download Red Hat products and project builds, access support documentation, learning content, and more.
    • Explore the benefits

ISystemTap: An interactive SystemTap notebook

June 30, 2023
Ryan Goldberg
Related topics:
C, C#, C++Linux
Related products:
Red Hat Enterprise Linux

SystemTap is a tool that streamlines the gathering of real-time information about a running Linux system. It can probe and even modify running processes in both the user and kernel spaces, so you can easily monitor your programs without recompiling and installing tools on your system. It also provides many tapsets, or prewritten libraries that aid in these tasks.

But to a beginner, SystemTap can be overwhelming, and it can be said that with this great power comes an equally great learning curve. To solve this issue, we've introduced an interactive, beginner-friendly interface called ISystemTap.

About ISystemTap

ISystemTap is a Jupyter kernel that allows for running SystemTap scripts in an easy, incremental way within Jupyterlab, a lightweight web-browser-based client for executing IPython notebook format documents. It has been popularized with the IPython and IRkernel kernels for education, data science, and machine learning.

Getting started

ISystemTap can run right on your machine or from within a container. To get started, install the latest version of SystemTap, currently version 4.9. You will also need SSH to be running on your machine. If it's not running, start it using systemd:

sudo systemctl start sshd

The following setup will be done for the root user, but alternatively any user in the groups stapusr and stapdev can run SystemTap as if with root privileges. In this case, the following would not need to be run with sudo.

If you don't have an SSH key available for the root user, create one with the default name id_rsa:

sudo ssh-keygen -t rsa -b 4096

Then execute sudo stap-jupyter-container --run to start the container as the root user.

This method uses containers to hold Jupyter and related Python packages that are not included in our typical Linux distributions. Feel free to follow along with this article's examples in the RedHatBlog.ipynb or ISystemtap.ipynb notebook files.

Example: Hello ISystemTap

At its core, ISystemTap, like all Jupyter notebooks, is a collection of cells. We further introduce the concept of combining groups of cells under a common namespace, which allows cells to share information amongst themselves.

The best way to show this is using an example. Take the following 3 cells in the helloworld namespace:


%%edit helloworld



global ns



probe begin {



  println("Hello ISystemtap")



  ns = module_name()



}

%%edit helloworld



probe oneshot{



  printf("I am the namespace %s\n", ns)



}

%%run helloworld

Cell Output 1: Running the helloworld namespace:

Hello ISystemTap

I am the namespace helloworld

Executing the first 2 edit cells will add them to the helloworld namespace, with the first cell defining a begin probe-point and a global called ns, and the second defining a oneshot probe-point. Executing the run cell will stitch the edit cells together in the order in which they were executed and run them as a SystemTap script. Notice that ns was defined in the first cell but can be used in the second.

The power of Python

ISystemTap replaces SystemTap's ASCII histograms with rich inline figures, allowing the user to get interactive graphics right alongside the rest of the output. Take the following example, which also introduces the script cell, a cell that combines an edit cell and a run cell:


%%script histogram



global accumulator



global i = 0







probe timer.ms(100){



  printf("ping %d\n", i)



  accumulator <<< randint(i*64+32)



  if (i++ > 10)



    exit()



}







probe end{



  println("Printing Histogram")



  println(@hist_log(accumulator))



  print("All done\n")



}

The cell 2 output is illustrated in Figure 1.

Cell Output 2: Running the histogram namespace
Figure 1: Cell output 2: Running the histogram namespace.

ISystemTap also introduces the python cell, which takes the defined globals from a completed namespace and lets the user access them with Python code. This allows the user to pipeline system information directly into data manipulation tools like numpy and pandas as well as visualization tools like bqplot. The globals are defined as Python global variables and can be accessed in the same way as any other Python data:


%%python histogram



print(f'{accumulator = }')



print(f'{i = }')



print(f'{i == accumulator["@count"] = }')

Cell Output 3: Running a Python cell in the histogram namespace:

accumulator = {'@count': 11, '@min': 14, '@max': 390, '@sum': 2189, '@avg': 199}

i = 11

i == accumulator["@count"] = True

Monitoring the state

ISystemTap doesn't just provide cells for the user; it also provides a new interface for SystemTap in the form of a control widget. This widget gives the user data about the namespace's current state, such as its runtime and how much memory it is using (see Figure 2).

The ISystemTap control widget with memory information.
Figure 2: A control widget of a namespace that completed in 1 second.

Additionally, ISystemTap provides a panel for pausing some or all probes as well as resetting globals to their initial states. The control widget further lets the user see the current values of the various globals as well as some metrics about the probe points. Astute readers might recognize this as the SystemTap monitor mode, which is available without ISystemTap as stap --monitor.

Writing SystemTap scripts

Thus far, we've talked about running existing scripts, but now we'll discuss a new powerful feature for writing scripts: the SystemTap Language Server.

A language server aims to solve the MxN complexity problem of adding useful language development features, such as code completion, to various editors. Instead of each language having a unique editor-specific interface for its particular implementation (e.g., python-vscode, python-vim, python-emacs), there is one language server implementation that can communicate with many language server clients, one for each editor, reducing the complexity to M+N. The SystemTap Language Server supports code completion and has been tested with many popular editors such as VS Code, Vim, Emacs, and Jupyterlab.

SystemTap code completion covers many common actions one might need when writing scripts. It will complete probe points, functions, and globals from the current script and library tapsets. It will also complete macros, strings, and even context variables within relevant probe points, providing documentation as possible. It is worth noting that the language server is built upon a custom C++ SDK which can be used for the creation of other language servers in C++.

Installation is straightforward, with a comprehensive guide with the required manual configuration steps provided in the SystemTap documentation. ISystemTap's install script includes these steps.

Conclusion

Check out our interactive demo to try all of these features and a few others, including a new interface to the SystemTap example scripts and a widget that lists all the probe points that match a user input. Both ISystemTap and the language server are included in SystemTap 4.9.

If you encounter any issues or have any feedback about either of these, please feel free to reach out to us at systemtap@sourceware.org.

Last updated: August 14, 2023

Related Posts

  • Use a SystemTap example script to trace kernel code operation

  • Explore new features in SystemTap 4.5.0

  • Write a SystemTap script to trace code execution on Linux

  • How to trace application errors using SystemTap

  • Reducing the startup overhead of SystemTap monitoring scripts with syscall_any tapset

Recent Posts

  • Protect data offloaded to GPU-accelerated environments with OpenShift sandboxed containers

  • Case study: Measuring energy efficiency on the x64 platform

  • How to prevent AI inference stack silent failures

  • Preventing GPU waste: A guide to JIT checkpointing with Kubeflow Trainer on OpenShift AI

  • How to manage TLS certificates used by OpenShift GitOps operator

What’s up next?

systemd Commands cheat sheet card image

Users and administrators query and control systemd behavior through the systemctl command. The systemd Commands Cheat Sheet presents the most common uses of systemctl, along with journalctl for displaying information about systemd activities from its logs.

Get the cheat sheet
Red Hat Developers logo LinkedIn YouTube Twitter Facebook

Platforms

  • Red Hat AI
  • Red Hat Enterprise Linux
  • Red Hat OpenShift
  • Red Hat Ansible Automation Platform
  • See all products

Build

  • Developer Sandbox
  • Developer tools
  • Interactive tutorials
  • API catalog

Quicklinks

  • Learning resources
  • E-books
  • Cheat sheets
  • Blog
  • Events
  • Newsletter

Communicate

  • About us
  • Contact sales
  • Find a partner
  • Report a website issue
  • Site status dashboard
  • Report a security problem

RED HAT DEVELOPER

Build here. Go anywhere.

We serve the builders. The problem solvers who create careers with code.

Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

Sign me up

Red Hat legal and privacy links

  • About Red Hat
  • Jobs
  • Events
  • Locations
  • Contact Red Hat
  • Red Hat Blog
  • Inclusion at Red Hat
  • Cool Stuff Store
  • Red Hat Summit
© 2026 Red Hat

Red Hat legal and privacy links

  • Privacy statement
  • Terms of use
  • All policies and guidelines
  • Digital accessibility

Chat Support

Please log in with your Red Hat account to access chat support.