当前位置:网站首页>execsnoop 工具
execsnoop 工具
2022-07-31 02:31:00 【北在南方】
execsnoop
一 前言
execsnoop -- 短时进程追踪工具,它能够抓取服务器上瞬时执行的命令,类似 history 但是execsnoop 是实时记录全系统在执行的命令。
当我们遇到性能问题,但是通过 vmstat,dstat,top 等工具分析不到导致问题的进程,可以考虑使用 execsnoop 。看看是否能够抓到瞬时执行的命令请求。 前文说的案例就是 一例。 当机器 cpu 负载持续高涨却抓取不到 top 进程时,可以采用 execsnoop 抓取短时进程。
二 使用
execsnoop 的安装非常简单,其实它就是一个 可执行的 shell 。
下载:
https://github.com/brendangregg/perf-tools/blob/master/execsnoop
安装 ,则是下载或者拷贝文件内容 写到 /usr/bin/execsnoop ,并执行 chmod +x /usr/bin/execsnoop
使用方法:
execsnoop 的参数
[[email protected] ~]# execsnoop -h
USAGE: execsnoop [-hrt] [-a argc] [-d secs] [name]
-d seconds # trace duration, and use buffers
-a argc # max args to show (default 8)
-r # include re-execs
-t # include time (seconds)
-h # this usage message
name # process name to match (REs allowed)
eg,
execsnoop # watch exec()s live (unbuffered)
execsnoop -d 1 # trace 1 sec (buffered)
execsnoop grep # trace process names containing grep
execsnoop 'udevd$' # process names ending in "udevd"
比如我们要抓取谁访问了 mysql
[[email protected] ~]# execsnoop mysql ## mysql 是指 进程的name
Tracing exec()s issued by process name "mysql". Ctrl-C to end.
Instrumenting sys_execve
PID PPID ARGS
22632 22631 /data/sandboxes/mysql_binary/5.7.31/bin/mysql --defaults-file=/data/msb_5_7_31/my.sandbox.cnf
22661 22660 /data/sandboxes/mysql_binary/5.7.31/bin/mysql --defaults-file=/data/msb_5_7_31/my.sandbox.cnf
22700 22699 /data/sandboxes/mysql_binary/5.7.31/bin/mysql --defaults-file=/data/msb_5_7_31/my.sandbox.cnf -e select now();
^C
Ending tracing...
该工具只能抓取一次性执行的命令,如果是长连接比如通过tcp ip 连接,然后发送SQL 请求的情况是抓取不到的。
边栏推荐
- How to design the changing system requirements
- STP选举(步骤+案列)详解
- 19. Support Vector Machines - Intuitive Understanding of Optimization Objectives and Large Spacing
- Clustering index, and what is the difference between a clustering index
- 你们程序员为什么不靠自己的项目谋生?而必须为其他人打工?
- Nacos
- Drools基本介绍,入门案例,基本语法
- 修改未正确放入沙盒造成苹果兼容性问题
- 12 pictures take you to fully understand service current limit, circuit breaker, downgrade, and avalanche
- 数学解决——环形链表问题
猜你喜欢
Face detection based on opencv
静态路由解析(最长掩码匹配原则+主备路由)
The real CTO is a technical person who understands products
Intel's software and hardware optimization empowers Neusoft to accelerate the arrival of the era of smart medical care
基于opencv实现人脸检测
CorelDRAW2022精简亚太新增功能详细介绍
数学解决——环形链表问题
Classic linked list OJ strong training problem - fast and slow double pointer efficient solution
10 权限介绍
mmdetection训练一个模型相关命令
随机推荐
AI在医疗影像设备全流程应用
曼城推出可检测情绪的智能围巾,把球迷给整迷惑了
【AcWing 62nd Weekly Game】
JS 函数 this上下文 运行时点语法 圆括号 数组 IIFE 定时器 延时器 self.备份上下文 call apply
Arbitrum Interview | L2 Summer, what does the standout Arbitrum bring to developers?
The principle of complete replication of virtual machines (cloud computing)
How to expose Prometheus metrics in go programs
[1153] The boundary range of between in mysql
Maximum area of solar panel od js
Drools WorkBench的简介与使用
934. The Shortest Bridge
f.grid_sample
tcp框架需要解决的问题
Drools基本介绍,入门案例,基本语法
Shell script to loop through values in log file to sum and calculate average, max and min
leetcode-128: longest continuous sequence
String为什么不可变?
Coldfusion file read holes (CVE - 2010-2861)
Drools Rule Properties, Advanced Syntax
Clustering index, and what is the difference between a clustering index