iscsiwho.d Script
            
         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.0.2.14/27                 nop-receive        1
   192.0.2.14/27                    nop-send        1
   192.0.2.14/27               scsi-response      126
   192.0.2.14/27                scsi-command      208
   192.0.2.14/27                data-request     1207
   192.0.2.14/27                data-receive     1207The following table describes the output fields of the iscsiwho.d script.
               
| Field | Description | 
|---|---|
| 
 | IP address of the client | 
| 
 | iSCSI event type | 
| 
 | 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 as they are from the perspective of the iSCSI target server.