当前位置:网站首页>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 请求的情况是抓取不到的。
边栏推荐
- mmdetection trains a model related command
- How to expose Prometheus metrics in go programs
- 1. Non-type template parameters 2. Specialization of templates 3. Explanation of inheritance
- SQL注入 Less46(order by后的注入+rand()布尔盲注)
- What are the project management tools like MS Project
- [1153] The boundary range of between in mysql
- Coldfusion file read holes (CVE - 2010-2861)
- 直播预告 | KDD2022博士论文奖冠亚军对话
- Manchester City confuses fans with smart scarf that detects emotions
- coldfusion8 background scheduled tasks take shell
猜你喜欢

STM32CUBEMX开发GD32F303(11)----ADC在DMA模式下扫描多个通道

Between two orderly array of additive and Topk problem

The principle of complete replication of virtual machines (cloud computing)

String为什么不可变?

The Sad History of Image Processing Technology

Force buckled brush the stairs (7/30)

Nacos

Maximum monthly salary of 20K?The average salary is nearly 10,000... What is the experience of working in a Huawei subsidiary?

SQL注入 Less46(order by后的注入+rand()布尔盲注)

跨专业考研难度大?“上岸”成功率低?这份实用攻略请收下!
随机推荐
Classic linked list OJ strong training problem - fast and slow double pointer efficient solution
Clustering index, and what is the difference between a clustering index
What are the project management tools like MS Project
Difference between CMOS and TTL?
STM32CUBEMX开发GD32F303(11)----ADC在DMA模式下扫描多个通道
医疗影像领域AI软件开发流程
User interaction + formatted output
力扣刷题之爬楼梯(7/30)
mysql view
公司官网建站笔记(六):域名进行公安备案并将备案号显示在网页底部
mysql index
First acquaintance with C language -- array
AtCoder Beginner Contest 261 部分题解
完整复制虚拟机原理(云计算)
Mathematics to solve the problem - circular linked list
Introduction and use of Drools WorkBench
Layer 2 broadcast storm (cause + judgment + solution)
Drools basic introduction, introductory case, basic syntax
mysql 视图
JS 函数 this上下文 运行时点语法 圆括号 数组 IIFE 定时器 延时器 self.备份上下文 call apply