Official documentation/guides can probably explain it better than I can. You should start here for some DTrace basics:

http://www.opensolaris.org/os/community/dtrace/

There is also a dtrace-discuss list if you have any questions.

As you can see on http://www.solarisinternals.com/wiki/index.php/DTrace_Topics_iSCSI the iscsi provider has 3 arguments. arg[1] is associated with the common iscsi properties structure 'iscsiinfo_t'. If you look further down the page, you can see the data types within this structure. Since we want the iscsi target name, we need to find the argument and data variable which happens to be ii_target. So to access the information we tell dtrace to look in args[1]->ii_target.

Here's how you can exit the script after 10 seconds instead of Ctrl-C:

===============
tick-10s
{
        exit(0);
}

dtrace:::END
{
        normalize(@rate, (timestamp - start) * 1024 / 1000000000);
...
===============

Hope that helps.

--
Dave

Jacob Ritorto wrote:
Very nice, thank you!  Now two more questions if you (and the list)
can bear with me:

  How did you know to make that change (how did you find the right
variable to interrogate)?

  Can we change the script to sample for ten seconds and then stop
itself and output instead of waiting for control-c?

thx
jake



On Thu, May 21, 2009 at 6:45 PM, Dave <[email protected]> wrote:
Jacob Ritorto wrote:

This DTrace is addicting -- It's my first taste and I already want more!
 I'm immediately covetous of a dtrace that'll give me output similar to the
iscsiio.d script mentioned above, but list it by target instead of ip
address.  Would anyone be willing to walk through making this mod with me?

Jake,

Replacing

args[0]->ci_remote

with

args[1]->ii_target

in the iscsiio.d script should print the target name instead of the remote
IPs. I gave it a quick try with iscsitgt:

# ./trace.d
Tracing... Hit Ctrl-C to end.
TARGET                     EVENT    COUNT     Kbytes     KB/sec
iqn.1986-03.com.sun:02:c1c60e28-e3c5-ca25-9c25-b86429173747 write  1
12          0
iqn.1986-03.com.sun:02:c1c60e28-e3c5-ca25-9c25-b86429173747 read 8
 4          0

--
Dave

_______________________________________________
storage-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/storage-discuss

Reply via email to