首页 > 系统相关 >随笔-Centos7 install systemtap

随笔-Centos7 install systemtap

时间:2023-11-13 23:13:07浏览次数:38  
标签:kernel systemtap debuginfo devel Centos7 SystemTap install packages

SystemTap Beginners Guide

Chapter 2. Using SystemTap

This chapter instructs users how to install SystemTap, and provides an introduction on how to run SystemTap scripts.

2.1. Installation and Setup

To deploy SystemTap, SystemTap packages along with the corresponding set of -devel, -debuginfo and -debuginfo-common-arch packages for the kernel need to be installed. To use SystemTap on more than one kernel where a system has multiple kernels installed, install the -devel and -debuginfo packages for each of those kernel versions.
These procedures will be discussed in detail in the following sections.

Important
Many users confuse -debuginfo with -debug packages. Remember that the deployment of SystemTap requires the installation of the -debuginfo package of the kernel, not the -debug version of the kernel.

2.1.1. Installing SystemTap

To deploy SystemTap, install the systemtap and systemtap-runtime packages by running the following command as root:

~]# yum install -y systemtap systemtap-runtime

2.1.2. Installing Required Kernel Information Packages

SystemTap needs information about the kernel in order to place instrumentation in it (probe it). This information, which allows SystemTap to generate the code for the instrumentation, is contained in the matching kernel-devel, kernel-debuginfo, and kernel-debuginfo-common-arch packages (where arch is the hardware platform of your system, which you can determine by running the uname -m command).
While the kernel-devel package is available from the default Red Hat Enterprise Linux repository, the kernel-debuginfo and kernel-debuginfo-common-arch packages are available from the debug repository.

To install the required packages, enable the debug repository for your system:

~]# subscription-manager repos --enable=rhel-7-variant-debug-rpms

In the above command, replace variant with server, workstation, or client, depending on the variant of the Red Hat Enterprise Linux system you are using. To determine the variant, you can use the following command:

~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.2 (Maipo)

The version, variant, and architecture of the kernel-devel, kernel-debuginfo, and kernel-debuginfo-common-arch packages must exactly match the kernel to be probed with SystemTap. To determine what kernel your system is currently running, use:

uname -r
3.10.0-327.el7.x86_64

For example, if you wish to use SystemTap on kernel version 3.10.0-327.4.4.el7 on an AMD64 or Intel 64 machine, then you need to install the following packages:

  • kernel-debuginfo-3.10.0-327.4.4.el7.x86_64.rpm
  • kernel-debuginfo-common-x86_64-3.10.0-327.4.4.el7.x86_64.rpm
  • kernel-devel-3.10.0-327.4.4.el7.x86_64.rpm

To use the yum package manager to install the packages required for running SystemTap on the current kernel, execute the following command as root:

~]# yum install -y kernel-devel-$(uname -r) \
kernel-debuginfo-$(uname -r) \
kernel-debuginfo-common-$(uname -m)-$(uname -r)

2.1.3. Initial Testing

If the kernel to be probed with SystemTap is currently being used, it is possible to immediately test whether the deployment was successful. If a different kernel is to be probed, reboot and load the appropriate kernel.
To start the test, run the following command:

stap -v -e 'probe vfs.read {printf("read performed\n"); exit()}'

This command simply instructs SystemTap to print read performed and then exit properly once a virtual file system read is detected. If the SystemTap deployment was successful, you should get output similar to the following:

Pass 1: parsed user script and 45 library script(s) in 340usr/0sys/358real ms.
Pass 2: analyzed script: 1 probe(s), 1 function(s), 0 embed(s), 0 global(s) in 290usr/260sys/568real ms.
Pass 3: translated to C into "/tmp/stapiArgLX/stap_e5886fa50499994e6a87aacdc43cd392_399.c" in 490usr/430sys/938real ms.
Pass 4: compiled C into "stap_e5886fa50499994e6a87aacdc43cd392_399.ko" in 3310usr/430sys/3714real ms.
Pass 5: starting run.
read performed
Pass 5: run completed in 10usr/40sys/73real ms.

The last three lines of the output (beginning with Pass 5) indicate that SystemTap was able to successfully create the instrumentation to probe the kernel, run the instrumentation, detect the event being probed (in this case, a virtual file system read), and execute a valid handler (print text and then close it with no errors).

标签:kernel,systemtap,debuginfo,devel,Centos7,SystemTap,install,packages
From: https://www.cnblogs.com/stellar-liyanbin/p/17830549.html

相关文章

  • Error: install profile containers-default-0.50.1: generate default profile into
    Bug#2040082“errorparsingAppArmorversion”:Bugs:golang-github-containers-commonpackage:UbuntuBug#2040082“errorparsingAppArmorversion”:Bugs:golang-github-containers-commonpackage:Ubuntu......
  • centos7 关闭swap分区
    目录1.查看swap分区信息2.关闭swap分区 1.查看swap分区信息通过free-h命令查看[root@k8s-master-02~]#free-htotalusedfreesharedbuff/cacheavailableMem:1.8G131M1.4G8.9M212M1.5GSwap:2.0G0B2.0G 2.关闭swap分区2.1临时关闭( swapoff-a )[r......
  • Nessus 10.6 Auto Installer for macOS Sonoma (updated Nov 2023)
    Nessus10.6AutoInstallerformacOSSonoma(updatedNov2023)发布Nessus试用版自动化安装程序,支持macOSSonoma、RHEL9和Ubuntu22.04请访问原文链接:https://sysin.org/blog/nessus-auto-install-for-macos/,查看最新版。原创作品,转载请保留出处。作者主页:sysin.org......
  • pyinstaller 生成exe
    网上找到的方法是python有个库,pyinstaller安装pyinstaller可以直接在cmd命令行中,输入代码来安装pyinstallerpipinstallpyinstaller打包文件成exe程序(下面举个栗子)1.​​​​​​将cmd的目录切换至(命令:cd文件路径(注意空格))需要打包的py文件目录下: 该目录下资源如下图: ......
  • Centos7 nginx反向代理gitea和grafana&钉钉告警
    1安装nginxyuminstall-ygccmakepcre-develzlib-developenssl-develwgethttps://nginx.org/download/nginx-1.20.1.tar.gztar-zxvfnginx-1.20.1.tar.gzcdnginx-1.20.1./configure--prefix=/usr/local/nginx--with-http_ssl_modulemakemakeinstallvi/etc/system......
  • CentOS7编译安装openssl1.1.1
    Centos7默认提供的openssl版本是1.0.2的,想要升级openssl版本则需要手动进行编译一、下载openssl1.1.1cd/usr/local/src/wget--no-check-certificatehttps://www.openssl.org/source/openssl-1.1.1d.tar.gz二、创建安装目录mkdir-p/usr/local/openssl 三、解压......
  • CentOS7安装Java8
    1.卸载系统自带的OpenJDK以及相关的java文件 键入命令java-version  键入命令rpm-qa|grepjava  把带openjdk的都删除  rpm-e--nodeps 验证是否删干净   2.解压java8到相应目录配置JDK环境变量键入命令 vim/etc/profile修改配置文件,记得要在root权限下修改e......
  • 【CentOS】CentOS7安装PostgreSQL
    1、安装PostgreSQL使用以下命令安装PostgreSQL:sudoyuminstallpostgresql-serverpostgresql-contrib 2、初始化数据库执行以下命令来初始化PostgreSQL数据库:sudopostgresql-setupinitdb 3、启动PostgreSQL服务启动PostgreSQL服务&& 设置PostgreSQL......
  • centos7 扩展硬盘
    新增硬盘后       注意,我这里用的xfs!!!注意,文件夹不能已存在的!!尽量不要把多个硬盘挂载在同一个文件夹上!!!  vi/etc/fstab 注意,用00即可  查看uuid=>blkid/dev/sdb1  df-h ......
  • vue中执行npm install提示:npm WARN deprecated [email protected]
    场景:在执行npminstall时提示[email protected],导致安装不了 提示的意思是:版本低不再维护了,让升级upgradeyourdependenciestotheactualversionofcore-js.   [email protected]:core-js@<3.23.3isnolongermaintainedand......