On 16 nov 2010, at 15:23, Bas van der Vlies wrote:

> 
> On 16 nov 2010, at 15:02, no-re...@cfengine.com wrote:
> 
>> Forum: Cfengine Help
>> Subject: Re: When i process is killed. I want to see the whole process line 
>> instead of only pid.
>> Author: neilhwatson
>> Link to topic: https://cfengine.com/forum/read.php?3,19249,19287#msg-19287
>> 
>> Might log_string and log_repair work for you?
>> 
>> "The log_string works together with log_repair, log_kept etc, to define a 
>> string for logging to one of the named files depending on promise outcome, 
>> or to standard output of the log file is stipulared as ‘stdout’. Log strings 
>> on standard output are denoted by an ‘L:’ prefix."
>> 
>> 
> 
> I do not know beforehand which process get killed or can i do something with 
> the special variable $(this)?


For now i have solved it just run twice one in warn mode and the other in 
report_level : verbose mode:

{{{
bundle agent sara_user_consume_resources(minutes, memory, exclude)
{
       ##
       # we have to do it in two stages else we do not get to see which 
processes are killed
       #
       processes:
               any::
                       ".*"
                               comment         => "Kill processes that use to 
much resources, warn only mode",
                               #signals         => { "term", "kill"},
                               process_count   => check_range("user_procs", 
"0", "0"),
                               action          => policy("warn"),
                               process_select  => 
sara_user_consume_resources_select("$(minutes)", "$(memory)", @(exclude));

               user_procs_out_of_range::
                       ".*"
                               comment         => "Kill processes that use to 
much resources",
                               signals         => { "term", "kill"},
                               action          => sara_action,
                               process_select  => 
sara_user_consume_resources_select("$(minutes)", "$(memory)", @(exclude));
}
}}}}

--
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