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
Consul KV Dashboard
Search
FUJIWARA Shunichiro
January 30, 2015
Programming
1
4.8k
Consul KV Dashboard
monitoring casual #7
FUJIWARA Shunichiro
January 30, 2015
Tweet
Share
More Decks by FUJIWARA Shunichiro
See All by FUJIWARA Shunichiro
ISUCONに強くなるかもしれない日々の過ごしかた/Findy ISUCON 2024-11-14
fujiwara3
8
890
「最高のチューニング」をしないために / hack@delta 24.10
fujiwara3
21
3.9k
AWS Lambdaで実現するスケーラブルで低コストなWebサービス構築/YAPC::Hakodate2024
fujiwara3
10
4.3k
CEL(Common Expression Language)で書いた条件にマッチしたIAM Policyを見つける / iam-policy-finder
fujiwara3
2
1.4k
awslim - Goで実装された高速なAWS CLIの代替品を作った/layerx.go#1
fujiwara3
6
730
AWS CLIの起動が重くてつらいので aws-sdk-client-go を書いた / kamakura.go#6
fujiwara3
7
10k
コードを書く隙間を見つけて生きていく技術/Findy 思考の現在地
fujiwara3
31
7.1k
fujiwara-ware OSSをひたすら紹介する/ya8-2024
fujiwara3
8
770
Amazon ECSで好きなだけ検証環境を起動できるOSSの設計・実装・運用 / YAPC::Hiroshima 2024
fujiwara3
25
8.6k
Other Decks in Programming
See All in Programming
Arm移行タイムアタック
qnighy
0
350
シェーダーで魅せるMapLibreの動的ラスタータイル
satoshi7190
1
480
TypeScriptでライブラリとの依存を限定的にする方法
tutinoko
3
720
距離関数を極める! / SESSIONS 2024
gam0022
0
300
AI時代におけるSRE、 あるいはエンジニアの生存戦略
pyama86
6
1.2k
Micro Frontends Unmasked Opportunities, Challenges, Alternatives
manfredsteyer
PRO
0
120
RubyLSPのマルチバイト文字対応
notfounds
0
120
Figma Dev Modeで変わる!Flutterの開発体験
watanave
0
150
聞き手から登壇者へ: RubyKaigi2024 LTでの初挑戦が 教えてくれた、可能性の星
mikik0
1
140
React CompilerとFine Grained Reactivityと宣言的UIのこれから / The next chapter of declarative UI
ssssota
5
430
Why Jakarta EE Matters to Spring - and Vice Versa
ivargrimstad
0
1.3k
Compose 1.7のTextFieldはPOBox Plusで日本語変換できない
tomoya0x00
0
200
Featured
See All Featured
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.3k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
840
Fireside Chat
paigeccino
34
3k
How GitHub (no longer) Works
holman
310
140k
Rails Girls Zürich Keynote
gr2m
94
13k
Embracing the Ebb and Flow
colly
84
4.5k
Making the Leap to Tech Lead
cromwellryan
133
8.9k
A designer walks into a library…
pauljervisheath
204
24k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
44
2.2k
Transcript
Consul KV Dashboard Monitoring Casual #7 @fujiwara
Chef, Serverspec, Deploy, etc... ֤ϗετͰ࣮ߦͨ݁͠ՌΛ֬ೝ͍ͨ͠ͷ͍Ζ͍Ζ • chef (--why-run) • serverspec
• rsync -av ͷ log
IRCʹ௨͠Α͏ parallel, cap, ... ͷग़ྗ݁ՌΛ… ࣾ༻ nopaste-cli command $ cat
foo.log | nopaste-cli -channel "hoge" -summary "foo done!" nopasteʹPOSTͱಉ࣌ʹIRCʹURL͕௨͞ΕΔ શ·ͱΊΔͱࣦࠞͬͯ͡ഊͨ͠ͷ͕͔ΓͮΒ͍ ཧϗετ͔ΒpushͰͳ͍ܗଶ(consul event)ͰऔಘͰ͖ͳ͍
֤ϗετ͔ΒͦΕͧΕIRC௨ ϗετ͕ൺֱతগ(ʙ10ఔ)ͳΒͳ͍ ࠓ࣌1ϗετͷੑೳ͕ߴ͍ͷͰɺͦ͜·Ͱ૿͑ͳ͍ ௨͕͏Δ͚͞Εɺࣦഊͨ͠ͷ͚ͩૹΕok
αʔϏεͷن֦େ ʙ50ͱ͔ ࣦഊ࣌ͷΈૹΔͱͯ͠IRCʹઇ่͕ى͖Δ Ͳ͔͜ͰҰཡͯ͠ݟ͍ͨʂ (ઌि·Ͱίί)
Consul KV Dashboard ͭͬͨ͘ github.com/fujiwara/consul-kv-dashboard
Consul KV Dashboard Consul KVS ΛσʔλετΞʹͨ͠ϦΞϧλΠϜμογϡϘʔυ Πϕϯτ༰Λ Consul REST API
Ͱอଘ ͦΕΛ͍͍ײ͡ʹݟͤͯ͘ΕΔ wep application Go (API Server) + React.js (View) [Demo]
σʔλొ Consul REST APIͰૹΔ $ curl -X PUT -d "message"
\ localhost:8500/v1/kv/dashboard/example/myhostname?flags=1422607461000
keyߏ /v1/kv/dashboard/{category}/{nodename}? flags={timestamp * 1000 + status} • category: chef,
serverspec, deploy... • nodename: ConsulͰࣝผ͍ͯ͠Δϊʔυ໊ • flags: ࣌ࠁͷunix time * 1000 + status • status: 0=success 1=warning 2=danger 3=info
ϦΞϧλΠϜߋ৽ͷ࣮ݱํ๏ ConsulͷϒϩοΩϯάΫΤϦΛ͏ www.consul.io/docs/agent/http.html $ curl -i localhost:8500/v1/kv/dashboard/chef/myhost?recurese HTTP/1.1 200 OK
Content-Type: application/json X-Consul-Index: 261975 [{"CreateIndex":261891,"ModifyIndex":261975,"LockIndex":0, "Key":"dashboard/chef/myhost","Flags":1422602855000,"Value":".....
ϒϩοΩϯάΫΤϦ Ϩεϙϯεϔομͷ X-Consul-Index Λ index ʹࢦఆ͢Δ $ curl -i localhost:8500/v1/kv/dashboard/chef/myhost?index=261975
indexΑΓ৽͍͠σʔλ͕ൃੜ͢Δ·ͰϨεϙϯε͕Ԇ ৽͍͠σʔλ͕ൃੜ͢ΔͱϨεϙϯε͕ฦΔ ͍ΘΏΔ Long pooling
consul-kv-dashboard ͕Δ͜ͱ HTML, CSS, JavaScriptΛ • go-bindataͰ·ͱΊͨϑΝΠϧΛhttp.FileServerͰ৴͢Δ qiita.com/sfujiwara/items/b84cc2a7b326b04e0edb • όΠφϦҰݸͰ੩తϑΝΠϧ৴Ͱ͖Δ
consul-kv-dashboard ͕Δ͜ͱ Consul REST API ͷ proxy • /api/... →
localhost:8500/v1/kv/dashboard/... • ϨεϙϯεͷJSONΛΫϥΠΞϯτ͕ѻ͍͍͢Α͏ʹܗ • {"Flags":1422608524001} → {"timestamp":"2015-01-30 18:02:04 +0900","status":"warning"} View React.js
ࠓޙ શମͷstatus͕มԽͨ͠ΒτϦΨʔ(֎෦ίϚϯυ࣮ߦͱ͔