DTrace Toolkit

A hidden little gem that comes included with your installation of OpenSolaris is the DTrace Toolkit. You'll find it installed at /opt/DTT.

The DTrace Toolkit is a collection of tools written by volunteers of the DTrace community, led by Brendan Gregg. What I find most impressive is how well it has been put together. There are 230 executable DTrace scripts, each with their own man page. The scripts are organized by type (CPU analysis, I/O analysis, etc.) so they are easy to study, but they've all been symlinked into a Bin directory, so they are easy to put on your path. I've added the following to my ~/.bashrc file:

#
# DTrace Toolkit
#
PATH=$PATH:/opt/DTT/Bin
MANPATH=$MANPATH:/opt/DTT/Man

In addition to their man pages, all of the scrips have a -h help option, for example:

bleonard@os200906:~$ execsnoop -h
USAGE: execsnoop [-a|-A|-ehjsvZ] [-c command]
       execsnoop                # default output
                -a              # print all data
                -A              # dump all data, space delimited
                -e              # safe output, parseable
                -j              # print project ID
                -s              # print start time, us
                -v              # print start time, string
                -Z              # print zonename
                -c command      # command name to snoop
  eg,
        execsnoop -v            # human readable timestamps
        execsnoop -Z		# print zonename
        execsnoop -c ls         # snoop ls commands only

Note, if you want to run the DTrace scripts from your user account, run the following command to add the needed privileges, substituting in your user name:

pfexec usermod -K defaultpriv=basic,dtrace_user,dtrace_proc,dtrace_kernel <user>

To get started learning all that's available, I recommend reading the DTrace Tookkit page. Also, Stefan Parvu has an excellent presentation on DTrace and the toolkit that's worth a look.

With this toolkit there's probably little need to write a DTrace script from scratch - it's literally a treasure chest of material that I've only begun to explore.

Comments:

Thanks. I found execsnoop some time ago. It's really useful for exploring the system and different components testing.

Posted by shmerl on October 21, 2009 at 11:23 AM GMT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

The Observatory is a blog for users of Oracle Solaris. Tune in here for tips, tricks and more as we explore the Solaris operating system from Oracle.

Connect with Oracle Solaris:


Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
20
21
22
23
24
25
26
27
28
29
30
   
       
Today