Bas,

I see certain mistypes in your example. Dunno whether they exist in
your original promise. Anyway, the following test promise works for me
(I mean, it matches processes of users excluding the list specified):

bundle agent quarterly {
       vars:
               any::
                       "exclude_users"         slist =>  { "root",
"ganglia", "daemon", "postfix", "nslcd", "ntp",  };

       processes:
                       ".*"
                               comment         => "Kill processes that
use to much resources",
                               #signals        => { "term", "kill"},
                               process_select  =>
consumed_and_owner("15", @(exclude_users) );
}

body process_select consumed_and_owner(x, owners)
{
       process_owner  => { @(owners) };
       ttime_range    => irange(accumulated(0,0,0,0,"$(x)",0),
accumulated(1,0,0,0,0,0));
       process_result => "ttime.!process_owner";
}


2010/11/15 Bas van der Vlies <[email protected]>:
>
> I am a bit confused on about to pass variables.  I want to a variable to the 
> body process_select for process_owner. So i can dynamically set which user(s) 
> to skip.  How can i accomplish this or is this not possible?
>
> Here is an example that does not work: (tried several variations)
> {{{
> bundle agent quarterly {
>        vars:
>                any::
>                        "exclude_users"         slist =>  { "root", "ganglia", 
> "daemon", "postfix", "nslcd", "ntp",  };
>
>        processes:
>                LOGIN_HOST::
>                        ".*"
>                                comment         => "Kill processes that use to 
> much resources",
>                                #signals        => { "term", "kill"},
>                                process_count   => check_range("user_procs", 
> "0", "0"),
>                                process_select  => 
> sara_user_consume_cpu_min("15", @(exclude_user) );
> }
>
> body process_select sara_user_consume_cpu_min(x, exclude_users)
> {
>        #process_owner  => { "root", "ganglia", "daemon", "postfix", "nslcd", 
> "ntp" };
>        #command        => ".*";
>        process_owner  => { "@(exclude_users)  };
>        ttime_range    => irange(accumulated(0,0,0,0,"$(x)",0), 
> accumulated(1,0,0,0,0,0));
>        process_result => "ttime.!process_owner";
> }
>
> }}}
>
>
>
> --
> Bas van der Vlies
> [email protected]
>
>
>
> _______________________________________________
> Help-cfengine mailing list
> [email protected]
> https://cfengine.org/mailman/listinfo/help-cfengine
>



-- 
SY, Seva Gluschenko.
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to