derAndi / cfbot

Cloud Foundry Application Monitoring Bot For Slack

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cfbot

Cloud Foundry application monitoring bot for Slack.

cfbot

cfbot monitors application events through the CF events API and forwards details to channels it's registered in. Users can configure the applications and events being monitored.

install

This Cloud Foundry monitoring bot can be deployed to... Cloud Foundry!

You will need to register the bot with your Slack group to receive an authentication token. This token, along with login details for a platform account, need to be created as user-provided service credentials. The bot will read these service credentials on deployment and start monitoring for events.

register slack bot

Add a new bot integration here with the following details:

  • username: cf

Make a note of the API token.

tip: grab the cloud foundry logo for your bot picture from here

create user provided service credentials

Create user-provided service credentials on the Cloud Foundry instance where you will be deploying cfbot using the command below.

You need to provide the API token from Slack, the Cloud Foundry endpoint running the applications you want to monitor and user account credentials for that platform.

cf cups cfbot -p '{"slack_token":"xoxb-some-token","cf_api":"https://api.ng.bluemix.net", "cf_username":"xxx", "cf_password":"xxx"}'

tip: create a new user account for cfbot and add it to your cf organisation to expose applications for monitoring, rather than having to use normal user accounts.

deploy

Bluemix button

or...

$ cf push

usage

cfbot will monitor events from applications in all spaces and organisations that the user account has access to.

Users can filter the applications and events being reported using the apps and events commands. Both commands take application or event identifiers that are used to match incoming events. The wildcard '*' identifier can be used to revert to matching all events.

@cf apps // show the currently application filter
@cf apps app_name // add the 'app_name' to the filter list
@cf apps * // reset to the filter to wildcard matching

@cf events // show the currently event filter
@cf events event_type // add the 'event_type' to the filter list
@cf events * // reset to the filter to wildcard matching

@cf status // show the current bot status message

@cf polling_frequency // show the cf events api polling time in seconds
@cf polling_frequency 10 // set the cf events api polling time in seconds

The following events are currently registered:

  • App Creation and Deletion Events.
  • App Lifecycle Events (start, stop, restart, restage)
  • Instance Crash Events.
  • Service Creation, Deleting and Binding.
  • Scaling (memory, CPU, disk)
  • Routes Changes (map, unmap)

config

Environment variables (APPS and EVENTS) can be used to configure default event property filtering for application names and event types (use spaces to separate multiple terms). POLLING_FREQ can be defined to configure the default CF events api polling frequency.

env: 
  APPS: my_app your_app another_app
  EVENTS: app.create app.update
  POLLING_FREQ: 30

bugs / feedback / comments

Open issues or find me on twitter. Pull requests welcome!

About

Cloud Foundry Application Monitoring Bot For Slack

License:MIT License


Languages

Language:JavaScript 100.0%