SlideShare une entreprise Scribd logo
1  sur  56
Télécharger pour lire hors ligne
Rule Based Event Management
Workshop 2013-03-12 / Version: 1.0.1
         markus.schneider73@gmail.com




                                        created with
Agenda
➢OpenNMS Activation of Drools
   Complex Correlation Example
   Auto Event Example
   Drools with Groovy Example
   More Information




OUCE 2013                         2
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
Runbook

Ready, Steady, Go...
https://gist.github.com/m-schneider




OUCE 2013                             4
Runbook
Execution Order
1. SETUP YOUR ENV
2. UPDATE OUCE2013 REPOSITORY
3. OPEN THE WEB BROWSER
4. NODE DISCOVERY
5. ACTIVATE DROOLS
6. SIMPLE DROOLS RULE TEST


OUCE 2013                       5
$> showtime

03/12/13   OUCE 2013   6
Agenda
   OpenNMS Activation of Drools
➢Complex Correlation Example
   Auto Event Example
   Drools with Groovy Example
   More Information




OUCE 2013                          7
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
Workshop Configuration
(1) Clone Git repository
   $> git clone http://www.github.com/ 
                   m­schneider/ouce2013

(2) Copy all example configurations and rules
   $> cd ./ouce2013/config/opennms/etc 
   $> sudo cp drools­engine.xml 
          XzampleRules01.drl 
             XzampleRules02.drl 
             $OPENNMS_HOME/etc
   $> sudo cp events/Xzample.events.xml 
         $OPENNMS_HOME/etc/events      

OUCE 2013                                       9
Workshop Configuration
(3) Add the following line to the end of eventconf.xml
    $> echo 
       '<event­file>events/Xzample.events.xml 
       </event­file>' >> 
      OPENNMS_HOME/etc/eventconf.xml


(4) Restart OpenNMS
     $> sudo service opennms restart
       



OUCE 2013                                                10
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
Runbook
Execution Order
7. COMPLEX CORRELATION EXAMPLE
       CONFIGURATION




OUCE 2013                        12
$> showtime

03/12/13   OUCE 2013   13
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
Send Event

Grep for Drools log file entries
$> tail ­f  $OPENNMS_HOME/logs/daemon/output.log 
   | grep '­­­>'


$> ./send­event.pl ­n $NODEID ­s Http 
   ­d "webserver1" 
   ­p "subSource webserver1" 
   ­p "source sendevent.pl"   
   uei.opennms.org/webserver/down ­x 4


OUCE 2013                                       15
Event Sequence


            Problem Event
            Webserver1 Down




OUCE 2013                     16
Alarm View




OUCE 2013    17
Send Event


$> ./send­event.pl ­n $NODEID ­s Http 
   ­d "webserver2" 
   ­p "subSource webserver2" 
   ­p "source sendevent.pl"  
   uei.opennms.org/webserver/down ­x 4




OUCE 2013                                18
Event Sequence


            Problem Event     Problem Event
            Webserver1 Down   Webserver2 Down




OUCE 2013                                       19
Alarm View




OUCE 2013    20
Event Sequence
                                      Symptom Event
                                      CarDirectDown


            Problem Event     Problem Event
            Webserver1 Down   Webserver2 Down




OUCE 2013                                             21
Alarm View




OUCE 2013    22
Send Event


$> ./send­event.pl ­n $NODEID ­s Http 
   ­d "webserver1" 
   ­p "subSource webserver1" 
   ­p "source sendevent.pl"
   uei.opennms.org/webserver/up ­x 3




OUCE 2013                                23
Event Sequence
                                       Symptom Event
                                       CarDirectDown


            Problem Event      Problem Event
            Webserver1 Down    Webserver2 Down

                                       Resolution Event
                                       CarDirectUp

            Resolution Event
            Webserver1 Up



OUCE 2013                                                 24
Alarm View




OUCE 2013    25
Send Event


$> ./send­event.pl ­n $NODEID ­s Http 
   ­d "webserver2"
   ­p "subSource webserver2" 
   ­p "source sendevent.pl"  
   uei.opennms.org/webserver/up ­x 3




OUCE 2013                                26
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
Alarm View




OUCE 2013    28
Runbook
Execution Order
7. COMPLEX CORRELATION EXAMPLE
       SEND EVENTS




OUCE 2013                        29
$> showtime

03/12/13   OUCE 2013   30
Agenda
   OpenNMS Activation of Drools
   Complex Correlation Example
➢Auto Event Example
   Drools with Groovy Example
   More Info




OUCE 2013                          31
Auto Event Example
                               Created by
            Symptom Event      Drools timer
            …/autoTask/run        Rule




Symptom Event                Symptom Event
.../droolsTimer/start        .../droolsTimer/stop




OUCE 2013                                           32
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
Send Event


$> ./send­event.pl ­n $NODEID ­s autoTask  
   ­d "droolsTimer" 
   ­p "subSource drools"  
   ­p "source send­event.pl"  
   uei.opennms.org/droolsTimer/start ­x 4




OUCE 2013                                34
Log File




OUCE 2013   35
Send Event


$> ./send­event.pl ­n $NODEID ­s autoTask  
   ­d "droolsTimer" 
   ­p "subSource drools"  
   ­p "source send­event.pl"  
   uei.opennms.org/droolsTimer/stop ­x 4




OUCE 2013                                36
Alarm View




OUCE 2013    37
Runbook
Execution Order
8. AUTO EVENT EXAMPLE




OUCE 2013               38
$> showtime

03/12/13   OUCE 2013   39
Agenda
   OpenNMS Activation of Drools
   Complex Correlation Example
   Auto Event Example
➢Drools with Groovy Example
   More Information




OUCE 2013                          40
Knowledge Session Creation
Three main fundamental concepts:
       Knowledge Builder
       Knowledge Base
       Knowledge Session




OUCE 2013                          41
Knowledge Session Creation
  Overview
Step 1




         KnowledgeBuilder
         KnowledgeBuilder                                        *.drl
             Factory
                                 KnowledgeBuilder
                                 KnowledgeBuilder                *.drl
             Factory
Step 2




         KnowledgeBase
         KnowledgeBase                                      Knowledge
                                                            Knowledge
                                 KnowledgeBase
                                 KnowledgeBase
            Factory
            Factory                                         Packages
                                                             Packages



                     Stateless                       Stateful
Step 3




                     Stateless                        Stateful
                    Knowldege
                    Knowldege                       Knowldege
                                                    Knowldege
                     Session
                      Session                        Session
                                                      Session



   OUCE 2013                                                             42
Knowledge Builder
   Building KnowledgePackage from knowledge definitions
   Knowledge Builder Factory creates Knowledge Builder
   Knowleged definitions are:
       Rules, Processes and Types
   Can add multiple resources of different types:
       DRL, DRF, PKG etc...
   Errors reported by hasErrors & getError method



OUCE 2013                                             43
Knowledge Builder
         KnowledgeBuilder kbuilder =
                 KnowledgeBuilderFactory.newKnowledgeBuilder()

         kbuilder.add(
            ResourceFactory.newClassPathResource("rules.drl"),
            ResourceType.DRL);

         if ( kbuilder.hasErrors() ) {
            println( kbuilder.getErrors().toString() )
            throw new RuntimeException( "Unable to  
                                        compile "rules.drl"." )
         }
             KnowledgeBuilder
Step 1




              KnowledgeBuilder  KnowledgeBuilder        *.drl
                                                        *.drl
                  Factory       KnowledgeBuilder
                 Factory



     OUCE 2013                                               44
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
Knowledge Base

    KnowledgeBase kbase =
               KnowledgeBaseFactory.newKnowledgeBase()

    kbase.addKnowledgePackages(
               kbuilder.getKnowledgePackages())
Step 2




         KnowledgeBase
         KnowledgeBase                        Knowledge
                                              Knowledge
                          KnowledgeBase
                          KnowledgeBase
            Factory
            Factory                           Packages
                                               Packages




   OUCE 2013                                              46
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
Knowledge Session
    StatefulKnowledgeSession ksession = 
                         kbase.newStatefulKnowledgeSession()

    Event event = new Event(uei:"uei.opennms.org/            
                        webserver/down",
                        severity:6,
                        priority:2,
                        message:"webserver1 not available")

    ksession.insert( event )

    ksession.fireAllRules()
Step 3




                Stateless
                Stateless              Stateful
                                        Stateful
               Knowldege
               Knowldege              Knowldege
                                      Knowldege
                Session
                 Session               Session
                                        Session
   OUCE 2013                                            48
Drools with Groovy
(1) Go to the cloned Git repository
   $> cd ~/ouce2013/groovy/non­gradle
   $> ./change­rules.sh




OUCE 2013                               49
Drools with Groovy
(2) Program Files
   $> cd ~/ouce2013/groovy/non­gradle/change­
      rules/src/org/xzample/drools




OUCE 2013                                       50
Runbook
Execution Order
9. DROOLS WITH GROOVY




OUCE 2013               51
$> showtime

03/12/13   OUCE 2013   52
Agenda
   OpenNMS Activation of Drools
   Complex Correlation Example
   Auto Event Example
   Drools with Groovy Example
➢More Information




OUCE 2013                          53
More Info
Workshop Slides
   http://de.slideshare.net/mschneider73/OUCE2013-RBEM-WS
GitHub
   https://gist.github.com/m-schneider/5143591#file-ouce2013-rbem-ws-runbook
OpenNMS
   http://www.opennms.org/documentation/java-apidocs-stable/
   http://www.opennms.org/documentation/java-apidocs-
    stable/org/opennms/netmgt/xml/event/Event.html
   http://www.opennms.org/documentation/java-apidocs-
    stable/org/opennms/netmgt/model/events/EventBuilder.html
   http://opennms.git.sourceforge.net/git/gitweb.cgi?
    p=opennms/opennms;a=tree;f=opennms-correlation/drools-correlation-
    engine/src/main/java/org/opennms/netmgt/correlation/drools;h=aaffefdf28ac3f
    e585cbab4db41b45f118ab85d9;hb=HEAD

OUCE 2013                                                                   54
More Info
Groovy
   http://groovy.codehaus.org/
   http://groovy.codehaus.org/Getting+Started+Guide




OUCE 2013                                              55
Comments & Questions
    Thank you for your attention
Contact details:
markus.schneider73@gmail.com
www.rapideca.org


03/12/13            OUCE 2013   56

Contenu connexe

Similaire à Ouce2013-RBEM-WS

Delivering Go.CD with Terraform and Docker
Delivering Go.CD with Terraform and DockerDelivering Go.CD with Terraform and Docker
Delivering Go.CD with Terraform and DockerJorrit Salverda
 
ITB2019 Try This At Home: Building a Personal Docker Swarm - Matt Clemente
ITB2019 Try This At Home: Building a Personal Docker Swarm - Matt ClementeITB2019 Try This At Home: Building a Personal Docker Swarm - Matt Clemente
ITB2019 Try This At Home: Building a Personal Docker Swarm - Matt ClementeOrtus Solutions, Corp
 
JCConf 2015 - 輕鬆學google的雲端開發 - Google App Engine入門(下)
JCConf 2015  - 輕鬆學google的雲端開發 - Google App Engine入門(下)JCConf 2015  - 輕鬆學google的雲端開發 - Google App Engine入門(下)
JCConf 2015 - 輕鬆學google的雲端開發 - Google App Engine入門(下)Simon Su
 
Android developmenttools 20100424
Android developmenttools 20100424Android developmenttools 20100424
Android developmenttools 20100424Marakana Inc.
 
A New Perspective on Resource-Level Cloud Forensics
A New Perspective on Resource-Level Cloud ForensicsA New Perspective on Resource-Level Cloud Forensics
A New Perspective on Resource-Level Cloud ForensicsChristopher Doman
 
(130720) #fitalk trends in d forensics
(130720) #fitalk   trends in d forensics(130720) #fitalk   trends in d forensics
(130720) #fitalk trends in d forensicsINSIGHT FORENSIC
 
Nats meetup oct 2016 docker 112
Nats meetup oct 2016 docker 112Nats meetup oct 2016 docker 112
Nats meetup oct 2016 docker 112Nirmal Mehta
 
Reversing & malware analysis training part 12 rootkit analysis
Reversing & malware analysis training part 12   rootkit analysisReversing & malware analysis training part 12   rootkit analysis
Reversing & malware analysis training part 12 rootkit analysisAbdulrahman Bassam
 
Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)
Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)
Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)enpit GmbH & Co. KG
 
Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)
Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)
Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)Andreas Koop
 
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境謝 宗穎
 
High Availability with Windows Server Clustering and Geo-Clustering
High Availability with Windows Server Clustering and Geo-ClusteringHigh Availability with Windows Server Clustering and Geo-Clustering
High Availability with Windows Server Clustering and Geo-ClusteringStarWind Software
 
Continuous Integration using Cruise Control
Continuous Integration using Cruise ControlContinuous Integration using Cruise Control
Continuous Integration using Cruise Controlelliando dias
 
Loophole: Timing Attacks on Shared Event Loops in Chrome
Loophole: Timing Attacks on Shared Event Loops in ChromeLoophole: Timing Attacks on Shared Event Loops in Chrome
Loophole: Timing Attacks on Shared Event Loops in Chromecgvwzq
 
Eurosec2014 - An introduction to honeyclient technologies
Eurosec2014 - An introduction to honeyclient technologiesEurosec2014 - An introduction to honeyclient technologies
Eurosec2014 - An introduction to honeyclient technologiesAngelo Dell'Aera
 
Gradle 3.0: Unleash the Daemon!
Gradle 3.0: Unleash the Daemon!Gradle 3.0: Unleash the Daemon!
Gradle 3.0: Unleash the Daemon!Eric Wendelin
 
Improving WordPress Performance with Xdebug and PHP Profiling
Improving WordPress Performance with Xdebug and PHP ProfilingImproving WordPress Performance with Xdebug and PHP Profiling
Improving WordPress Performance with Xdebug and PHP ProfilingOtto Kekäläinen
 
The Theory Of The Dom
The Theory Of The DomThe Theory Of The Dom
The Theory Of The Domkaven yan
 

Similaire à Ouce2013-RBEM-WS (20)

Delivering Go.CD with Terraform and Docker
Delivering Go.CD with Terraform and DockerDelivering Go.CD with Terraform and Docker
Delivering Go.CD with Terraform and Docker
 
ITB2019 Try This At Home: Building a Personal Docker Swarm - Matt Clemente
ITB2019 Try This At Home: Building a Personal Docker Swarm - Matt ClementeITB2019 Try This At Home: Building a Personal Docker Swarm - Matt Clemente
ITB2019 Try This At Home: Building a Personal Docker Swarm - Matt Clemente
 
JCConf 2015 - 輕鬆學google的雲端開發 - Google App Engine入門(下)
JCConf 2015  - 輕鬆學google的雲端開發 - Google App Engine入門(下)JCConf 2015  - 輕鬆學google的雲端開發 - Google App Engine入門(下)
JCConf 2015 - 輕鬆學google的雲端開發 - Google App Engine入門(下)
 
Android developmenttools 20100424
Android developmenttools 20100424Android developmenttools 20100424
Android developmenttools 20100424
 
A New Perspective on Resource-Level Cloud Forensics
A New Perspective on Resource-Level Cloud ForensicsA New Perspective on Resource-Level Cloud Forensics
A New Perspective on Resource-Level Cloud Forensics
 
jBPM
jBPMjBPM
jBPM
 
(130720) #fitalk trends in d forensics
(130720) #fitalk   trends in d forensics(130720) #fitalk   trends in d forensics
(130720) #fitalk trends in d forensics
 
Nats meetup oct 2016 docker 112
Nats meetup oct 2016 docker 112Nats meetup oct 2016 docker 112
Nats meetup oct 2016 docker 112
 
Reversing & malware analysis training part 12 rootkit analysis
Reversing & malware analysis training part 12   rootkit analysisReversing & malware analysis training part 12   rootkit analysis
Reversing & malware analysis training part 12 rootkit analysis
 
Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)
Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)
Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)
 
Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)
Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)
Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)
 
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
 
High Availability with Windows Server Clustering and Geo-Clustering
High Availability with Windows Server Clustering and Geo-ClusteringHigh Availability with Windows Server Clustering and Geo-Clustering
High Availability with Windows Server Clustering and Geo-Clustering
 
Continuous Integration using Cruise Control
Continuous Integration using Cruise ControlContinuous Integration using Cruise Control
Continuous Integration using Cruise Control
 
Loophole: Timing Attacks on Shared Event Loops in Chrome
Loophole: Timing Attacks on Shared Event Loops in ChromeLoophole: Timing Attacks on Shared Event Loops in Chrome
Loophole: Timing Attacks on Shared Event Loops in Chrome
 
Eurosec2014 - An introduction to honeyclient technologies
Eurosec2014 - An introduction to honeyclient technologiesEurosec2014 - An introduction to honeyclient technologies
Eurosec2014 - An introduction to honeyclient technologies
 
Gradle 3.0: Unleash the Daemon!
Gradle 3.0: Unleash the Daemon!Gradle 3.0: Unleash the Daemon!
Gradle 3.0: Unleash the Daemon!
 
Javascript Browser Events.pdf
Javascript Browser Events.pdfJavascript Browser Events.pdf
Javascript Browser Events.pdf
 
Improving WordPress Performance with Xdebug and PHP Profiling
Improving WordPress Performance with Xdebug and PHP ProfilingImproving WordPress Performance with Xdebug and PHP Profiling
Improving WordPress Performance with Xdebug and PHP Profiling
 
The Theory Of The Dom
The Theory Of The DomThe Theory Of The Dom
The Theory Of The Dom
 

Ouce2013-RBEM-WS