Report an Issue | Log In | Sign Up   View a printable version of the current page.


DTrace

iscsi Provider


Added by aleventhal , last edited by brendan.gregg on Jan 16, 2008  (view change) show comment
Labels: 
(None)

iscsi Provider

The iscsi provider provides probes for tracing iSCSI target activity.

This is a USDT provider built into the iSCSI target daemon (iscsitgtd). As a USDT provider the name is concatenated with the process ID of the daemon (eg. iscis123).

Since this provider instruments the iSCSI target daemon, DTrace commands and scripts must be run on the iSCSI target server to observe these probes.

Probes

SCSI Event Probes
SCSI command/response iscsi*:::scsi-command
iscsi*:::scsi-response
Data out/in/request (rtt) iscsi*:::data-send
iscsi*:::data-receive
iscsi*:::data-request
Login and logout command/response iscsi*:::login-command
iscsi*:::login-response
iscsi*:::logout-command
iscsi*:::logout-response
NOP out/in (pings) iscsi*:::nop-receive
iscsi*:::nop-send
Text and task command/response iscsi*:::task-command
iscsi*:::task-response
iscsi*:::text-command
iscsi*:::text-response
Asynchronous message from target iscsi*:::async-send

Top

Arguments

Probes Variable Type Description
* args[0] conninfo_t * connection info
* args[1] iscsiinfo_t * common iSCSI properties
scsi-command args[2] iscsicmd_t * SCSI opcode

Top

Types

conninfo_t

typedef struct conninfo {                                                       
        string ci_local;         /* local host IP address */               
        string ci_remote;        /* remote host IP address */     
        string ci_protocol;      /* protocol ("ipv4", "ipv6") */               
} conninfo_t;                                                                   

iscsiinfo_t

typedef struct iscsiinfo {
	string ii_target;		/* target iqn */
	string ii_initiator;		/* initiator iqn */
	uint64_t ii_lun;		/* target logical unit number */

	uint32_t ii_itt;		/* initiator task tag */
	uint32_t ii_ttt;		/* target transfer tag */

	uint32_t ii_cmdsn;		/* command sequence number */
	uint32_t ii_statsn;		/* status sequence number */
	uint32_t ii_datasn;		/* data sequence number */

	uint32_t ii_datalen;		/* length of data payload */
	uint32_t ii_flags;		/* probe-specific flags */
} iscsiinfo_t;                                                          

iscsicmd_t

typedef struct iscsicmd {
        uint64_t ic_len;        /* CDB length */
        uint8_t *ic_cdb;        /* CDB data */
} iscsicmd_t;

Top

Examples

One-liners

Frequency of iSCSI command types:

# dtrace -n 'iscsi*::: { @[probename] = count(); }'

Frequency of iSCSI client IP addresses:

# dtrace -n 'iscsi*::: { @[args[0]->ci_remote] = count(); }'

Payload bytes by iSCSI command type:

# dtrace -n 'iscsi*::: { @[probename] = sum(args[1]->ii_datalen); }'

Payload byte distribution by iSCSI command type:

# dtrace -n 'iscsi*::: { @[probename] = quantize(args[1]->ii_datalen); }'
iscsiwho.d

This is a simple script to produce a report of the remote IP addresses and a count of iSCSI events. This is intended to provide a quick summary of iSCSI activity when run on the iSCSI target server:

#!/usr/sbin/dtrace -s

#pragma D option quiet

dtrace:::BEGIN
{
        printf("Tracing... Hit Ctrl-C to end.\n");
}

iscsi*:::
{
        @events[args[0]->ci_remote, probename] = count();
}

dtrace:::END
{
        printf("   %-26s %14s %8s\n", "REMOTE IP", "iSCSI EVENT", "COUNT");
        printa("   %-26s %14s %@8d\n", @events);
}

This output shows the host and the number of iSCSI operations:

# ./iscsiwho.d 
Tracing... Hit Ctrl-C to end.
^C
   REMOTE IP                     iSCSI EVENT    COUNT
   192.168.1.109                 nop-receive        1
   192.168.1.109                    nop-send        1
   192.168.1.109               scsi-response      126
   192.168.1.109                scsi-command      208
   192.168.1.109                data-receive     1207
   192.168.1.109                data-request     1207
   192.168.1.109                   data-send     1290

The fields are:

field description
REMOTE IP IP address of the client
iSCSI EVENT iSCSI event type
COUNT Number of events traced

The example output shows normal traffic. For this simple script, these event names are not translated beyond their iSCSI provider probe names, and require some thought to comprehend (they are from the perspective of the iSCSI target server).

An interpretation for some of these events are:

iSCSI event Interpretation
scsi-command A SCSI command was issued, such as a read or a write. Use other scripts for a breakdown on the SCSI command type.
data-send Data was sent from the iSCSI target server to the client; the client is performing a read.
data-receive Data was received on the iSCSI target server from the client. The client is performing a write.

The individuals who post here are part of the extended Sun Microsystems community and they may not be employed or in any way formally affiliated with Sun Microsystems. The opinions expressed here are their own, are not necessarily reviewed in advance by anyone but the individual authors, and neither Sun nor any other party necessarily agrees with them.

Copyright Sun Microsystems, Inc.
Powered by Atlassian Confluence
Sun Guidelines on Public Discourse Privacy Policy Terms of Use Trademarks Site Map Employment Investor Relations Contact