Skip to content

HPSoftware/hubot-omi

Repository files navigation

ChatOps Bot for HPE Operations Manager i (OMi)

This repo exists for historical purposes. A more up-to-date ChatBot can be found on the ITOM Marketplace. ITOM Marketplace

This is a project to enable OMi users to connect OMi to Slack. It contains the source code of a npm package for a Hubot integration. Currently, the integration covers two use cases:

  1. Automatically posting selected OMi events into Slack channels. Users can work on events via chat commands. E.g. escalating events to a trouble ticket system.
  2. Starting custom OMi tools from the chat to investigate or correct failure situations.

Note, that is an open source project. Feel free to fork, contribute or submit issues.

The code is distributed on an "AS IS" basis, without warranties or conditions of any kind, either express or implied.

Installation and configuration

Install a node, npm and generate a hubot

Download and install node and npm version 6.x on the Linux system that should run the OMi bot. Install the hubot generator:

npm install -g yo generator-hubot

Generate a hubot in a directory of your choice. HPE recommends using a non-root directory:

mkdir hubot; cd hubot/

yo hubot --owner="you@all.org" --name="omi" --description="OMi bot" --defaults

Do not use --adapter. Add the required slack adaptper manually in a next steps.

Add hubot-slack the the dependencies in package.json:

    ...  ,
    "hubot-slack": "git+https://github.com/keke/hubot-slack.git"
  }, ...

Install dependencies:

npm install

Install and configure the OMi bot

Download the github.com/HPSoftware/hubot-omi repo on your system, for example into /home/hubot/

Within the hubot directory, add the OMi hubot NPM package:

npm install /home/hubot/hubot-omi --save

Then add hubot-omi to your external-scripts.json:

[
  "hubot-omi"
]

Configure the OMi bot. Copy the configuration file into your hubot directory

cp ./node_modules/hubot-omi/omi-conf.json .

Edit omi-conf.json in the hubot directory. Ensure that you use an OMi user with non-administrative privileges.

{
   "OMiLogin": "chatops_integration_user" ,
   "OMiPassword": "chatops_integration_passwd",
   "OMiHost":  "my.omi.server.fqdn",
   "OMiPort":   80,
   "OMiContextRoot":  "",
   "OMiProtocol": "http",
   "RunCmdsChannels": ["^hr-infra-ops$", "^Incident[0-9]{3,5}$"],
   "ServiceManagerName": "Service_Manager_Connected_Server_Name_in_OMi",
   "rejectUnauthorized": true
}

Event forwarding only mode: Leave OMiLogin empty ("OMiLogin": ""), in case you do not want to the bot to perform any operations in OMi.

Reject Unauthorized: Reject SSL connections to OMi if the certificate cannot get authorized.

For proper https configuration, export the OMi Webserver CA Certificate and copy it to the hubot directory:

/opt/HP/BSM/bin/opr-cert-mgmt.sh -export "OMi Webserver CA Certificate" PEM ca-cert.pem

The RunCmdsChannels is optional and you can use it to limit the channels for the run command execution.

Configure OMi

Setup event forwarding to your hubot. Create a new External Event Processing connected server in OMi:

• Target Server: The hubot system FQDN or localhost if your hubot runs on your OMi system.

• CI Type: Management system

• Integration type: Call external event web service.

• URL Path: /omibot/general ('general' is the target channel name)

• User Name: admin

• Port: 8080 – the hubot port is set in an environment variable before starting the bot

Additionally, create an event forwarding rule of your choice.

Start the OMi bot

If you haven’t already, add a new Hubot integration to your slack team and name it omi, then save the TOKEN.

In the hubot directory on the hubot system, run the following commands:

export HUBOT_SLACK_TOKEN=xoxb-…
export EXPRESS_PORT=8088
HUBOT_LOG_LEVEL=debug SLACK_LOG_LEVEL=debug  bin/hubot --name omi --adapter slack

Set up tools in OMi

Create a new tool category for ChatOps so that it is simple to give the ChatOps integration user access only to these tools.

The tool parameter must be named ${1} ${2} etc. E.g. ping -c 3 ${1}

Here is an example for using a ping tool:

Stefan: @omi: omi run putput.deu.hp.com ping devbox.deu.hp.com

omi: Result:

PING devbox.deu.hp.com (16.57.35.247) 56(84) bytes of data.
64 bytes from devbox.deu.hp.com (16.57.35.247): icmp_seq=1 ttl=64 time=1.98 ms
64 bytes from devbox.deu.hp.com (16.57.35.247): icmp_seq=2 ttl=64 time=0.678 ms
64 bytes from devbox.deu.hp.com (16.57.35.247): icmp_seq=3 ttl=64 time=0.961 ms
64 bytes from devbox.deu.hp.com (16.57.35.247): icmp_seq=4 ttl=64 time=1.72 ms

Usage

@omi: omi help

Escalate an event to the pre-configured incident manager

Syntax: omi escalate event [short|long event id]

Examples:

@omi: omi escalate event
@omi: omi escalate event e1dc
@omi: omi escalate event iaa1bde62-e1a4-4676-89b0-0a236fdcb6f8

Run an OMi tool

Syntax: omi run [node] [tool] [parameters]

Examples:

@omi: omi run db-srv-hr1 df 
@omi: omi run batch-srv-hr1 ping db-srv-hr1

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published