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.7k
Consul KV Dashboard
monitoring casual #7
FUJIWARA Shunichiro
January 30, 2015
Tweet
Share
More Decks by FUJIWARA Shunichiro
See All by FUJIWARA Shunichiro
コードを書く隙間を見つけて生きていく技術/Findy 思考の現在地
fujiwara3
27
5.7k
fujiwara-ware OSSをひたすら紹介する/ya8-2024
fujiwara3
7
460
Amazon ECSで好きなだけ検証環境を起動できるOSSの設計・実装・運用 / YAPC::Hiroshima 2024
fujiwara3
22
6.8k
リアル事例から読み解くWebパフォーマンスチューニングの勘所/Offers web performance tuning
fujiwara3
4
1.5k
隙間家具OSS開発で『自分の庭』をつくる / kayac-andpad-event
fujiwara3
0
680
ISUCON作問入門/ ISUCON Summer Fes 2023
fujiwara3
2
1.6k
隙間家具職人が考えること/ecspresso meetup
fujiwara3
4
4.2k
MackerelとGrafana OnCallを連携してみた
fujiwara3
0
1.6k
Amazon ECS デプロイツール ecspresso 開発5年の歩み
fujiwara3
15
4.1k
Other Decks in Programming
See All in Programming
Blue/Greenデプロイの導入による 運用フローの改善
kudoas
1
360
try!Swift Tokyo 2024 参加報告 LT
akidon0000
1
220
コーンフレークから始める モデリング会話入門
ogurotakayuki
0
340
From Spring Boot 2 to Spring Boot 3 with Java 22 and Jakarta EE
ivargrimstad
0
1.1k
1BRC--Nerd Sniping the Java Community
gunnarmorling
0
340
Netty Chicago Java User Group 2024-04-17
sullis
0
170
GitHub Actionsで泣かないためにやっておきたい設定 / Recommended GHA settings to avoid crying
pinkumohikan
3
520
Elm Form Validation
bkuhlmann
0
510
Ruby Pattern Matching
bkuhlmann
0
920
"config" ってなんだ? / What is "config"?
okashoi
0
240
使ってみよう Azure AI Document Intelligence
kosmosebi
2
270
Komplexe Oberflächen mit SVG und der Web Animation API
joergneumann
0
670
Featured
See All Featured
Designing with Data
zakiwarfel
95
4.8k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
18
1.7k
Design by the Numbers
sachag
274
18k
Practical Orchestrator
shlominoach
181
9.7k
The Art of Programming - Codeland 2020
erikaheidi
41
12k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
226
51k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
13
1.5k
Raft: Consensus for Rubyists
vanstee
132
6.3k
The Brand Is Dead. Long Live the Brand.
mthomps
48
28k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
13
1.5k
How to train your dragon (web standard)
notwaldorf
72
5.1k
Into the Great Unknown - MozCon
thekraken
10
990
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͕มԽͨ͠ΒτϦΨʔ(֎෦ίϚϯυ࣮ߦͱ͔