Using Sysdig To Troubleshoot Like A Boss
Using Sysdig To Troubleshoot Like A Boss
1 of 17
http://bencane.com/2014/04/18/using-sysdig-to-troubleshoot-like-a-boss/
sysdig
strace
tcpdump
sysdig
tcpdump
tcpdump
sysdig
sysdig
sysdig
5/25/2015 12:21 PM
2 of 17
http://bencane.com/2014/04/18/using-sysdig-to-troubleshoot-like-a-boss/
sysdig
rpm
apt-get
yum
sysdig
sysdig
sysdig
curl
/etc/apt/sources.list.d/
5/25/2015 12:21 PM
3 of 17
http://bencane.com/2014/04/18/using-sysdig-to-troubleshoot-like-a-boss/
apt-get update
# apt-get update
sysdig
dpkg
3.11.0.12.13
amd64
Complete Generic
3.11.0-12.19
all
3.11.0-12.19
amd64
3.11.0.12.13
amd64
Generic Linux ke
5/25/2015 12:21 PM
4 of 17
http://bencane.com/2014/04/18/using-sysdig-to-troubleshoot-like-a-boss/
linuxgeneric
uname
# uname -r
3.11.0-12-generic
apt-get
uname -r
sysdig
5/25/2015 12:21 PM
5 of 17
http://bencane.com/2014/04/18/using-sysdig-to-troubleshoot-like-a-boss/
sysdig
tcpdump
sysdig
tcpdump
-w
# sysdig -w tracefile.dump
5/25/2015 12:21 PM
6 of 17
http://bencane.com/2014/04/18/using-sysdig-to-troubleshoot-like-a-boss/
tcpdump
sysdig
CTRL+C
sysdig
-r
# sysdig -r tracefile.dump
1 23:44:57.964150879 0 <NA> (7) > switch next=6200(sysdig)
2 23:44:57.966700100 0 rsyslogd (358) < read res=414 data=<6>[ 3785.473354] sysdig_probe: starting cap
ture.<6>[ 3785.473523] sysdig_probe:
3 23:44:57.966707800 0 rsyslogd (358) > gettimeofday
4 23:44:57.966708216 0 rsyslogd (358) < gettimeofday
5 23:44:57.966717424 0 rsyslogd (358) > futex addr=13892708 op=133(FUTEX_PRIVATE_FLAG|FUTEX_WAKE_OP) v
al=1
6 23:44:57.966721656 0 rsyslogd (358) < futex res=1
7 23:44:57.966724081 0 rsyslogd (358) > gettimeofday
8 23:44:57.966724305 0 rsyslogd (358) < gettimeofday
9 23:44:57.966726254 0 rsyslogd (358) > gettimeofday
10 23:44:57.966726456 0 rsyslogd (358) < gettimeofday
5/25/2015 12:21 PM
7 of 17
http://bencane.com/2014/04/18/using-sysdig-to-troubleshoot-like-a-boss/
sysdig
-A
sysdig
# sysdig -A
sysdig
tcpdump
sysdig
sysdig
-l
5/25/2015 12:21 PM
8 of 17
http://bencane.com/2014/04/18/using-sysdig-to-troubleshoot-like-a-boss/
# sysdig -l
---------------------Field Class: fd
fd.num
fd.type
fd.typechar
fd.name
<truncated output>
sysdig
5/25/2015 12:21 PM
9 of 17
http://bencane.com/2014/04/18/using-sysdig-to-troubleshoot-like-a-boss/
fd.name
# sysdig fd.name=/dev/log
14 11:13:30.982445884 0 rsyslogd (357) < read res=414 data=<6>[
e.<6>[ 582.136472] sysdig_probe:
5/25/2015 12:21 PM
10 of 17
http://bencane.com/2014/04/18/using-sysdig-to-troubleshoot-like-a-boss/
>
<
>
<
fstat fd=13(<f>/etc/apache2/.htpasswd)
fstat res=0
read fd=13(<f>/etc/apache2/.htpasswd) size=4096
read res=44 data=admin:$apr1$OXXed8Rc$rbXNhN/VqLCP.ojKu1aUN
sysdig
sysdig
sysdig
5/25/2015 12:21 PM
11 of 17
http://bencane.com/2014/04/18/using-sysdig-to-troubleshoot-like-a-boss/
-cl
sysdig
# sysdig -cl
Category: CPU Usage
------------------topprocs_cpu
Top processes by CPU usage
Category: I/O
------------echo_fds
Print the data read and written by processes.
fdbytes_by
I/O bytes, aggregated by an arbitrary filter field
fdcount_by
FD count, aggregated by an arbitrary filter field
iobytes
Sum of I/O bytes on any type of FD
iobytes_file
Sum of file I/O bytes
stderr
Print stderr of processes
stdin
Print stdin of processes
stdout
Print stdout of processes
<truncated output>
sysdig
sysdig
sysdig
5/25/2015 12:21 PM
12 of 17
http://bencane.com/2014/04/18/using-sysdig-to-troubleshoot-like-a-boss/
-i
# sysdig -i bottlenecks
Category: Performance
--------------------bottlenecks
Slowest system calls
Use the -i flag to get detailed information about a specific chisel
Lists the 10 system calls that took the longest to return dur
ing the capture interval.
Args:
(None)
sysdig
-c
# sysdig -c topprocs_net
Bytes
Process
-----------------------------296B
sshd
5/25/2015 12:21 PM
13 of 17
http://bencane.com/2014/04/18/using-sysdig-to-troubleshoot-like-a-boss/
echo_fds
echo_fds
fd.cip
5/25/2015 12:21 PM
14 of 17
http://bencane.com/2014/04/18/using-sysdig-to-troubleshoot-like-a-boss/
5/25/2015 12:21 PM
15 of 17
http://bencane.com/2014/04/18/using-sysdig-to-troubleshoot-like-a-boss/
1 Comment
sysdig
Benjamin, thanks for putting this together! This is an great guide for anyone getting started with sysdig. One note
- on your network traffic example, in order to capture network traffic specifically you can use the fd.type filter:
sysdig -A -c echo_fds proc.name=apache2 and fd.type=ipv4
[BENJAMIN CANE]
Awesome article!
5/25/2015 12:21 PM
16 of 17
http://bencane.com/2014/04/18/using-sysdig-to-troubleshoot-like-a-boss/
5/25/2015 12:21 PM
17 of 17
http://bencane.com/2014/04/18/using-sysdig-to-troubleshoot-like-a-boss/
5/25/2015 12:21 PM