I don't think that particular use of ifelapsed would work if the resource 
intensive update is also potentially disruptive, so constrained only to be 
checked at "Night". The first 5-minute interval in which that promise is 
checked, it will be about 18 hours old so all will be done together. The 
nearest I have got to this sort of thing is to split my set of clients into 5 
pseudo-random groups:-

bundle common class
{
    classes:
        "Ip0" expression => classmatch("ipv4_[0-9]*_[0-9]*_[0-9]*_[0-9]*[05]");
        "Ip1" expression => classmatch("ipv4_[0-9]*_[0-9]*_[0-9]*_[0-9]*[16]");
        "Ip2" expression => classmatch("ipv4_[0-9]*_[0-9]*_[0-9]*_[0-9]*[27]");
        "Ip3" expression => classmatch("ipv4_[0-9]*_[0-9]*_[0-9]*_[0-9]*[38]");
        "Ip4" expression => classmatch("ipv4_[0-9]*_[0-9]*_[0-9]*_[0-9]*[49]");
        "Hrs0" or => { "Hr00", "Hr06", "Hr12", "Hr18" };
        "Hrs1" or => { "Hr01", "Hr07", "Hr13", "Hr19" };
        "Hrs2" or => { "Hr02", "Hr08", "Hr14", "Hr20" };
        "Hrs3" or => { "Hr03", "Hr09", "Hr15", "Hr21" };
        "Hrs4" or => { "Hr04", "Hr10", "Hr16", "Hr22" };
        "Hrs5" or => { "Hr05", "Hr11", "Hr17", "Hr23" };
}

Then combine these along with splaytime (There is a catch-all in the last hour 
of the shift):-

bundle agent distribute
{
  classes:

    "Dist0" and => { Ip0, Hrs0 };
    "Dist1" and => { Ip1, Hrs1 };
    "Dist2" and => { Ip2, Hrs2 };
    "Dist3" and => { Ip3, Hrs3 };
    "Dist4" and => { Ip4, Hrs4 };

    "Dist" or => { Dist0, Dist1, Dist2, Dist3, Dist4, Hrs5 };
    "once_hourly" expression => splayclass("$(sys.host).$(sys.ipv4)", "hourly");
    "dist_now" and => { once_hourly, Dist };
}

The actual work uses dist_now:: - but could equally well use dist_now.Night:: 
instead.

It would be far simpler to arrange this if there was a third possibility in the 
second argument to splay class - "shift" to mean "once in a 6 hour shift". Is 
this sufficient detail and justification to be considered a feature request? 
(Apologies in advance - I realise this is close to a repeat of my previous 
posting a few days ago).

Chris Ritson (Computing Officer and School Safety Officer)

Room 707, Claremont Tower,        EMAIL: c.r.rit...@ncl.ac.uk
School of Computing Science,      PHONE: +44 191 222 8175
Newcastle University,             FAX  : +44 191 222 8232
Newcastle upon Tyne, UK NE1 7RU.  WEB  : http://www.cs.ncl.ac.uk/


>-----Original Message-----
>From: help-cfengine-boun...@cfengine.org [mailto:help-cfengine-
>boun...@cfengine.org] On Behalf Of Mark Burgess
>Sent: 28 April 2011 07:33
>To: Michael Stevens
>Cc: help-cfengine
>Subject: Re: Cfengine Help: Re: Avoiding "Duplicate selection of value"
>
>
>We can look into it if you file a feature request, but I'm not sure it's
>desirable. You can still do your updates every 15 mins even though the
>agent wakes up every 5 if you set the ifelapsed default to 15 mins or
>more.
>
>On 27/04/11 23:32, Michael Stevens wrote:
>> We conceivably could, there's not really a reason other than it
>doesn't seem necessary to update that often. I may well change it just
>to get splayclass working. Any chance of getting the splayclass interval
>as a settable parameter?
>>
>> On Apr 27, 2011, at 11:54 AM, Mark Burgess wrote:
>>
>>> Ah, I see what you mean. Sorry. You're right, one has to assume a
>resolution to do the hashing. Any reason why you can't up to 5 min
>resolution?
>>>
>>> On 27/04/11 19:48, Michael Stevens wrote:
>>>> How would I go about having splayclass work with our current */15
>run interval?
>>>>
>>>> On Apr 26, 2011, at 9:20 PM, Mark wrote:
>>>>
>>>>> No nothing is hardcoded, but the default exec time is 5 minutes.
>You are not missing out.
>>>>>
>>>>>
>>>>> Mark
>>>>>
>>>>>
>>>>> On 27 Apr 2011, at 01:09, Michael Stevens<m...@tippett.com>   wrote:
>>>>>
>>>>>> I wasn't aware of this. Correct me if I'm wrong, but from reading
>the docs, the "on" interval is hard-coded to 5 minutes, eg, since we're
>running cf3 every 15 minutes from cron, we'd miss 2/3 of the activations
>unless we up our schedule to every 5 minutes.
>>>>>>
>>>>>> On Apr 26, 2011, at 11:19 AM, no-re...@cfengine.com wrote:
>>>>>>
>>>>>>> Have you looked a splayclass?  It can randomize when promises are
>kept without
>>>>>>> the overhead of calling a shell.
>>>>>>> http://www.cfengine.org/manuals/cf3-reference.html#Function-
>splayclass
>>>>>> _______________________________________________
>>>>>> Help-cfengine mailing list
>>>>>> Help-cfengine@cfengine.org
>>>>>> https://cfengine.org/mailman/listinfo/help-cfengine
>>>>
>>
>_______________________________________________
>Help-cfengine mailing list
>Help-cfengine@cfengine.org
>https://cfengine.org/mailman/listinfo/help-cfengine
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to