当前位置:网站首页>工具| execsnoop 短时进程追踪工具
工具| execsnoop 短时进程追踪工具
2022-07-30 14:44:00 【用户1278550】
一 前言
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 请求的情况是抓取不到的。
边栏推荐
猜你喜欢
随机推荐
去腾讯面试,直接让人出门左拐 :幂等性都不知道!
Ts是什么?
瑞吉外卖项目实战Day02
基于5G的仓储信息化解决方案2022
(Crypto essential dry goods) Detailed analysis of the current NFT trading markets
71页全域旅游综合整体解决方案2021 ppt
Get the Google Advertising ID as a unique identifier
MASM32v11编程调用Process32First失败: 程序发出命令,但命令长度不正确
golang modules initialization project
JUC common thread pool source learning 02 ( ThreadPoolExecutor thread pool )
这个编辑器居然号称快如闪电!
4位资深专家多年大厂经验分享出Flink技术内幕架构设计与实现原理
About the data synchronization delay of MySQL master-slave replication
timed task corn
JUC常见的线程池源码学习 02 ( ThreadPoolExecutor 线程池 )
《二舅》刷屏了!
ToDesk版本更新,引入RTC传输技术,是否早以替代向日葵远程控制?
952. 按公因数计算最大组件大小 : 枚举质因数 + 并查集运用题
Lock wait timeout exceeded解决方案
4 senior experts share the insider architecture design and implementation principles of Flink technology with years of experience in large factories