Created
August 18, 2014 02:27
-
-
Save bugcy013/df94d8caf5251b3f653b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ############################################################ | |
| # ___ _ _ ____ _____ ____ ___ _ _____ | |
| # / _ \| | | |/ ___| ____| |___ \ / _ \/ |___ / | |
| # | | | | | | | | | _| __) | | | | | |_ \ | |
| # | |_| | |_| | |___| |___ / __/| |_| | |___) | | |
| # \___/ \___/ \____|_____| |_____|\___/|_|____/ | |
| # | |
| # Rule Based Event Management | |
| # Workshop 2013-03-12 | |
| # Runbook | |
| # Author: Markus Schneider | |
| # https://gist.github.com/m-schneider/5143591#file-ouce2013-rbem-ws-runbook | |
| # | |
| ############################################################ | |
| #============================== | |
| # 1. SETUP YOUR ENV | |
| #============================== | |
| vi ~/.bashrc | |
| ## | |
| ## Add the following line(s) | |
| ## | |
| export OPENNMS_HOME=/usr/share/opennms | |
| PATH=$PATH:$OPENNMS_HOME/bin | |
| . ~/.bashrc | |
| #============================== | |
| # 2. UPDATE OUCE2013 REPOSITORY | |
| #============================== | |
| cd ~/ouce2013 | |
| git pull | |
| ## | |
| ## Open new terminal window | |
| ## | |
| cat ~/ouce2013/config/opennms/etc/OUCE2013-RBEM-WS-RUNBOOK.txt | more | |
| #============================== | |
| # 3. OPEN THE WEB BROWSER | |
| #============================== | |
| ## | |
| ## Open two tabs and go to the following urls | |
| ## | |
| ## user: admin | |
| ## password: admin | |
| ## | |
| ## 1. http://localhost:8980/opennms/event/list | |
| ## 2. http://localhost:8980/opennms/alarm/list | |
| ## | |
| #============================== | |
| # 4. NODE DISCOVERY | |
| #============================== | |
| send-event.pl -i 127.0.0.1 -s Discovery -p "nodelabel sun" uei.opennms.org/internal/capsd/addInterface -x 4 | |
| ## | |
| ## Look for the nodeid by using the OpenNMS WEB GUI | |
| ## | |
| vi ~/.bashrc | |
| ## | |
| ## Add the following line(s) | |
| ## | |
| export NODEID=1 # <--- Your nodeid here! | |
| . ~/.bashrc | |
| ## | |
| ## Test it! | |
| ## | |
| echo $NODEID | |
| #============================== | |
| # 5. ACTIVATE DROOLS | |
| #============================== | |
| sudo cp $OPENNMS_HOME/etc/examples/correlation-engine.xml $OPENNMS_HOME/etc | |
| sudo cp $OPENNMS_HOME/etc/examples/drools-engine.xml $OPENNMS_HOME/etc | |
| sudo cp $OPENNMS_HOME/etc/examples/LocationMonitorRules.drl $OPENNMS_HOME/etc | |
| sudo cp $OPENNMS_HOME/etc/examples/NodeParentRules.drl $OPENNMS_HOME/etc | |
| sudo cp $OPENNMS_HOME/etc/examples/nodeParentRules-context.xml $OPENNMS_HOME/etc | |
| sudo cp ~/ouce2013/config/opennms/etc/service-configuration.xml $OPENNMS_HOME/etc | |
| sudo service opennms restart | |
| ## | |
| ## Open new terminal window | |
| ## | |
| tail -f $OPENNMS_HOME/logs/daemon/spring.log | grep 'drools-correlation-engine' | |
| #============================== | |
| # 6. SIMPLE DROOLS RULE TEST | |
| #============================== | |
| sudo cp ~/ouce2013/config/opennms/etc/events/Xzample.events.xml $OPENNMS_HOME/etc/events | |
| sudo cp ~/ouce2013/config/opennms/etc/eventconf.xml $OPENNMS_HOME/etc | |
| sudo cp ~/ouce2013/config/opennms/etc/NodeParentRules.drl $OPENNMS_HOME/etc | |
| sudo service opennms restart | |
| ## | |
| ## Open new terminal window | |
| ## | |
| tail -f $OPENNMS_HOME/logs/daemon/output.log | grep '\--->' | |
| ## | |
| ## Send Problem Event | |
| ## | |
| send-event.pl -n $NODEID -d "Status: 503" uei.opennms.org/nodes/nodeDown -x 4 | |
| ## | |
| ## Send Resolution Event | |
| ## | |
| send-event.pl -n $NODEID -d "Status: 200" uei.opennms.org/nodes/nodeUp -x 3 | |
| #============================== | |
| # 7. COMPLEX CORRELATION EXAMPLE | |
| #============================== | |
| sudo cp ~/ouce2013/config/opennms/etc/drools-engine.xml $OPENNMS_HOME/etc | |
| sudo cp ~/ouce2013/config/opennms/etc/XzampleRules01.drl $OPENNMS_HOME/etc | |
| sudo cp ~/ouce2013/config/opennms/etc/XzampleRules02.drl $OPENNMS_HOME/etc | |
| sudo service opennms restart | |
| ## | |
| ## Open a new terminal window | |
| ## | |
| tail -f $OPENNMS_HOME/logs/daemon/output.log | grep '\--->' | |
| ## | |
| ## Send Problem Events | |
| ## | |
| send-event.pl -n $NODEID -s Http -d "webserver1" -p "subSource webserver1" -p "source send-event.pl" uei.opennms.org/webserver/down -x 4 | |
| send-event.pl -n $NODEID -s Http -d "webserver2" -p "subSource webserver2" -p "source send-event.pl" uei.opennms.org/webserver/down -x 4 | |
| ## | |
| ## Send Resolution Events | |
| ## | |
| send-event.pl -n $NODEID -s Http -d "webserver1" -p "subSource webserver1" -p "source send-event.pl" uei.opennms.org/webserver/up -x 3 | |
| send-event.pl -n $NODEID -s Http -d "webserver2" -p "subSource webserver2" -p "source send-event.pl" uei.opennms.org/webserver/up -x 3 | |
| #============================== | |
| # 8. AUTO EVENT EXAMPLE | |
| #============================== | |
| ## | |
| ## Open a new terminal window | |
| ## | |
| tail -f $OPENNMS_HOME/logs/daemon/output.log | grep '\--->' | |
| send-event.pl -n $NODEID -s autoTask -d "droolsTimer" -p "subSource drools" -p "source send-event.pl" uei.opennms.org/droolsTimer/start -x 4 | |
| send-event.pl -n $NODEID -s autoTask -d "droolsTimer" -p "subSource drools" -p "source send-event.pl" uei.opennms.org/droolsTimer/stop -x 4 | |
| #============================== | |
| # 9. DROOLS WITH GROOVY | |
| #============================== | |
| ## | |
| ## Open a new terminal window | |
| ## | |
| cd ~/ouce2013/groovy/non-gradle | |
| ./change-rules.sh | |
| cd ~/ouce2013/groovy/non-gradle/change-rules/src/org/xzample/drools | |
| cat Event.groovy | more | |
| cat program.groovy | more | |
| cat rule.drl | more |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment