Dtrace book!

Recently i bought this book … it’s amazing 🙂

When i have more free time at job and outside i want be study/test/modify every script.
Dtrace is powerful how complex, i use it from 1 year. Let’s LEARN more ^^

dtrace probe for sun cluster

I’m still looking for documentation about probes on sun cluster environment.
Today i have seen that:

dtrace -l | grep cluster
70291 fbt cl_haci cluster_get_quorum_status entry
70292 fbt cl_haci cluster_get_quorum_status return
70365 fbt cl_haci clconf_cluster_remove_path entry
70366 fbt cl_haci clconf_cluster_remove_path return
70373 fbt cl_haci clconf_cluster_remove_node entry
70374 fbt cl_haci clconf_cluster_remove_node return
70671 fbt cl_haci clconf_cluster_get_orb_abort_timeout entry
70672 fbt cl_haci clconf_cluster_get_orb_abort_timeout return
70723 fbt cl_haci clconf_cluster_add_quorum_device entry
70724 fbt cl_haci clconf_cluster_add_quorum_device return
71579 fbt cl_haci clconf_cluster_get_path entry
71580 fbt cl_haci clconf_cluster_get_path return
72492 fbt cl_haci clconf_cluster_add_path entry
72493 fbt cl_haci clconf_cluster_add_path return
72494 fbt cl_haci clconf_cluster_add_node entry
72495 fbt cl_haci clconf_cluster_add_node return

And i have seen something about pxfs:

dtrace -l | grep pxfs
93612 fbt cl_dcs __1cbR_repl_pxfs_fs_replica_ckpt_page_map_receive6FpvrnHservice__v_ entry
93613 fbt cl_dcs __1cbR_repl_pxfs_fs_replica_ckpt_page_map_receive6FpvrnHservice__v_ return
93614 fbt cl_dcs __1cbQ_repl_pxfs_fs_replica_ckpt_remount_receive6FpvrnHservice__v_ entry
93615 fbt cl_dcs __1cbQ_repl_pxfs_fs_replica_ckpt_remount_receive6FpvrnHservice__v_ return
93616 fbt cl_dcs __1ccJ_repl_pxfs_fs_replica_ckpt_remove_file_locks_by_nlmid_receive6FpvrnHservice__v_ entry
93617 fbt cl_dcs __1ccJ_repl_pxfs_fs_replica_ckpt_remove_file_locks_by_nlmid_receive6FpvrnHservice__v_ return
93618 fbt cl_dcs __1ccJ_repl_pxfs_fs_replica_ckpt_remove_file_locks_by_sysid_receive6FpvrnHservice__v_ entry
93619 fbt cl_dcs __1ccJ_repl_pxfs_fs_replica_ckpt_remove_file_locks_by_sysid_receive6FpvrnHservice__v_ return
93620 fbt cl_dcs __1cbP_repl_pxfs_fs_replica_ckpt_target_receive6FpvrnHservice__v_ entry
93621 fbt cl_dcs __1cbP_repl_pxfs_fs_replica_ckpt_target_receive6FpvrnHservice__v_ return
93622 fbt cl_dcs __1cbS_repl_pxfs_fs_replica_ckpt_vx_tunefs_receive6FpvrnHservice__v_ entry
93623 fbt cl_dcs __1cbS_repl_pxfs_fs_replica_ckpt_vx_tunefs_receive6FpvrnHservice__v_ return
93624 fbt cl_dcs __1cbY_repl_pxfs_fs_replica_ckpt_service_version_receive6FpvrnHservice__v_ entry
93625 fbt cl_dcs __1cbY_repl_pxfs_fs_replica_ckpt_service_version_receive6FpvrnHservice__v_ return
93626 fbt cl_dcs __1cbS_repl_pxfs_fs_replica_ckpt_deletecnt_receive6FpvrnHservice__v_ entry
93627 fbt cl_dcs __1cbS_repl_pxfs_fs_replica_ckpt_deletecnt_receive6FpvrnHservice__v_ return
93628 fbt cl_dcs __1cbW_repl_pxfs_mount_replica_ckpt_add_client_receive6FpvrnHservice__v_ entry

It seems that it’s very complex use pxfs’s probes but with good documentation and knowledge they can be used for troubleshooting.
Pls someone publish documentation !!!

Dtrace: openfile.d script

Today in my free time i wrote this script.

It can be used in a follow scenario:

“We have the important file /tmp/pippo ( simple example ) that sometimes it is corrupted by some command/process. After a restore we see now that file is corrupted for second time. Who open it?”
( i suggest you to zoom the screenshot for full vision )

In this situation i use openfile.d as follow:

# cat /tmp/pippo

# ./openfile.d

./openfile.d [ -f file ] [-l] -h

-f = file to check
-l = see info about numeric codes

In another window i have launched a couple of commands on file /tmp/pippo !

This script can be downloaded here.
If u have some suggestion or u want help me to make it better… u are welcome 😉

Dtrace: associative array example

During my dtrace experiments , i used associative arrays.
Looking on web there are a lot of same examples on them , here i want write a different example for understand them:

#!/usr/sbin/dtrace -s
a[“test”] = 1;
b[“hello”] = 2;
c[“ale”] = 3;
printf(“\n%d\n”, a[“test”]);

The syntax is <array_name>[key1,key2,keyn] = value;
In previous example , with printing a[“test”] we’ll obtain 1 !

Solaris 10: how see lwp creation

Recently i followed a Solaris 8 system that had issue during lwp ( light-weight process ) creation.
This problem was solved through software tuning by other people.

But i thought … “and if i should meet a similar problem on Solaris 10 , how i can exactly measure lwp creation by process?”

Today i found a reply for this question!
I’m studying “Dynamic Performance Tuning and Troubleshooting with Dtrace”. I wrote this script.
I have tested it running in one terminal and opening a new connection to the system:

trace: script ‘./lwp.d’ matched 2 probes
0 44530 :tick-10sec

value ————- Distribution ————- count
-2147483648 | 0
-1073741824 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 14
-536870912 | 0

value ————- Distribution ————- count
-2147483648 | 0
-1073741824 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5
-536870912 | 0

value ————- Distribution ————- count
-2147483648 | 0
-1073741824 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
-536870912 | 0

This output shows that during execution of the script ksh has created 14 lwp , sshd 5 and sh 1
Very simple with dtrace !