On Tue, Oct 31, 2017 at 12:24 PM, Ryan Stone <[email protected]> wrote:

> On Tue, Oct 31, 2017 at 2:48 PM, Kevin Kramer <[email protected]> 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();
> }
>
>
>
Or, I think you can use if/else in FreeBSD now (on HEAD at least?):

 {
        this->fi_mount = args[0]->v_mount ?
                stringof(args[0]->v_mount->mnt_stat.f_mntonname) :
                        "<none>";
        if (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

Reply via email to