我试图在虚拟服务器的大型池中执行预定任务,但是我希望最大限度地减less由此产生的对pipe理程序的性能影响,理想情况下一次在一台服务器上执行。
想想这样的事情:
Hr07.Min01.host_1:: "scheduled_service_restart" usebundle => service_restart; Hr07.Min02.host_2:: "scheduled_service_restart" usebundle => service_restart; Hr07.Min03.host_3:: "scheduled_service_restart" usebundle => service_restart; ...
现在,这工作; 但是名单会显着增长,而且看起来不太好看。
我能否以某种方式将MinXY硬件中的整数与主机序列号(或任何一般类的序列号) MinXY匹配?
除非您以1分钟的时间间隔运行代理,否则我不build议使用Min01这样的1分钟分辨率类。 那个课只会在那一分钟内被定义。 默认情况下,代理每5分钟运行一次,即使是大型策略集,一次完整的策略运行通常也会在一分钟内完成。
你可能想看看splayclass函数。 您可以在每小时或每天的时间段内确定一个class级。 例如:
bundle agent example { classes: Hr07:: "service_restart" expression => splayclass("$(sys.fqhost)", "hourly"), comment => "So that we only perform restarts during the 7 oclock hour, and so that not all hosts restart at the same time we splay the restart class over an hour. Each host will define some 5 minute time slot during the hour."; methods: service_restart:: "scheduled_service_restart" usebundle => service_restart; }
irc.freenode.net上的#cfengine和help-cfengine也是问CFEngine相关问题的好地方。