Seva,

 Thanks a lot.  It works  ;-) and i see i made i typo must be exclude_users 
instead of exclude_user in process_select. That is why i got confused,  
cfengine3 handle this as empty list. 

regards

On 15 nov 2010, at 12:06, Seva Gluschenko wrote:

> 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 <b...@sara.nl>:
>> 
>> 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
>> b...@sara.nl
>> 
>> 
>> 
>> _______________________________________________
>> Help-cfengine mailing list
>> Help-cfengine@cfengine.org
>> https://cfengine.org/mailman/listinfo/help-cfengine
>> 
> 
> 
> 
> -- 
> SY, Seva Gluschenko.

--
Bas van der Vlies
b...@sara.nl



_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to