Creating alert definitions with CLI

Michael Burman miburman at redhat.com
Fri Oct 10 12:53:31 UTC 2014


Hi,

About the long standing RFE (BZ 617202), I'd like to ask for your opinions. I've done some work and a preliminary implementation that would make creating definitions through CLI as close as possible to the GUI interface. Now I would like to have some opinions, if I'm taking the right route and if you have any wishes. I try to employ the builder-pattern in this case and I tried to use existing domain-models (I haven't changed any existing ones to preserve backwards compatibility) whenever it made sense.

So here's the sort of query language I have in place now ("working" example):

        AlertDefinitionTemplate template = new AlertDefinitionTemplate()
                .enabled(true)
                .description("description")
                .name("name")
                .priority(AlertPriority.MEDIUM)
                .alertProtocol(BooleanExpression.ANY);

        // Set recovery rules
        template.recovery()
                .disableWhenFired(false);

        // Set dampening rules
        template.dampening()
                .category(AlertDampening.Category.CONSECUTIVE_COUNT)
                .occurences(2);

        // Add AlertConditions
        template.addCondition(AvailabilityCondition.class)
                .availability(AlertConditionOperator.AVAIL_GOES_DOWN);

        template.addCondition(AbsoluteValueCondition.class)
                .comparator(AlertConditionOperator.GREATER_THAN)
                .value(90.0)
                .metric(11465);

Function names might not be consistent yet in all cases (I've tried to keep them short, but in some cases I couldn't think of very short descriptive one). There's no PR yet for this.

   - Micke


More information about the rhq-devel mailing list