Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Errbotで得られる、ChatOps入門
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
attakei
September 06, 2017
Programming
1.4k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Errbotで得られる、ChatOps入門
PyconJP Reject Conference 2017 (
https://techplay.jp/event/630686
) で発表したスライドです
attakei
September 06, 2017
More Decks by attakei
See All by attakei
Sphinxを通して考える、「拡張」の仕方 / First approach for development sphinx extension
attakei
2
5k
PyPIデビュー手前の人のための地下活動手法 -PyPICloudを使ったプライベートレジストリの構築- / Using PyPICloud as private registry for pre-debut to PyPI
attakei
1
660
「〇〇のプラグインを作る」ことのすゝめ / Let's develop plugins
attakei
0
1.3k
プレゼン?それもSphinxで出来るよ -ドキュメントツールSphinxのちょっと変わった利用法- / You can presentation too by Sphinx!
attakei
1
1.6k
Cloud RunとFastAPIで、ChatBotをミニマムスタートしよう / Getting start ChatBot with FastAPI and Cloud RUN
attakei
0
3.3k
Web制作において、プレビューにあえてCloudRun(とFirebase)を使う / Using Cloud Run (and Firebase) as preview environment of HTML in web development
attakei
0
1.5k
Ansibleを通じて「べき等性」を 理解してみよう / Try understanding idempotency by Ansible
attakei
1
1.5k
素材の良さを活かしつつ、reST をReveal.jsに変換してみる話 / Converting pure reST to Revealjs
attakei
0
560
Eelで作ってみる WHOISアプリと スライド
attakei
0
1.1k
Other Decks in Programming
See All in Programming
JAWS-UG横浜 #102 AWSサ終供養LT会 成仏できない AWS サービスたち 〜本日、三体供養します〜
maroon1st
0
360
わからない話を追いかけたら、プログラミング言語を作る側にいた
ydah
3
510
Detecting Compromised CI with eBPF and Cilium Tetragon
lizrice
0
180
AWS CDK を「作」ってみた 〜フルスクラッチで見えた CDK の裏側〜 / aws-cdk-from-scratch
gotok365
3
2.8k
Cloudflare is Agents
chimame
0
170
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
590
20260722_microCMSで考える、AI時代のコンテンツ運用設計
yosh1
0
400
生成AIで帳票OCRが「簡単に」作れる時代になった?
kon_shou
0
920
jsmini JavaScript Engine を作ってみた話
yosuke_furukawa
PRO
0
320
自動化したのに回らない テスト運用の壁―AI時代の品質責任と生産性
mfunaki
0
180
AI Readyの正体はデータマネジメントだ メダリオン2.0の最前線
freee
PRO
0
230
Claude CodeとAgentCore Gatewayを繋ぐ際の認証認可 / Authentication and authorization when connecting Claude Code with AgentCore Gateway
har1101
2
270
Featured
See All Featured
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
470
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.6k
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
170
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
480
So, you think you're a good person
axbom
PRO
2
2.1k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.2k
Are puppies a ranking factor?
jonoalderson
1
3.8k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.5k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
201
75k
Test your architecture with Archunit
thirion
1
2.3k
Balancing Empowerment & Direction
lara
6
1.2k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
280
Transcript
Errbotによって得られる、 ChatOpsライフ入門 PyconJP Reject Conference 2017 株式会社ニジボックス 武居和也
Agenda l自己紹介 l【PR】ニジボックスについて lChatBotとChatOps lErrbotについて lErrbotの始め方 lcommandを作る l便利な機能を知る
> 自己紹介 lKazuya Takei l株式会社ニジボックス lインフラ関係 l事業外全般 lエンジニアに啓蒙する系 l@attakei lTwitter/GitLab/GitHub/Qiita
l技術的に面白そうなら、雑に手を出すタイプ
> 【PR】ニジボックスについて lNIJIBOX Co., Ltd. lhttps://nijibox.jp lリクルートグループ発の新規事業開発会社 lやってること l新規事業開発の支援 lO2Oキャンペーン受託
l自社サービス/パッケージ l レシポ l Biztom
> 雑) ChatBot と ChatOps ChatBot = Chat + Bot
Øチャット(Chat)サービスのインターフェースを介して 自動で動作するプログラム(Bot) ⦁ 自然対話が主目的 ⦁ ChatOpsが主目的 ChatOps = Chat + Ops Øチャット(Chat)サービスをベースに システム運用(Ops)をしていくこと
Errbotについて
> Errbotについて lPython製のChatBotフレームワーク lhttp://errbot.io/ lhttps://github.com/errbotio/errbot lhubot, rubotyなどが類似ライブラリ lバージョン: 5.1.2 (2017/09/06現在)
l現行バージョンはPython3.3以降のみ対応 lプラグイン方式
> Errbotについて (2) Backend plugin Storage plugins User plugins
> Backend plugins <Built in> •Slack •HipChat •Telegram •XMPP •IRC
•Text •Local GUI <Community> •Gitter •Skype •Discord •Mattermost •Cisco Spark
> Storage plugins <Built in or Official> •Shelf •SQL •Google
Cloud Datastore <Community> •Redis •RethinkDB
Errbotの始め方
Errbotの始め方 (1) 最速で始める $ mkdir mybot $ pip install errbot
$ errbot --init $ sed -i -e 's/CHANGE ME/@you/g' config.py $ errbot -T
Errbotの始め方 (2) 構造 + config.py | + data/ | +
plugins/ + err-example/ + example.plug + example.py <-- 設定ファイル <-- 永続データやらなんやら <-- プラグインの置き場その1
Errbotの始め方 (3) l.plugファイルには、プラグインの情報を記述 lErrbot上の名前と使用するモジュール lhelpコマンド時の説明 [Core] Name = Example Module
= example [Documentation] Description = This is a simple plugin
Errbotの始め方 (ex) lGitリポジトリに.plugと対応する.pyファイルが有る なら、reposコマンドでcloneからのプラグインインス トールが可能
commandを 作ってみる
> Errbotのcommand Errbotのコマンドは、デコレータで定義 l@botcmd l@arg_botcmd l@re_botcmd これらを知ってれば、プラグインを作れる
> @botcmd botcmdがBotPluginのメソッドを勝手にcommandと みなす 最終的に何か返せばOKなので、 出来ることの制限は(ほぼ)無い class Example(BotPlugin): @botcmd def
hello(self, msg, args): return 'Hello {}!'.format(msg.frm) >>> !hello Hello you!
> @botcmd メソッド名に _ (アンダースコア)があると、 勝手に半角スペース扱い lcloudfront_create -> cloudfront create
lcloudfront_invalidate -> cloudfront invalidate https://github.com/attakei/errbot-cloudfront/ サブコマンドっぽい!
> @arg_botcmd argparseライクな記述で、commandに引数を指定 することが可能 class Route53(BotPlugin): @arg_botcmd('zone', type=str) def route53_create(self,
msg, zone): # Expression return 'Now creating'
> template Jinja2が利用可能 import boto3 class Route53(BotPlugin): @botcmd(template='route53_list') def route53_list(self,
msg, zone): client = boto3.client('route53') result = client.list_hosted_zones() return {'zones': result['HostedZones']} **List of zones** {% for zone in zones %} - {{ zone.Id }}: {{ zone.Name }} {% endfor %}
> schedule 「定期的に◦ ◦ をさせる」「10分後に◦◦させる」 をやりたいときに from errbot import BotPlugin,
botcmd, arg_botcmd import demo class Example(BotPlugin): @arg_botcmd('min', type=int) def noodle_timer(self, msg, min): self.start_poller(min * 60, self.finished, (msg.frm, min,)) return 'Start {} mins'.format(min) def finished(self, frm, min): self.send(frm, 'Finished') self.stop_poller(self.finished, (frm, min,))
> extra lWebhook lFlow ※今回はスキップ
> Repositories lhttps://github.com/errbotio/errbot lhttps://github.com/attakei/errbot-route53 lhttps://github.com/attakei/errbot-cloudfront lhttps://github.com/attakei/ lhttps://gist.github.com/attakei/6d43b8733d891b9 8a9b6a3bcf9b902a3
ご清聴、ありがとうございました 日本でErrbotユーザーが増えることを願いつつ