Installation Guide

This installation guide will help you to setup the following components of Auto Resolution

  1. EventHandler Bot
  2. 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 setup

EventHandler bot can be set up manually by following the steps described below:

          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)

Environment Variables
VariablePurpose

EXPRESS_PORT

Port number where the hubot will run
HUBOT_SLACK_TOKENBot 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
Configuration
Config fileLocationDescription
tokenizer.jsonEventHandler/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.jsonEventHandler/scripts/

The metadata for every problem is to be specified in this file.

resolutionconfig.jsonEventHandler/scripts/The metadata for every action is to be specified in this file.
getrecommendation.jsonEventHandler/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.jsonEventHandler/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

  1. Change the working directory to myhubot folder  
  2. 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

Neo4jServices setup

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)
Environment Variables
 Neo4jDBHandler
VariablePurpose

NEO4J_PROTOCOL

"bolt"

NEO4J_HOST

IP address where neo4j is running

NEO4J_PORT

port where the neo4j bolt protocol is running

NEO4J_USERNAME

neo4j login username

NEO4J_PASSWORD

neo4j login password
 RecommendationEngine
VariablePurpose

NEO4JHANDLER_IP

"IP:port" where the Neo4jDBHandler service is running

EVENTHANDLER_IP

"IP:port" where the EventHandler bot is running

SLACK_LEGACY_TOKEN

Legacy token of the slack workspace

EVENTHANDLER_USER_TOKEN

Bot User OAuth Access Token of EventHandler bot
Configuration
Config fileLocationDescription
notification.jsaction.jsproblem.jsNeo4jServices/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>>.jsonNeo4jServices/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>>.jsonNeo4jServices/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.

Slack configuration for interactive messages
  1. Logging into api.slack.com navigating to the My Apps section at slack.com/apps
  2. Click the Interactive Components link in the menu
  3. 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. 
"Request URL" is the Recommendation Engine service endpoint. Ensure Reco Engine service(RecommendationEngine) is publicly accessible for the slack to connect by the way of making load balancer URL or proper port opening in the firewall.

Run Neo4jServices:

  1. Change the working directory to reco-engine folder  
  2. Run: npm install
  3. Finally, start the node services as :
    1. node RecommendationEngine.js
    2. node Neo4jDBHandler.js