service.d Reports Events

This is a script to produce a report of target online or offline events.

#!/usr/sbin/dtrace -s

#pragma D option quiet

dtrace:::BEGIN
{
        printf("Tracing... Hit Ctrl-C to end.\n\n");
        printf("%-14s   %-35s %-20s\n", "SRP EVENT", 

\
"LOCAL PORT", "EUI NAME");
};

srp:::service-up
{
        printf("%-14s   %-35s %-20s\n", probename, 

\
args[0]->ci_local, args[1]->pi_target);
}

srp:::service-down
{
        printf("%-14s   %-35s %-20s\n", probename, 

\
args[0]->ci_local, args[1]->pi_target);
}

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

# dtrace -s ~/src/service.d
Tracing... Hit Ctrl-C to end.
^C
SRP EVENT        LOCAL PORT                          EUI NAME
service-down     fe80000000000000:0003ba0001004d31   eui.0003BA0001004D30
service-down     fe80000000000000:0003ba0001004d32   eui.0003BA0001004D30
service-up       fe80000000000000:0003ba0001004d31   eui.0003BA0001004D30
service-up       fe80000000000000:0003ba0001004d32   eui.0003BA0001004D30
#

The following table describe the fields in the output.

Field Description

SRP EVENT

srp event type

LOCAL PORT

GID of the local port

EUI NAME

EUI name of the local port