1. Rule Based Event Management
Workshop 2013-03-12 / Version: 1.0.1
markus.schneider73@gmail.com
created with
2. Agenda
➢OpenNMS Activation of Drools
Complex Correlation Example
Auto Event Example
Drools with Groovy Example
More Information
OUCE 2013 2
3. OpenNMS Activation of Drools
Drools is part of the correlation engine
Correlation engine is not activated by default
Drools needs to be configured
OpenNMS comes with:
example Configurations
example Rules
OpenNMS uses Drools version: 5.1.1
OUCE 2013 3
7. Agenda
OpenNMS Activation of Drools
➢Complex Correlation Example
Auto Event Example
Drools with Groovy Example
More Information
OUCE 2013 7
8. Basic Rule Creation Workflow
Edit
Define custom
Create custom eventconf.xml
events in the
event config for including the
event config
custom event cfg
Edit
Define custom
Create custom drools-engine.xml
rules in the
rule file for referencing the
rule file
Custom *.drl file
Restart opennms
OUCE 2013 8
9. Workshop Configuration
(1) Clone Git repository
$> git clone http://www.github.com/
mschneider/ouce2013
(2) Copy all example configurations and rules
$> cd ./ouce2013/config/opennms/etc
$> sudo cp droolsengine.xml
XzampleRules01.drl
XzampleRules02.drl
$OPENNMS_HOME/etc
$> sudo cp events/Xzample.events.xml
$OPENNMS_HOME/etc/events
OUCE 2013 9
10. Workshop Configuration
(3) Add the following line to the end of eventconf.xml
$> echo
'<eventfile>events/Xzample.events.xml
</eventfile>' >>
OPENNMS_HOME/etc/eventconf.xml
(4) Restart OpenNMS
$> sudo service opennms restart
OUCE 2013 10
11. File Dependencies
$OPENNMS_HOME/etc
reference Xzample.event
eventconf.xml
.xml All Xzample Events
reference
drools-engine XzampleRules01 Complex Correlation
.xml .drl
Example
XzampleRules02 Auto Event
.drl
Example
OUCE 2013 11
14. Complex Correlation Example
Symptom Event
CarDirectDown
Problem Event Problem Event
Webserver1 Down Webserver2 Down
Resolution Event
CarDirectUp
Resolution Event Resolution Event
Webserver1 Up Webserver2 Up CarDirect
Events are
created by Drools
OUCE 2013 14
24. Event Sequence
Symptom Event
CarDirectDown
Problem Event Problem Event
Webserver1 Down Webserver2 Down
Resolution Event
CarDirectUp
Resolution Event
Webserver1 Up
OUCE 2013 24
27. Complex Correlation Example
Symptom Event
CarDirectDown
Problem Event Problem Event
Webserver1 Down Webserver2 Down
Resolution Event
CarDirectUp
Resolution Event Resolution Event
Webserver1 Up Webserver2 Up
OUCE 2013 27
31. Agenda
OpenNMS Activation of Drools
Complex Correlation Example
➢Auto Event Example
Drools with Groovy Example
More Info
OUCE 2013 31
32. Auto Event Example
Created by
Symptom Event Drools timer
…/autoTask/run Rule
Symptom Event Symptom Event
.../droolsTimer/start .../droolsTimer/stop
OUCE 2013 32
33. Auto Event Example
Practical Use Case Scenario
Practical Use Case Scenario
ScriptD triggers
the custom script
every 5 seconds
Custom
Script
Cloud
Drools ScriptD check-
Service
status.
Event groovy
if (status == true)
Drools creates Event
an event every 5 uei.opennms.org/droolsTimer/stop
seconds
OUCE 2013 33
40. Agenda
OpenNMS Activation of Drools
Complex Correlation Example
Auto Event Example
➢Drools with Groovy Example
More Information
OUCE 2013 40
41. Knowledge Session Creation
Three main fundamental concepts:
Knowledge Builder
Knowledge Base
Knowledge Session
OUCE 2013 41
45. Knowledge Base
Main purpose is to store and reuse knowledge definitions
Creation of Knowledge Base is expensive
Provides methods for creating knowledge sessions
Maintains a reference to all of the created knowledge
sessions
Knowledge Base can be reused instead of creating a new
one every time
OUCE 2013 45
47. Knowledge Session
Stateless Session
Doesn't maintain the context between one
interaction and the next one
Doesn't keep information from previous calls
Stateful Session
Keeps the information from several calls and
interactions
Previous calls can be used to add and enrich
the information we already have
OUCE 2013 47
53. Agenda
OpenNMS Activation of Drools
Complex Correlation Example
Auto Event Example
Drools with Groovy Example
➢More Information
OUCE 2013 53