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.9k
Consul KV Dashboard
monitoring casual #7
FUJIWARA Shunichiro
January 30, 2015
Tweet
Share
More Decks by FUJIWARA Shunichiro
See All by FUJIWARA Shunichiro
alecthomas/kong はいいぞ
fujiwara3
6
1.6k
ecspressoの設計思想に至る道 / sekkeinight2025
fujiwara3
12
2.7k
さくらのIaaS基盤のモニタリングとOpenTelemetry/OSC Hokkaido 2025
fujiwara3
3
1.1k
監視のこれまでとこれから/sakura monitoring seminar 2025
fujiwara3
11
5.1k
k6による負荷試験 入門から日常的な実践まで/Re:TechTalk #01
fujiwara3
2
120
困難を「一般解」で解く
fujiwara3
10
3.8k
「隙間家具OSS」に至る道/Fujiwara Tech Conference 2025
fujiwara3
7
13k
alecthomas/kong はいいぞ / kamakura.go#7
fujiwara3
1
1.1k
ISUCONに強くなるかもしれない日々の過ごしかた/Findy ISUCON 2024-11-14
fujiwara3
11
1.4k
Other Decks in Programming
See All in Programming
コンテキストエンジニアリング Cursor編
kinopeee
1
640
令和最新版手のひらコンピュータ
koba789
14
7.9k
技術的負債で信頼性が限界だったWordPress運用をShifterで完全復活させた話
rvirus0817
1
1.9k
Honoアップデート 2025年夏
yusukebe
1
820
WebAssemblyインタプリタを書く ~Component Modelを添えて~
ruccho
1
880
なぜ今、Terraformの本を書いたのか? - 著者陣に聞く!『Terraformではじめる実践IaC』登壇資料
fufuhu
4
630
AHC051解法紹介
eijirou
0
610
JetBrainsのAI機能の紹介 #jjug
yusuke
0
210
A Gopher's Guide to Vibe Coding
danicat
0
170
CEDEC2025 長期運営ゲームをあと10年続けるための0から始める自動テスト ~4000項目を50%自動化し、月1→毎日実行にした3年間~
akatsukigames_tech
0
140
Portapad紹介プレゼンテーション
gotoumakakeru
1
130
20250808_AIAgent勉強会_ClaudeCodeデータ分析の実運用〜競馬を題材に回収率100%の先を目指すメソッドとは〜
kkakeru
0
190
Featured
See All Featured
Balancing Empowerment & Direction
lara
2
580
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3.4k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
50
5.5k
KATA
mclloyd
32
14k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
50k
A designer walks into a library…
pauljervisheath
207
24k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Documentation Writing (for coders)
carmenintech
73
5k
Making the Leap to Tech Lead
cromwellryan
134
9.5k
The Pragmatic Product Professional
lauravandoore
36
6.8k
Building a Modern Day E-commerce SEO Strategy
aleyda
43
7.5k
Designing Experiences People Love
moore
142
24k
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͕มԽͨ͠ΒτϦΨʔ(֎෦ίϚϯυ࣮ߦͱ͔