As I mentioned at LISA, I'm doing some strange things with Mon, most
notably using it as a job scheduler for our production batch feeds.  It's
worked amazingly well and I'm really happy with it.

The only change I needed to make was to add a new way of thinking about
randstart.  Since dependencies that haven't been checked yet are considered
to be not failed for depend checking purposes[1], one needs to be absolutely
sure that all the dependencies are checked before the thing that depends on
them.  If you use randstart as written, you don't get that assurance.  If
you don't use randstart, however, you get clumps of monitors firing off at
once.

My solution was to add a new option called 'randmethod', settable either in
the config file or on the command line using -R.  It defaults to "scatter",
which is the current method.  ("pick a number between 0 and $randstart-1
and schedule this monitor to start then.")  The new method is called "skew"
and it gives a bit more control over when things start.  ("pick a number
between -$randstart and +$randstart.  Add that to the normal interval and
schedule this monitor to start then.")

Here's the diff from mon-0-99-2.6:

------------------------------------------------------------------
201c201
< getopts ("fhlMSvda:A:b:B:c:D:i:L:m:O:o:p:P:r:s:t:", \%opt);
---
> getopts ("fhlMSvda:A:b:B:c:D:i:L:m:O:o:p:P:r:R:s:t:", \%opt);
267a268
> $CF{"RANDMETHOD"} = $opt{"R"} if ($opt{"R"});
887a889,891
>           } elsif ($1 eq "randmethod") {
>               $new_CF{"RANDMETHOD"} = $2;
> 
3138,3139c3142,3150
<             $watch{$group}->{$service}->{"_timer"} =
<                 int (rand ($CF{"RANDSTART"}));
---
>           if ($CF{"RANDMETHOD"} eq "scatter") {
>               $watch{$group}->{$service}->{"_timer"} =
>                   int (rand ($CF{"RANDSTART"}));
>           } elsif ($CF{"RANDMETHOD"} eq "skew") {
>               $watch{$group}->{$service}->{"_timer"} +=
>                   0 - $CF{"RANDSTART"} + int (rand ($CF{"RANDSTART"} *
>                   2));
>           } else {
>               syslog ("err", "Bad RANDMETHOD found: ".$CF{"RANDMETHOD"});
>           }
4339a4351
>     $CF{"RANDMETHOD"} = "scatter";
------------------------------------------------------------------

-Luke

[1] Another patch I'll likely make, unless I can convince everyone (read:
Jim) that the default should be otherwise. :-)
_______________________________________________
mon mailing list
[EMAIL PROTECTED]
http://linux.kernel.org/mailman/listinfo/mon

Reply via email to