No, I was worng (doh!). I am did more research into this, and it is not the
selection issue as I suspected. I apologize for any misleading.
There is something wrong with your range - 15 is not "15 minutes" :-) You
should use "accumulated" on both sides of the irange.
On Nov 12, 2010, at 4:32 AM, Bas van der Vlies wrote:
> version: community edition 3.1.0
> os: debian
>
> I want to kill processes that have accumulated more then 15 minutes of time:
>
> body common control
> {
> bundlesequence => { example };
>
> inputs => {
> "cfengine_stdlib.cf"
> };
>
> }
>
> bundle agent example {
> processes:
> ".*"
> comment => "Kill processes that use to much resources",
> #signals => { "term", "kill"},
> process_count => check_range("user_procs", "0", "0"),
> process_select => sara_user_consume_resources;
>
> reports:
> user_procs_out_of_range::
> "There are user procesees that consume too much resources";
> }
>
>
> body process_select sara_user_consume_resources
> {
> process_owner => { "root", "ganglia", "daemon", "postfix", "nslcd" };
> ttime_range => irange(15, accumulated(0,1,0,0,0,0));
> process_result => "ttime.!process_owner";
> }
>
>
>
>
> =============== Output ===================
> This promise will kill all processes that have consume time: -d2 output
> {{{
> Added Variable 0 at hash address 48 in scope match with value (omitted)
> Setting local variable "match.0" context; $(0) = ntp 1743 0.0 0.0
> 28244 1712 ? Ss Oct27 0:13 /usr/sbin/ntpd -p /var/run/ntpd.pid
> -g -u 108:111
> SelectProcess(ntp 1743 0.0 0.0 28244 1712 ? Ss Oct27
> 0:13 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 108:111)
> SplitProcLine(ntp 1743 0.0 0.0 28244 1712 ? Ss Oct27
> 0:13 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 108:111)
> Selection filter matched TIME/TIME = 0:13 in [15,2592000]
> }}}
> To my knowledge is only consumed 13 minutes of time
>
> {{{
> Added Variable 0 at hash address 48 in scope match with value (omitted)
> Setting local variable "match.0" context; $(0) = bas 27053 0.4 0.0
> 10860 1296 pts/3 S+ 13:12 0:04 top -d 1
> SelectProcess(bas 27053 0.4 0.0 10860 1296 pts/3 S+ 13:12
> 0:04 top -d 1)
> SplitProcLine(bas 27053 0.4 0.0 10860 1296 pts/3 S+ 13:12
> 0:04 top -d 1)
> Selection filter matched TIME/TIME = 0:04 in [15,2592000]
> }}}
> This consumes only 4 minutes
>
> ===============================================================
>
> Is there something wrong with the bundle or is this a bug?
>
> regards
>
>
>
> --
> ********************************************************************
> * Bas van der Vlies e-mail: [email protected] *
> * SARA - Academic Computing Services Amsterdam, The Netherlands *
> ********************************************************************
> _______________________________________________
> Help-cfengine mailing list
> [email protected]
> https://cfengine.org/mailman/listinfo/help-cfengine
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine