Using Dtrace OEL 6.X

Overview

  • The DTrace dtrace-utils package is available from ULN.
  • Your system must be registered with ULN and be installed with or be updated to Oracle Linux 6 Update 4 or later.

Installation on OEL 6.6

Login to ULN and download following RPMs:
Channel: Unbreakable Enterprise Kernel Release 3 for Oracle Linux 6 (x86_64) - Latest>Packages
  dtrace-modules-headers-0.4.3-4.el6.x86_64  
Channel: Oracle Linux 6 Dtrace Userspace Tools (x86_64) - Latest>Packages
  dtrace-utils-0.4.5-2.el6.x86_64          DTrace user interface.
  dtrace-utils-devel-0.4.5-2.el6.x86_64    DTrace development headers.
[root@hract21 DTRACE]# ls -l
total 324
-rwxr-x--- 1 root root  28824 Feb 10 10:43 dtrace-modules-headers-0.4.3-4.el6.x86_64.rpm
-rwxr-x--- 1 root root 274504 Feb 10 10:37 dtrace-utils-0.4.5-2.el6.x86_64.rpm
-rwxr-x--- 1 root root  20388 Feb 10 10:37 dtrace-utils-devel-0.4.5-2.el6.x86_64.rpm

Install this packages with 
[root@hract21 DTRACE]# rpm -i  ... 

Installation on OEL 6.5

 
To install and configure DTrace, perform the following steps:
    On ULN, subscribe your system to the following channels:
        Oracle Linux 6 Latest (x86_64) (ol6_x86_64_latest)
        Unbreakable Enterprise Kernel Release 3 for Oracle Linux 6 (x86_64) - Latest (ol6_x86_64_UEKR3_latest)
        Oracle Linux 6 Dtrace Userspace Tools (x86_64) - Latest (ol6_x86_64_Dtrace_userspace_latest)

    Make sure that your system is not subscribed to the following channels:
        Latest Unbreakable Enterprise Kernel for Oracle Linux 6 (x86_64) (ol6_x86_64_UEK_latest)
        Dtrace for Oracle Linux 6 (x86_64) - Latest (ol6_x86_64_Dtrace_latest)
        Dtrace for Oracle Linux 6 (x86_64) - Beta release (ol6_x86_64_Dtrace_BETA)
        Unbreakable Enterprise Kernel Release 3 (3.8 based) for Oracle Linux 6 (x86_64) - Beta release (ol6_x86_64_UEK_BETA)

Verify your YUM respository
# yum repolist
Loaded plugins: refresh-packagekit, security
repo id                            repo name                                                                                  status
ol6_Dtrace_userspace_latest        Oracle Linux 6 Dtrace Userspace Tools (x86_64) - latest                                         6
ol6_UEKR3                          Unbreakable Enterprise Kernel Release 3 for Oracle Linux 6Server (x86_64) - Latest            138
ol6_UEK_latest                     Latest Unbreakable Enterprise Kernel for Oracle Linux 6Server (x86_64)                        273
ol6_addons                         Oracle Linux 6Server Add ons (x86_64)                                                         146
ol6_internal                       Oracle Linux 6Server Internal Mirror                                                            4
ol6_latest                         Oracle Linux 6Server Latest (x86_64)                                                       20,438
ol6_oracle                         Oracle Software for Oracle Linux 6Server (x86_64)                                              44
repolist: 21,049

Install dtrace package
[root@oel65 yum.repos.d]#  yum install dtrace-utils
Loaded plugins: refresh-packagekit, security
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package dtrace-utils.x86_64 0:0.4.3-1.el6 will be installed
--> Processing Dependency: dtrace-modules-headers for package: dtrace-utils-0.4.3-1.el6.x86_64
--> Running transaction check
---> Package dtrace-modules-3.8.13-16.2.1.el6uek-headers.x86_64 0:0.4.1-3.el6 will be installed
--> Finished Dependency Resolution
...
Transaction Summary
====================================================================================================================================
Install       2 Package(s)

Total download size: 289 k
Installed size: 816 k
Is this ok [y/N]: y
Downloading Packages:
(1/2): dtrace-modules-3.8.13-16.2.1.el6uek-headers-0.4.1-3.el6.x86_64.rpm                                    |  27 kB     00:00     
(2/2): dtrace-utils-0.4.3-1.el6.x86_64.rpm                                                                   | 261 kB     00:01     
------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                               122 kB/s | 289 kB     00:02     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : dtrace-modules-3.8.13-16.2.1.el6uek-headers-0.4.1-3.el6.x86_64                                                   1/2 
  Installing : dtrace-utils-0.4.3-1.el6.x86_64                                                                                  2/2 
  Verifying  : dtrace-utils-0.4.3-1.el6.x86_64                                                                                  1/2 
  Verifying  : dtrace-modules-3.8.13-16.2.1.el6uek-headers-0.4.1-3.el6.x86_64                                                   2/2 
Installed:
  dtrace-utils.x86_64 0:0.4.3-1.el6                                                                                                 
Dependency Installed:
  dtrace-modules-3.8.13-16.2.1.el6uek-headers.x86_64 0:0.4.1-3.el6                                                                  
Complete!

Differences Between DTrace on Oracle Linux and Oracle Solaris

Other providers, such as the pid provider, the Function Boundary Tracing (fbt) provider, 
and the providers for the network protocols (ip, iscsi, nfsv3, nfsv4, srp, tcp, and udp), 
have not yet been implemented.

DTrace – first steps

Check current enabled provider:
[root@oel65 Dtrace]# dtrace -l 
   ID   PROVIDER            MODULE                          FUNCTION NAME
    1     dtrace                                                     BEGIN
    2     dtrace                                                     END
    3     dtrace                                                     ERROR

If you wanted to use the probes that the proc provider publishes, you would load the systrace module:
# modprobe systrace 
Now check the provider
[root@oel65 Dtrace]# dtrace -l 
   ID   PROVIDER            MODULE                          FUNCTION NAME
    1     dtrace                                                     BEGIN
    2     dtrace                                                     END
    3     dtrace                                                     ERROR
    4    syscall           vmlinux                              read entry
    5    syscall           vmlinux                              read return
    6    syscall           vmlinux                             write entry
    7    syscall           vmlinux                             write return
    8    syscall           vmlinux                              open entry
    9    syscall           vmlinux                              open return
..

Testing function entry codes
[root@oel65 Dtrace]# dtrace -n 'syscall::open:entry  { printf("Exec: %s  File: %s" , execname , stringof(arg0) ); }'
dtrace: description 'syscall::open:entry  ' matched 1 probe
CPU     ID                    FUNCTION:NAME
  0      8                       open:entry Exec: udisks-daemon  File: /dev/sr0
  0      8                       open:entry Exec: vminfo  File: /var/run/utmp
  0      8                       open:entry Exec: vminfo  File: /etc/passwd

Testing function return codes
[root@oel65 Dtrace]#   dtrace -n 'syscall::open:return { printf("Exec: %s - Ret-code: %d", execname, arg0); }'
dtrace: description 'syscall::open:return ' matched 1 probe
CPU     ID                    FUNCTION:NAME
  0      9                      open:return Exec: udisks-daemon - Ret-code: -16
  0      9                      open:return Exec: automount - Ret-code: 5
  0      9                      open:return Exec: automount - Ret-code: 5

Combine entry and return Dtrace methods to trace a failed open calldtrace -n 'syscall::open:entry  { printf("Exec: %s  File: %s" , execname , stringof(arg0) ); } 
              syscall::open:return { printf("Exec: %s - Ret-code: %d", execname, arg0); }'

Try to open a not existing file
# cat /tmp/hhh
DTrace report:
  0      8                       open:entry Exec: cat  File: /etc/ld.so.cache
  0      9                      open:return Exec: cat - Ret-code: 3
  0      8                       open:entry Exec: cat  File: /lib64/libc.so.6
  0      9                      open:return Exec: cat - Ret-code: 3
  0      8                       open:entry Exec: cat  File: /usr/lib/locale/locale-archive
  0      9                      open:return Exec: cat - Ret-code: 3
  0      8                       open:entry Exec: cat  File: /tmp/hhh
  0      9                      open:return Exec: cat - Ret-code: -2
--> The cat command opens some shared library before failing to open file  /tmp/hhh with -2 

Checking errno.h ( aka  ./asm-generic/errno-base.h )
#define ENOENT           2      /* No such file or directory */
--> Error -2 means :  No such file or directory

 

Using complex DTRACE scripts in an Oracle RAC env

Reference

One thought on “Using Dtrace OEL 6.X”

Leave a Reply

Your email address will not be published. Required fields are marked *