Slide 1

Slide 1 text

maprobe Mackerel ͷϗετ৘ใͱ࿈ܞ͢Δ ֎ܗ؂ࢹΤʔδΣϯτ 2018.04.24 Mackerel Drinkup #7 @fujiwara

Slide 2

Slide 2 text

@fujiwara ٕज़෦ github.com/fujiwara sfujiwara.hatenablog.com

Slide 3

Slide 3 text

Mackerel ͷ؂ࢹͷྲྀΕ

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

ϗετͷμ΢ϯݕ஌Λ͍͍͔Μ͡ʹ͍ͨ͠ • 7෼ఔ౓ agent ͔Β్ઈ͠ͳ͍ͱμ΢ϯͱ൑ఆ͞Εͳ͍ • "connectivity" Ξϥʔτ͸ Critical Ϩϕϧ͔͠ͳ͍ • ଟॏԽͯ͋͠ΔϗετͰ͸େ͛͞

Slide 6

Slide 6 text

಺෦Ϧιʔεʹ֎ܗ؂ࢹΛ͍ͨ͠

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

maprobe ͭ͘Γ·ͨ͠ github.com/fujiwara/maprobe

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

maprobe works... 1. Mackerel API Λୟ͍ͯϗετ৘ใΛऔಘ • Service, Role ͰϑΟϧλϦϯά 2. ֤ϗετʹରͯ͠ probe(ping,tcp,http,command)Λ࣮ߦ 3. ಘΒΕͨ݁ՌΛϗετϝτϦοΫͱͯ͠ Mackerel ʹૹ৴ 4. 60ඵ͝ͱʹ܁Γฦ͠

Slide 11

Slide 11 text

ping probe production αʔϏε ͷ server ϩʔϧʹ ping Λૹ৴ probes: - service: production role: server ping: address: '{{ .Host.IPAddresses.eth0 }}'

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

HTTP Probe production αʔϏε ͷ InternalELB ϩʔϧʹ HTTP probes: - service: production role: InternalELB http: url: 'http://{{ .Host.CustomIdentifier }}/api/healthcheck' post: POST headers: Content-Type: application/json body: '{"hello":"world"}' expect_pattern: 'ok'

Slide 14

Slide 14 text

TCP Probe production αʔϏε ͷ redis ϩʔϧʹ TCP probes: - service: production role: redis tcp: host: '{{ .Host.IPAddress.eth0 }}' port: 6379 send: "PING\n" expect_pattern: "PONG" quit: "QUIT\n"

Slide 15

Slide 15 text

Command Probe mackerel-plugin ޓ׵ίϚϯυ΋࣮ߦՄೳ probes: - service: production role: redis command: command: "mackerel-plugin-redis -host {{ .Host.IPAddress.eth0 }} -tempfile /tmp/redis-{{ .Host.ID }}"

Slide 16

Slide 16 text

ίϚϯυ࣮ߦͷԠ༻ྫ probes: - service: production role: EC2 command: command: 'cleanup.sh {{.Host.ID}} {{index .Host.Meta.Cloud.MetaData "instance-id"}}' Mackerel ϗετ ID ͱ EC2 Πϯελϯε ID Λݩʹࣗಈୀ໾͢ Δ

Slide 17

Slide 17 text

Blog ॻ͖·ͨ͠ https://sfujiwara.hatenablog.com/entry/2018/04/23/113316 Enjoy!