Skip to content

SysAdminAce83/chatops_slack

 
 

Repository files navigation

Python slack ChatOps

Build Status Docker PRs Welcome

LinkedIn Github Slack

System Design

  • Limitation: Only Python3 is supported. (Use docker to deploy by default).

Major Default Slack Bots

DevOps ChatOps via Slack Commands. All commands starts with /chat*
- /chatclusterusage: Overall resource usage, and summary by role.
- /chatcloudexpense: Show cloud bills across different cloud providers.
- /chatqueryhost [substring of hostname]: Query host without manual ssh.
- /chathelp: Current online help usage
  • TODO: guide people to add their own, if they want

How To Use

1. Setup ChatOps Server via docker-compose

1.1. Prepare ssh_id_rsa and config.py

1.2. docker-compose up -d

2. Setup in client nodes

wget -O /usr/sbin/node_usage.py \
     https://raw.githubusercontent.com/DennyZhang/devops_public/tag_v6/python/node_usage/node_usage.py

3. Create slack commands in Slack setting page

Configure Slack Commands for each python flask endpoint.

4. Try the bots in Slack

Useful commands

Check: docker-entrypoint.sh

tail -f /tmp/uwsgi-wsgi.log

docker-compose down && docker-compose up -d \
  && docker exec -it devops_chatops tail -f /tmp/uwsgi-wsgi.log

Limitation

  1. Query nodes from slack, we use ssh private key. Here we assume one private key can login to all related nodes

More Resources

Packages

No packages published

Languages

  • Python 93.5%
  • Dockerfile 4.7%
  • Shell 1.8%