Application Level Protocols
From DTraceBook
This chapter uses DTrace for analyzing application level protocols, including NFSv3, NFSv4, CIFS, HTTP, DNS, FTP, iSCSI, FC, SSH, NIS and LDAP.
Contents |
Sample One-Liners
See the DTrace book for more one-liners.
syscall Provider
HTTP files opened by the httpd server:
dtrace -n 'syscall::open*:entry /execname == "httpd"/ { @[copyinstr(arg0)] = count(); }'
SSH logins by UID and home directory:
dtrace -n 'syscall::chdir:entry /execname == "sshd"/ { printf("UID:%d %s", uid, copyinstr(arg0)); }'
nfsv3 Provider
NFSv3 count of operations by client address:
dtrace -n 'nfsv3:::op-*-start { @[args[0]->ci_remote] = count(); }'
NFSv3 count of operations by file pathname:
dtrace -n 'nfsv3:::op-*-start { @[args[1]->noi_curpath] = count(); }'
cifs Provider
CIFS count of operations by client address:
dtrace -n 'smb:::op-*-start { @[args[0]->ci_remote] = count(); }'
CIFS count of operations by file pathname:
dtrace -n 'smb:::op-*-done { @[args[1]->soi_curpath] = count(); }'
iscsi Provider
iSCSI payload bytes by operation type:
dtrace -n 'iscsi*::: { @[probename] = sum(args[1]->ii_datalen); }'
Scripts
- nfsv3rwsnoop.d
- nfsv3ops.d
- nfsv3fileio.d
- nfsv3rwtime.d
- nfsv3syncwrite.d
- nfsv3commit.d
- nfsv3errors.d
- nfsv3fbtrws.d
- nfsv3disk.d
- nfsv4rwsnoop.d
- nfsv4ops.d
- nfsv4fileio.d
- nfsv4rwtime.d
- nfsv4syncwrite.d
- nfsv4commit.d
- nfsv4errors.d
- nfsv4deleg.d
- cifsrwsnoop.d
- cifsops.d
- cifsfileio.d
- cifsrwtime.d
- cifserrors.d
- cifsfbtnofile.d
- httpclients.d
- httperrors.d
- httpio.d
- httpdurls.d
- weblatency.d
- getaddrinfo.d
- dnsgetname.d
- ftpdxfer.d
- ftpdfileio.d
- proftpdcmd.d
- tnftpdcmd.d
- proftpdtime.d
- proftpdio.d
- iscsiwho.d
- iscsirwsnoop.d
- iscsirwtime.d
- iscsicmds.d
- iscsiterr.d
- fcwho.d
- fcerror.d
- sshcipher.d
- sshdactivity.d
- sshconnect.d
- scpwatcher.d
- nismatch.d
- ldapsyslog.d
Errata
1st printing:
- p415: the line "args[5]->tcps_state, args[3]->tcps_state);" should be the following 2 lines:
tcp_state_string[args[5]->tcps_state],
tcp_state_string[args[3]->tcps_state]);
This was updated in Network_Lower_Level_Protocols:tcpstate.d.