Installation Guide
This installation guide will help you to setup the following components of Auto Resolution
- EventHandler Bot
- Services - 1. Neo4jDBHandler 2. Recommendation Engine (Static - Json Based)
Prerequisites:
- Neo4j (Recommended versions: 3.3.3,3.4.0)
- node js (Recommended version: v6.11.3)
Getting Started:
EventHandler bot can be set up manually by following the steps described below:
- Clone our OnBot repository from github (git clone https://github.com/CognizantOneDevOps/OnBot.git)
- Run this command: npm install -g yo generator-hubot
- Create a parent folder myhubot
- Run the following commands:
cd myhubot
yo hubot
- Copy the scripts from the cloned repository(first step) from the bot folder event-handler-bot into myhubot/scripts folder
- yo generator creates the package.json file under myhubot directory
Now set the required environment variables (As mentioned below in Environment Variables section)
Variable | Purpose |
---|---|
EXPRESS_PORT | Port number where the hubot will run |
HUBOT_SLACK_TOKEN | Bot User OAuth Access Token of EventHandler bot |
NEO4JHANDLER_IP | "IP:port" where the Neo4jDBHandler service is running |
RECOMMENDATION_ENGINE_IP | "IP:port" where the RecommendationEngine service is running |
Config file | Location | Description |
---|---|---|
tokenizer.json | EventHandler/scripts/ | Specifies the fields in notification and resolution and the regex to match the same. The regex is to be specified in the order of decreasing number of groups (i.e.) the regex that matches the maximum number of fields should be at top followed by the regex that matches fewer number of fields and so on. |
problemconfig.json | EventHandler/scripts/ | The metadata for every problem is to be specified in this file. |
resolutionconfig.json | EventHandler/scripts/ | The metadata for every action is to be specified in this file. |
getrecommendation.json | EventHandler/scripts/ | The primary key field to be used and the field to be retrived for recommendation (command field) needs to be specified in this file. |
filter.json | EventHandler/scripts/ | The condition under which recommendations should be fetched is specified in this file. |
Note: Click the filenames to download the example config file.
Run EventHandler Bot
- Change the working directory to myhubot folder
- Run: npm install
Finally, start the bot as a background process (logs will be redirected to hubot.log file): nohup ./bin/hubot -a slack > hubot.log &
At any time the bot running in background can be stopped by this command: ps aux | grep -ie <botname> | awk '{print $2}' | xargs kill -9
The <botname> can be fetched from the following line of the bin/hubot file:
exec node_modules/.bin/hubot --name "botname" "$@"
Setting up Services : Neo4jDBHandler and Recommendation Engine
Node services (Neo4jDBHandler and RecommendationEngine) can be set up manually by following the steps described below:
- Clone our OnBot repository from github (git clone https://github.com/CognizantOneDevOps/OnBot.git)
- Change the working directory to reco-engine folder
- Now set the required environment variables (As mentioned below in Environment Variables section)
Config file | Location | Description |
---|---|---|
notification.js, action.js, problem.js | Neo4jServices/models/ | The properties and relationships of these node labels needs to be defined in the respective js files. Refer: https://github.com/adam-cowley/neode/blob/master/example/Person.js |
<<notificationTool>>.json | Neo4jServices/resources/eventlifecyclemapping/ | The list of files that maps the events to the suggested actions are to be placed here. The file name should be the name of the notification tool (Monitoring tool). For example, if CFBot is used for monitoring, then name the file as "cfbot.json". |
<<platform>>.json | Neo4jServices/resources/lifecyclecmdmapping/ | The list of files that maps the actions to commands of the remediation tool used in the platform are to be placed here. The file name should be the name of the platform where the apps are hosted. For example, if bluemix platform is used, then name the file as "bluemix.json". |
Note: Click the filenames to download the example config file.
- Logging into api.slack.com navigating to the My Apps section at slack.com/apps
- Click the Interactive Components link in the menu
- Click Enable Interactive Messages, enter Request URL (http://<RecommendationEngine IP:port>/hubot/ai-callback) and click Enable Interactive Messages
The Request URL must be publicly accessible and secure.
Run Neo4jServices:
- Change the working directory to reco-engine folder
- Run: npm install
- Finally, start the node services as :
- node RecommendationEngine.js
- node Neo4jDBHandler.js