From 4f2dc61feb20a5d6ae3ffe4ca8dec3a2a9552bc5 Mon Sep 17 00:00:00 2001 From: Mark Cavage Date: Thu, 17 Nov 2011 16:19:18 -0800 Subject: [PATCH] sample dtrace script --- snoopldap.d | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 snoopldap.d diff --git a/snoopldap.d b/snoopldap.d new file mode 100755 index 0000000..16a92b0 --- /dev/null +++ b/snoopldap.d @@ -0,0 +1,24 @@ +#!/usr/sbin/dtrace -s + +#pragma D option quiet + +BEGIN +{ + printf("%-8s %-8s %-16s %-15s %-15s %s\n", + "LATENCY", "OPTYPE", "REMOTE IP", "BIND DN", "REQ DN", + "STATUS"); +} + +ldapjs*:::server-*-start +{ + starts[arg0] = timestamp; +} + +ldapjs*:::server-*-done +/starts[arg0]/ +{ + printf("%6dms %-8s %-16s %-15s %-15s %d\n", + (timestamp - starts[arg0]) / 1000000, strtok(probename + 7, "-"), + copyinstr(arg1), copyinstr(arg2), copyinstr(arg3), arg4); + starts[arg0] = 0; +}