Hi Glenn,<br><br>basically, the approach you have sketched is feasible (although the syntax would be somewhat different).<br><br>It's obvious that if you insist of putting most of the logic into application classes, Drools won't be able to do much for you. The trick is to keep the business logic in the rules :-)<br>
<br>Assuming classes such as<br> Parameter { ParType type; Host host; int value; ... }<br> Threshold1 { ParType type; Host: int alarmValue; }<br> Threshold2 { ParType type; Host: int warningValue; int alarmValue; }<br>
Bounds { ParType type; Host: int lowValue; int highValue; }<br><br>I'd try to deal with various evaluation strategies by grouping the rules according to evaluation models which are "grouping" objects that can be assigned, as need be, to host-parameter combinations. As an example:<br>
<br>rule "CPU load - Model WARN_ALARM"<br>when<br> $p : Parameter( type == $type, $value : value, $host : host )<br> $m : Model( id == ModelType.WARN_ALARM, $type : type == ParamType.CPU_LOAD, host == $h )<br>
$t : Threshold2( type == $type, host == $host, warningValue < $value )<br>then<br> warn that $h exceeds warning level for parameter type<br>end<br><br>For an alternative, a host should have a temperature between bounds:<br>
<br>rule "Temperature - Model BOUNDS"<br>
when<br>
$p : Parameter( type == $type, $value : value, $host : host )<br>
$m : Model( id == ModelType.BOUNDS, $type : type == ParamType.TEMPERATURE, host == $host )<br>
$t : Bounds( type == $type, host == $host, lowValue >$value || highValue < $value )<br>
then<br>
warn that $host has left the permitted temp. range<br>
end<br>
<br>You can see that another host's temperature could easily be checked against a single or double threshold.<br><br>The advantage lies in the concentration of all evaluation logic in rules. Changes won't affect the application around the rules engine, which would have to deal with updates of parameter readings and operator command to change the values of a host/parameter combination or even a host's evaluation model for a certain parameter.<br>
<br>-W<br><br><div class="gmail_quote">2010/2/9 Glenn Macgregor <span dir="ltr"><<a href="mailto:gmacgregor@pocketkings.ie">gmacgregor@pocketkings.ie</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div link="blue" vlink="purple" lang="EN-IE">
<div>
<p class="MsoNormal">Hi All,</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">I am in the process of evaluating Drools to use in a networks
& systems management project. Some of the initial use cases are listed
below.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><b>Use Cases:</b></p>
<p><span>1.<span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">
</span></span>Simple single parameter thresholds with configurable
warning and error levels.</p>
<p><span>2.<span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">
</span></span>Simple multi parameter thresholds from one host with
configurable warning and error levels.</p>
<p><span>3.<span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">
</span></span>Complex multi parameter thresholds from multiple hosts
with configurable warning and error levels.</p>
<p><span>4.<span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">
</span></span>Complex time based multi parameter thresholds from
multiple hosts with configurable warning and error levels.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">After reading about the Drools rules engine (Expert) and the
CEP (Fusion) it seems at a glance that it would be very useful in this
application. As I digging into use case 1 I am not sure Drools is actually going
to fit the bill as first thought.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Imagine a small network with 300 hosts each of which is
being polled for CPU data which can be massaged to produce an instantaneous CPU
Utilization which I want to check against some threshold, which can be
different for each host. I don’t see creating 300 rules to handle this
simple case as an ideal solution as I need to give control of the CPU
Utilization threshold to the teams who own the hosts. Thinking about how to
abstract that I imagine I could put the thresholds into a database and
rebuild/reload the rules as necessary but as the thresholds could change often
this seems like unnecessary overhead. I have moved on from that solution to the
idea that a threshold is an attribute of the parameter as name and value are
attributes. This allows me to attach the threshold value to the parameter
update and potentially have a Drools rule something like (not a working rule):</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><i>rule “test rule”</i></p>
<p class="MsoNormal"><i> when</i></p>
<p class="MsoNormal"><i> $param
: Parameter(name == someName) # comes from some map of params or something, not
sure yet.</i></p>
<p class="MsoNormal"><i> $param(value
>= warningThreshold)</i></p>
<p class="MsoNormal"><i> then</i></p>
<p class="MsoNormal"><i> #
Fire warning alert</i></p>
<p class="MsoNormal"><i> end</i></p>
<p class="MsoNormal"><b> </b></p>
<p class="MsoNormal">Where value and warningThreshold are members of the
Parameter object. </p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Having thought about this and discussed with some colleagues
we can not impose a ‘>=’ in the rule as some teams might what a
different set of comparators. Moving on to these new requirements I thought we
could have all the info encapsulated into the Parameter object as a set of
functions:</p>
<p><span style="font-family: Symbol;"><span>·<span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">
</span></span></span>isInWarning</p>
<p><span style="font-family: Symbol;"><span>·<span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">
</span></span></span>isInError</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><i>rule “test rule”</i></p>
<p class="MsoNormal"><i> when</i></p>
<p class="MsoNormal"><i> $param
: Parameter(name == someName) # comes from some map of params or something, not
sure yet.</i></p>
<p class="MsoNormal"><i> $param.isInWarning()</i></p>
<p class="MsoNormal"><i> then</i></p>
<p class="MsoNormal"><i> #
Fire warning event</i></p>
<p class="MsoNormal"><i> End</i></p>
<p class="MsoNormal"><i> </i></p>
<p class="MsoNormal">Questions:</p>
<p><span style="font-family: Symbol;"><span>·<span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">
</span></span></span>Is the above possible in Drools?</p>
<p><span style="font-family: Symbol;"><span>·<span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">
</span></span></span>What does Drools get me as my software is
already doing all the calculation and comparison work? </p>
<p><span style="font-family: Symbol;"><span>·<span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">
</span></span></span>Is there a better way to handle this using
Drools?</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Thanks for the reply’s</p>
<p class="MsoNormal"> </p><font color="#888888">
<p class="MsoNormal"> Glenn</p>
</font></div>
</div>
<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br>