sorry I should have posted the whole script. Is there a way to wildcard it as if the FS I care about have a somewhat standard naming like /mnt/data/scr_* ?
I tried to add the conditional to the first probe but it doesn't like the "||" for the OR . It seems like I could also put it in the tick-1s probe but it still doesn't like it. This is FreeNAS 11.0U4 btw. I pulled this from an old thread and just trying to tweak it for my use case on this one server. Then I'm going to wrap it with something to send to graphite. Thanks. #!/usr/sbin/dtrace -s /* * vfsstat emulation */ #pragma D option quiet #pragma D option defaultargs #pragma D option switchrate=10hz #pragma D option bufsize=8m #pragma D option dynvarsize=32m /* * Refer to man 9 VFS and the files <sys/vnode.h>, * </usr/src/sys/kern/vfs_default.c> and various * information on vnode in each fs. */ /* * This script only records successful operations. However, it * is trivial to modify so that failures are also record. * This script is intent to be used with your favourite scripting * language to process the output into something like the * Solaris fsstat. Also, note that read and write bytes will * be significantly different with disk IOs due to IO inflation * or deflation. */ vfs::vop_read:entry, vfs::vop_write:entry { self->bytes[stackdepth] = args[1]->a_uio->uio_resid; } /this->delta = self->bytes[stackdepth] - args[1]->a_uio->uio_resid/ { this->fi_mount = args[0]->v_mount ? stringof(args[0]->v_mount->mnt_stat.f_mntonname) : "<none>"; @bytes[this->fi_mount, probefunc] = sum(this->delta); @ops[this->fi_mount, probefunc] = count(); } vfs::vop_read:return, vfs::vop_write:return { self->bytes[stackdepth] = 0; } /* You may add or remove operations of interest here. */ /* vfs::vop_rename:return, vfs::vop_create:return, vfs::vop_remove:return, */ /* vfs::vop_getattr:return, vfs::vop_access:return, vfs::vop_open:return, */ /* vfs::vop_close:return, vfs::vop_setattr:return, vfs::vop_rename:return, */ /* vfs::vop_mkdir:return, vfs::vop_rmdir:return, vfs::vop_readdir:return, */ /* vfs::vop_lookup:return, vfs::vop_cachedlookup:return */ tick-1s { printf("Number of operations\n"); printf("%-40s %-18s %20s\n", "FILESYSTEM", "OPERATIONS", "COUNTS"); printa("%-40s %-18s %20@d\n", @ops); printf("\nBytes read or write\n"); printf("%-40s %-18s %20s\n", "FILESYSTEM", "OPERATIONS", "BYTES"); printa("%-40s %-18s %20@d\n", @bytes); printf("\n--------------------------------------------------\n\n"); } ----- On Oct 31, 2017, at 2:24 PM, Ryan Stone ryst...@gmail.com wrote: On Tue, Oct 31, 2017 at 2:48 PM, Kevin Kramer <kra...@centtech.com> wrote: > I'd like to limit this to a few filesystems. > > { > this->fi_mount = args[0]->v_mount ? > stringof(args[0]->v_mount->mnt_stat.f_mntonname) : > "<none>"; > @bytes[this->fi_mount, probefunc] = sum(this->delta); > @ops[this->fi_mount, probefunc] = count(); > } > > > I can't quite figure out where to place it. I keep getting errors on the > conditional. > > { > this->fi_mount = args[0]->v_mount ? > stringof(args[0]->v_mount->mnt_stat.f_mntonname) : > "<none>"; > /this->fi_mount == "/mnt/data/somedir"/ || this->fi_mount == > "/mnt/data/someotherdir"/ > { > @bytes[this->fi_mount, probefunc] = sum(this->delta); > @ops[this->fi_mount, probefunc] = count(); > } > > } The actions of a probe can't nest in the way that you expect. Your script needs to look like this: provider:::probe { this->fi_mount = args[0]->v_mount ? stringof(args[0]->v_mount->mnt_stat.f_mntonname) : "<none>"; } provider:::probe / this->fi_mount == "/mnt/data/somedir"/ || this->fi_mount == "/mnt/data/someotherdir" / { @bytes[this->fi_mount, probefunc] = sum(this->delta); @ops[this->fi_mount, probefunc] = count(); } ------------------------------------------- dtrace-discuss Archives: https://www.listbox.com/member/archive/184261/=now RSS Feed: https://www.listbox.com/member/archive/rss/184261/25769126-e243886f Modify Your Subscription: https://www.listbox.com/member/?member_id=25769126&id_secret=25769126-8d47a7b2 Powered by Listbox: http://www.listbox.com