查看占用网络带宽最多的进程:
sysdig -c topprocs_net
as binary:
sysdig -s2000 -X -c echo_fds fd.cip=192.168.0.1
as ASCII:
sysdig -s2000 -A -c echo_fds fd.cip=192.168.0.1
这里显示网络传输功能,实际效果和tcpdump抓包是一样的。而且其本身也支持sysdig -w dump.scap抓包保存(可以配置-X或-A使用),抓好包也支持sysdir -r dump.scap读取。
查看连接最多的服务器端口:
in terms of established connections:
sysdig -c fdcount_by fd.sport "evt.type=accept"
in terms of total bytes:
sysdig -c fdbytes_by fd.sport
in terms of established connections
sysdig -c fdcount_by fd.cip "evt.type=accept"
in terms of total bytes
sysdig -c fdbytes_by fd.cip
sysdig -p"%proc.name %fd.name" "evt.type=accept and proc.name!=httpd"
查看使用硬盘带宽最多的进程:
sysdig -c topprocs_file
sysdig -c fdcount_by proc.name "fd.type=file"
sysdig -c topfiles_bytes
sysdig -c topfiles_bytes proc.name=httpd
sysdig -p "%12user.name %6proc.pid %12proc.name %3fd.num %fd.typechar %fd.name" evt.type=open
sysdig -c fdbytes_by fd.directory "fd.type=file"
sysdig -c fdbytes_by fd.filename "fd.directory=/tmp/"
sysdig -A -c echo_fds "fd.filename=passwd"
sysdig -c fdbytes_by fd.type
See the top processes in terms of CPU usage
sysdig -c topprocs_cpu
sysdig -c topprocs_cpu evt.cpu=0
sysdig -s4096 -A -c stdout proc.name=cat
查看机器所有的HTTP请求
sudo sysdig -s 2000 -A -c echo_fds fd.port=80 and evt.buffer contains GET
sudo sysdig -s 2000 -A -c echo_fds evt.buffer contains SELECT
sysdig -s 2000 -A -c echo_fds fd.sip=192.168.30.5 and proc.name=apache2 and evt.buffer contains SELECT
See the files where most time has been spent
sysdig -c topfiles_time
sysdig -c topfiles_time proc.name=httpd
sysdig -c topprocs_errors
sysdig -c topfiles_errors
sysdig fd.type=file and evt.failed=true
sysdig "proc.name=httpd and evt.type=open and evt.failed=true"
sysdig -c topscalls_time
sysdig -c topscalls "evt.failed=true"
sysdig -p "%12user.name %6proc.pid %12proc.name %3fd.num %fd.typechar %fd.name" evt.type=open and evt.failed=true
sysdig -c fileslower 1
Show the directories that the user "root" visits
sysdig -p"%evt.arg.path" "evt.type=chdir and user.name=root"
sysdig -A -c echo_fds fd.name=/dev/pretmx and proc.name=sshd
sysdig evt.type=open and fd.name contains /etc
sysdig -r file.scap -c list_login_shells tar
sysdig -r trace.scap.gz -c spy_users proc.loginshellid=5459
查看机器上运行的容器列表及其资源使用情况
sudo csysdig -vcontainers
sudo csysdig -pc
sudo sysdig -pc -c topprocs_cpu container.name=wordpress1
sudo sysdig -pc -c topprocs_net container.name=wordpress1
sudo sysdig -pc -c topprocs_net container.name=wordpress1
sudo sysdig -pc -c topfiles_bytes container.name=wordpress1
sudo sysdig -pc -c topconns container.name=wordpress1
sudo sysdig -pc -c spy_users container.name=wordpress1