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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
Even G2とAWSで推しのエージェントを召喚しよう!
har1101
1
170
AI時代、エンジニアはどう育つのか -未経験エンジニアの成長を間近で見て考えたこと-
thasu0123
0
130
AI時代の仕事技芸論〜ソフトウェア開発で「遊ぶように働く」職人的熟達のすすめ(スクフェス仙台 2026バージョン)
kuranuki
0
660
えっ!!コードを読まずに開発を!?
hananouchi
0
220
フィードバックで育てるAI開発
kotaminato
1
120
鹿野さんに聞く!『TypeScriptコードレシピ集』で磨く実践力
tonkotsuboy_com
4
1.1k
エンジニア向け会社紹介/Findy Company Profile
findyinc
6
360k
吝嗇家のためのAI活用 / AI development for miser - ChatGPT + Issue Driven Development
tooppoo
0
190
AI がコードを書く時代における新卒エンジニアの仕事風景 (2026) / New Graduate Engineers in the Era of AI Coding (2026)
sushichan044
0
220
信頼性について考えてみる(SRE NEXT 2026 miniLT)
hayama17
0
200
Foundation Models frameworkで画像分析
ryodeveloper
1
120
Generative UI & AI-Assistants for Your Angular Solutions
manfredsteyer
PRO
1
190
Featured
See All Featured
Game over? The fight for quality and originality in the time of robots
wayneb77
1
220
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.6k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
72
40k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.3k
Everyday Curiosity
cassininazir
0
260
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
260
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
260
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
2k
First, design no harm
axbom
PRO
2
1.2k
Designing for humans not robots
tammielis
254
26k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
10k
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ユーザーが増えることを願いつつ