|
| 1 | +/* |
| 2 | + * Display internal Upstairs status. |
| 3 | + * This is an ease of use script that can be run on a sled and will |
| 4 | + * output stats for all propolis-server or pantry process (anything |
| 5 | + * that has an upstairs). The PID and SESSION will be unique for |
| 6 | + * an upstairs. Multiple disks attached to a single propolis server |
| 7 | + * will share the PID, but have unique SESSIONs. |
| 8 | + */ |
| 9 | +#pragma D option quiet |
| 10 | +#pragma D option strsize=1k |
| 11 | +/* |
| 12 | + * Print the header right away |
| 13 | + */ |
| 14 | +dtrace:::BEGIN |
| 15 | +{ |
| 16 | + show = 21; |
| 17 | +} |
| 18 | + |
| 19 | +/* |
| 20 | + * Every second, check and see if we have printed enough that it is |
| 21 | + * time to print the header again |
| 22 | + */ |
| 23 | +tick-1s |
| 24 | +/show > 20/ |
| 25 | +{ |
| 26 | + printf("%5s %8s ", "PID", "SESSION"); |
| 27 | + printf("%17s %17s %17s", "DS STATE 0", "DS STATE 1", "DS STATE 2"); |
| 28 | + printf(" %5s %5s %9s %5s", "UPW", "DSW", "NEXT_JOB", "BAKPR"); |
| 29 | + printf(" %10s", "WRITE_BO"); |
| 30 | + printf(" %5s %5s %5s", "NEW0", "NEW1", "NEW2"); |
| 31 | + printf(" %5s %5s %5s", "IP0", "IP1", "IP2"); |
| 32 | + printf(" %5s %5s %5s", "D0", "D1", "D2"); |
| 33 | + printf(" %5s %5s %5s", "S0", "S1", "S2"); |
| 34 | + printf(" %5s %5s %5s", "ER0", "ER1", "ER2"); |
| 35 | + printf(" %5s %5s %5s", "EC0", "EC1", "EC2"); |
| 36 | + printf("\n"); |
| 37 | + show = 0; |
| 38 | +} |
| 39 | + |
| 40 | +crucible_upstairs*:::up-status |
| 41 | +{ |
| 42 | + show = show + 1; |
| 43 | + session_id = json(copyinstr(arg1), "ok.session_id"); |
| 44 | + |
| 45 | + /* |
| 46 | + * I'm not very happy about this very long muli-line printf, but if |
| 47 | + * we don't print it all on one line, then multiple sessions will |
| 48 | + * clobber each others output. |
| 49 | + */ |
| 50 | + printf("%5d %8s %17s %17s %17s %5s %5s %9s %5s %10s %5s %5s %5s %5s %5s %5s %5s %5s %5s %5s %5s %5s %5s %5s %5s %5s %5s %5s\n", |
| 51 | + |
| 52 | + pid, |
| 53 | + substr(session_id, 0, 8), |
| 54 | + |
| 55 | + /* State for the three downstairs */ |
| 56 | + json(copyinstr(arg1), "ok.ds_state[0]"), |
| 57 | + json(copyinstr(arg1), "ok.ds_state[1]"), |
| 58 | + json(copyinstr(arg1), "ok.ds_state[2]"), |
| 59 | + |
| 60 | + /* Work queue counts for Upstairs and Downstairs */ |
| 61 | + json(copyinstr(arg1), "ok.up_count"), |
| 62 | + json(copyinstr(arg1), "ok.ds_count"), |
| 63 | + |
| 64 | + /* Job ID and backpressure */ |
| 65 | + json(copyinstr(arg1), "ok.next_job_id"), |
| 66 | + json(copyinstr(arg1), "ok.up_backpressure"), |
| 67 | + json(copyinstr(arg1), "ok.write_bytes_out"), |
| 68 | + |
| 69 | + /* New jobs on the work list for each downstairs */ |
| 70 | + json(copyinstr(arg1), "ok.ds_io_count.new[0]"), |
| 71 | + json(copyinstr(arg1), "ok.ds_io_count.new[1]"), |
| 72 | + json(copyinstr(arg1), "ok.ds_io_count.new[2]"), |
| 73 | + |
| 74 | + /* In progress jobs on the work list for each downstairs */ |
| 75 | + json(copyinstr(arg1), "ok.ds_io_count.in_progress[0]"), |
| 76 | + json(copyinstr(arg1), "ok.ds_io_count.in_progress[1]"), |
| 77 | + json(copyinstr(arg1), "ok.ds_io_count.in_progress[2]"), |
| 78 | + |
| 79 | + /* Completed (done) jobs on the work list for each downstairs */ |
| 80 | + json(copyinstr(arg1), "ok.ds_io_count.done[0]"), |
| 81 | + json(copyinstr(arg1), "ok.ds_io_count.done[1]"), |
| 82 | + json(copyinstr(arg1), "ok.ds_io_count.done[2]"), |
| 83 | + |
| 84 | + /* Skipped jobs on the work list for each downstairs */ |
| 85 | + json(copyinstr(arg1), "ok.ds_io_count.skipped[0]"), |
| 86 | + json(copyinstr(arg1), "ok.ds_io_count.skipped[1]"), |
| 87 | + json(copyinstr(arg1), "ok.ds_io_count.skipped[2]"), |
| 88 | + |
| 89 | + /* Extents Repaired */ |
| 90 | + json(copyinstr(arg1), "ok.ds_extents_repaired[0]"), |
| 91 | + json(copyinstr(arg1), "ok.ds_extents_repaired[1]"), |
| 92 | + json(copyinstr(arg1), "ok.ds_extents_repaired[2]"), |
| 93 | + |
| 94 | + /* Extents Confirmed */ |
| 95 | + json(copyinstr(arg1), "ok.ds_extents_confirmed[0]"), |
| 96 | + json(copyinstr(arg1), "ok.ds_extents_confirmed[1]"), |
| 97 | + json(copyinstr(arg1), "ok.ds_extents_confirmed[2]")); |
| 98 | +} |
0 commit comments