Upgrade to Pro — share decks privately, control downloads, hide ads and more …

/Mackerel 20190312

F09bb6dd6372cfada941e132f6662d7f?s=47 mackerelio
March 12, 2019
63

/Mackerel 20190312

F09bb6dd6372cfada941e132f6662d7f?s=128

mackerelio

March 12, 2019
Tweet

Transcript

  1. 1 2019/03/12 mackerel.io

  2. 2 ࣗݾ঺հ • Ճݹ ௚ݾʢJEOLBLPʣ • גࣜձࣾ͸ͯͳ ϓϩσϡʔαʔ • .BDLFSFMνʔϜͷࣄۀ੹೚ऀΛ୲౰͍ͯ͠·͢ʂ

    ܦྺ 4*FSͰωοτϫʔΫΤϯδχΞ ϕϯνϟʔͰӦۀ؅ཧ৬Λ୲౰ɺ*10Λܦݧ 0SBDMFͰΫϥ΢υʢ*BB4ʣΛ୲౰ ͸ͯͳ ϏδωεϚωʔδϟʔ ͸ͯͳ ϓϩσϡʔαʔ
  3. 3 ձࣾ঺հ ໊ࣾɿגࣜձࣾ͸ͯͳ ॴࡏ஍ɿ ຊࣾ ˟ژ౎෎ژ౎ࢢதژ۠ޚ஑௨ؒ೭ொ౦ೖߴٶொޚ஑Ϗϧ' ɿ ຊళ ˟౦ژ౎ߓ۠ೆ੨ࢁ੨ࢁαϯϥΠτϏϧ' ઃཱɿ೥݄

    ࢿຊۚɿ ઍԁ ച্ߴɿ ඦສԁʢ೥݄ݱࡏʣ ैۀһ਺ɿਓʢ೥݄ݱࡏʣ ೥ʹ౦ূϚβʔζࢢ৔ʹ্৔
  4. 4 ͸ͯͳͷϛογϣϯ ʮ஌Δʯʮͭͳ͕Δʯʮදݱ͢Δʯ Ͱ৽͍͠ମݧΛఏڙ͠ɺਓͷੜ׆Λ๛͔ʹ͢Δ

  5. 5 .BDLFSFMͱ͸ʁ

  6. 6 ࠷ߴͷυοάϑʔσΟϯά؀ڥ͔Βੜ·Ε·ͨ͠ ౰ॳ͸/BHJPTΛ࢖ͬͯαʔό؅ཧΛ࣮ࢪ ଟ͗͢Δ؂ࢹର৅΍؂ࢹ߲໨͕ɺ ૿͑ଓ͚ΔΠϯϑϥӡ༻ͷෛՙʹ ྲྀಈతͳΠϯϑϥʹରԠ͢ΔΛϞοτʔʹࣗࣾ੡؂ࢹπʔϧΛ࡞੒։࢝ ʢॳ୅.BDLFSFMͷ஀ੜʣ ෺ཧαʔό୆ʢԾ૝Խ͠໿୆ʣʴ "84ͷΫϥ΢υར༻΋࢝·Γ৽؀ڥʹ దͨ͠.BDLFSFM͕஀ੜ

    Ϋϥ΢υͷຊ֨ීٴΛड͚ɺΑΓ࢖͍উखͷྑ͍πʔϧͱͯ͠4BB4ܕ؂ࢹαʔϏεͱͯ͠ ੡඼൛.BDLFSFMϦϦʔεʹணख ೥Ҏલ ೥ʙ ೥ʙ ೥ʙ ೥౰࣌ͷ.BDLFSFM ొ࿥Ϣʔβʔ਺ ສਓ ݄ؒϢχʔΫϒϥ΢β਺ ԯਓΛތΔ͸ͯͳͷαʔϏ εʢ͸ͯͳϒοΫϚʔΫɺ͸ͯͳϒϩάͳͲʣ΋.BDLFSFMʹΑͬͯࢧ͑ΒΕ͍ͯ·͢ɻ
  7. 7 ΤϯδχΞΛऔΓר͘؀ڥ ɾ·͢·͢ಈతͰศརʹͳΔΠϯϑϥετϥΫνϟʔ ɾޮ཰తʹෳࡶੑͱ޲͖߹͏͜ͱ͕ٻΊΒΕΔ

  8. 8

  9. 9 DevOpsͷத֩ͱͯ͠ Mackerel͸୯ͳΔ؂ࢹαʔϏεͰ͸͋Γ·ͤΜ ༷ʑͳ࢓૊Έͱ؆୯ʹ૊Έ߹Θͤɺ։ൃ΍ӡ༻ϥΠϑαΠΫϧͷ த֩ͱͯ͠ޮ཰ԽΛଅਐ͠·͢ Dev Ops

  10. 10 DevOps  

  11. 11 ͸ͯͳͰͷ%FW0QT

  12. 12 DevOpsͷఆٛ • EFWPQTͱ͸෺ͷߟ͑ํͰ͋Γɺ࢓ࣄͷਐΊํͰ͋Δʢ˞ʣ • ͸ͯͳͰ͸πʔϧΛࢦͨ͠ΓɺΧϧνϟʔΛࢦͨ͠Γଟٛత ͳ༻ޠͱ͍͏ೝࣝΛ͍ͯ͠·͢ • %FW0QTͷจ຺ͰޠΒΕΔπʔϧ͸೥͝Ζ͔Βಋೖ ʢQVQQFUͳͲʣ

    ˞ॻ੶ʮ&GGFDUJWF%FW0QTʯΑΓҾ༻
  13. 13 ݩʑͷ૊৫ମ੍ͱ໾ׂ αʔϏεɾγεςϜ։ൃຊ෦ ୈ̍ʙୈ̑άϧʔϓ γεςϜ ϓϥοτϑΥʔϜ෦ %FW 0QT ΞϓϦέʔγϣϯΤϯδχΞ ˠΞϓϦέʔγϣϯɾαʔϏε։ൃ

    ΦϖϨʔγϣϯΤϯδχΞ ˠΠϯϑϥج൫ͷߏஙʴӡ༻
  14. 14 DevOps    • զʑ͕ײ͍ͯͨ͡՝୊ ΦϖϨʔγϣϯΤϯδχΞ͕ԣ۲ͰରԠ͢Δࣄ͕ۀ຿ͷϘτϧωοΫʹ Πϯϑϥӡ༻ۀ຿ͷ੹຿ͷ͔ͨΑΓ ։ൃνʔϜ͕ʮΠϯϑϥΦʔφʔγοϓʯΛ࣋ͭͱ͍͏ߟ͑ํʹม͑ͨ

  15. 15 ໾ׂͷมߋʢ৽ʣ αʔϏεɾγεςϜ։ൃຊ෦ ୈ̍ʙୈ̑άϧʔϓ γεςϜ ϓϥοτϑΥʔϜ෦ %FW 0QT ΞϓϦέʔγϣϯΤϯδχΞ ΦϖϨʔγϣϯΤϯδχΞ

    ΠϯϑϥΦʔφʔγοϓΛ΋ͭ ωοτϫʔΫڞ௨ج൫ʹઐ೦ɾ஫ྗ
  16. 16 ΦʔφʔγοϓΛ΋ͭ ΠϯϑϥΦʔφʔγοϓͱ͸ʁ ΞϓϦέʔγϣϯΤϯδχΞ͕ΠϯϑϥྖҬ·Ͱ੹೚Λ ࣋ͪɺো֐ରԠ͕Ͱ͖ͨΓɺඞཁͳ։ൃ؀ڥͷߏஙɺຊ ൪΁ͷ౤ೖΛࣗ෼ͨͪͷ൑அͰ͓͜ͳ͑ΔΑ͏ͳঢ়ଶɻ

  17. 17 ΦʔφʔγοϓΛਪਐ͢ΔͨΊʹ΍ͬͨ͜ͱ • $50͔Βͷϝοηʔδϯά • ٕज़ษڧձɺϋοΧιϯʢΠϯϑϥྖҬεΩϧͷ֫ಘʣ • ΢ΣϒΦϖϨʔγϣϯΤϯδχΞ͔Β43&৬छ΁มߋͯ͠ ։ൃνʔϜ΁ઐଐ഑ஔʢΦʔφʔγοϓͷਪਐʣ •

    Πϯϑϥͷ໰͍߹ΘͤνϟϯωϧΛ࡞ͬͨʢBTLJOGSBʣ
  18. 18 ͸ͯͳͷதͰͷMackerel • ʮΘ͔Βͳ͍ʯ͜ͱΛʮΘ͔ΔʯΑ͏ʹ͢Δπʔϧ • .BDLFSFMͷΞϥʔτΛݟͳ͕Βɺى͖ͨো֐ͱରࡦͷਐḿ ֬ೝͳͲΛΞϓϦέʔγϣϯΤϯδχΞͱ43&͕Ұॹʹ νΣοΫ • ʮ/8ʯ΍ʮαʔόʯͰ෼͚Δ͜ͱͳ͘ʮϩʔϧʯͱ͍͏֓

    ೦ͰϚοϐϯά • ڞ௨ݴޠΛ࣋ͭ • Ұॹʹվળ͢ΔจԽΛৢ੒ • ΞϓϦέʔγϣϯɾΠϯϑϥ྆ࢹ ఺͔ΒΑΓޮՌతͳվળࡦΛબ୒ ͢Δ ΞϓϦέʔγϣϯ ΤϯδχΞ 43&
  19. 19 ϩʔϧ͕࠷ߴͷརศੑΛ ༧ΊαʔϏεʗϩʔϧʗϗετΛࢦఆ͢Δ͜ͱͰɺࣗಈతʹάϥ ϑ΍؂ࢹઃఆͳͲ͕ઃఆ͞ΕΔͨΊɺಛʹେن໛؀ڥͰͷӡ༻ෛ ՙܰݮʹޮՌతͰ͢

  20. 20 ͸ͯͳͰ׆༻͍ͯ͠Δπʔϧ܈

  21. 21 جຊػೳ

  22. 22 ΞʔΩςΫνϟ Mackerel͔Β ֎෦αʔϏε ΁ͷ௚઀؂ࢹ ΤʔδΣϯτ͔Β ϝτϦοΫΛ౤ߘ HTTPS REST API

  23. 23 ؆୯ɻ͙͢ ͸͡ΊΒΕ·͢ • ΨΠυʹ͕ͨͬͯ͠ίϚϯυΛ࣮ߦ͢Δ͚ͩ • ਺෼͋Ε͹े෼Ͱ͢ • ΤʔδΣϯτ͕ࢮ׆؂ࢹΛࣗಈతʹ։࢝ •

    ΤʔδΣϯτ͕ϦιʔεͷϝτϦΫεΛࣗಈऔಘ mackerel-agent written in Go
  24. 24 ໢ཏతͳϝτϦΫεɾ؂ࢹϧʔϧ ɾ63-֎ܗ؂ࢹϗετࢮ׆؂ࢹϦιʔε؂ࢹϩά؂ࢹ ɾ"84"[VSFΦʔτεέʔϧରԠ ɾࣗ࡞ϓϥάΠϯͱͷ࿈ܞ • ѹ౗తଟ਺ͷ؂ࢹʹରԠ • ଞ؂ࢹπʔϧ͔ΒͷҠߦࣄྫ΋ଟ਺ʂ

  25. 25 ؂ࢹϧʔϧͷઃఆ͸ඞཁ • ϞχλϦϯάʹ͓͚Δ՝୊ • ؂ࢹϧʔϧͷϝϯςφϯε͸ ॏཁ͕ͩख͕͔͔ؒΔ • ੩తͳᮢ஋ͷ؂ࢹ͚ͩͰ͸ݕ ग़͕೉͍͠ঢ়گ΋͋Δ

    • ؂ࢹϧʔϧΛద੾ʹઃఆ͢Δ ͨΊʹɺ͋Δఔ౓ͷ஌ࣝʢϛ υϧ΢ΣΞͳͲʣ͕ඞཁ
  26. 26 ಛ௃తͳػೳ

  27. 27 AWSΠϯςάϨʔγϣϯ ɾAWS CloudWatch API͔Β༷ʑͳϝτϦοΫ΍ΠϕϯτΛ औಘ͠ՄࢹԽ ɾ1୆ͷϗετͱͯ͠؅ཧ ɾEC2, ELB, RDS,

    ElastiCache, RedshiftͳͲ ॱ֦࣍େத
  28. 28 ઈࢍϦϦʔεܧଓதʂ  6QEBUF  6QEBUF  6QEBUF  6QEBUF

     6QEBUF  6QEBUF • "NB[PO&$4 • "NB[PO4&4 ܧଓతʹϦϦʔε༧ఆʂ
  29. 29 0 0+'/$!#*)  %&( -+,./ "+  +'/ 

      2
  30. 30 #" /' ! $ -&)*+ (#" ,% .0 

     -
  31. 31 n 2 n 2 2 n 0/2 2 2

    n 0 2 )'!, ( %&+  #   "- (*&&$ 
  32. 32 / l X U I l e1 / l

    r c M k a / l
  33. 34 ίϯςφͷਖ਼ࣜαϙʔτ • .BDLFSFMͷ֓೦ͱͯ͠ίϯςφΛදݱ • ΑΓίϯςφΛ׆༻͠΍͍͢؀ڥΛఏڙ Service Role Host Host

    Container Container Container Role Role Container Container Host Host Host Containers Hosts
  34. 35 λεΫ1PEͷ؂ࢹ • .BDLFSFMͷίϯςφΤʔδΣϯτ͸ɺλεΫ &$4 ΍ 1PE ,VCFSOFUFT Λ؂ࢹ͠·͢ •

    ؂ࢹ͍ͨ͠λεΫ1PEʹαΠυΧʔͱͯ͠NBDLFSFMDPOUBJOFS BHFOUΛಉډ • ؂ࢹର৅͕ݸʑͷίϯςφͰ͸ͳ͍͜ͱ͕ϙΠϯτ • ΦʔέετϨʔγϣϯϓϥοτϑΥʔϜ͕࡞੒͢Δ؅ཧ༻ͷίϯςφ ͳͲɺ؂ࢹ͕ෆཁͳίϯςφ͸ର৅ʹؚ·Εͳ͍ • λεΫ1PEʹଐ͢ΔίϯςφΛαʔόϓϩηεͷΑ͏ʹ؂ࢹͰ͖Δ • ࡶԻΛආ͚ͨγϯϓϧͰݟ΍͍͢ઃܭ
  35. 36 αΠυΧʔͱ࣮ͯ͠ߦ • λεΫ1PEͷαΠυΧʔͱ࣮ͯ͠ߦ͠·͢ ϊʔυ ϊʔυ ίϯςφΦʔέετϨʔγϣϯϓϥοτϑΥʔϜ λεΫ1PE ίϯςφ" NBDLFSFM

    DPOUBJOFS BHFOU λεΫ1PE ίϯςφ% NBDLFSFM DPOUBJOFS BHFOU λεΫ1PE ίϯςφ# λεΫ1PE ίϯςφ$ Ϋϥελ αΠυΧʔͱ࣮ͯ͠ߦ ͞ΕͨλεΫ1PEͷ ίϯςφΛ؂ࢹ ؅ཧ༻ͷίϯςφͳͲ ෆཁͳίϯςφ͸؂ࢹ ͠ͳ͍
  36. 37 .BDLFSFMը໘ྫ • ैདྷͷ.BDLFSFMΛ౿ऻͨ͠γϯϓϧͰݟ΍͍͢6*

  37. 38 ͜Ε·Ͱಉ༷ϩʔϧάϥϑͰ΋ • λεΫ1PEʹϗετͱͯ͠αʔϏεɺϩʔϧΛઃఆՄೳ • ϩʔϧάϥϑͰλεΫ͝ͱͷϝτϦοΫͷ߹ܭ஋͕ݟΒΕΔ

  38. 39 αϙʔτ͢ΔϓϥοτϑΥʔϜ • "NB[PO&$$POUBJOFS4FSWJDF &$4 • 8JOEPXTίϯςφ͸ର৅֎ͱͳΓ·͢ • "84'BSHBUF 'BSHBUF

    • ,VCFSOFUFT
  39. 40 ΤʔδΣϯτఏڙํ๏ • %PDLFSΠϝʔδͰఏڙ͠·͢

  40. 41 ඪ४Ͱࣗಈୀ໾ • λεΫ1PEͷऴྃ࣌ʹࣗಈୀ໾͠·͢ • ࡉ΍͔ͳλεΫͷ࡞੒ɾऴྃ΋ϩʔϧάϥϑͰදݱՄೳ • ෼ະຬͰऴྃ͢ΔλεΫ1PEͷ৔߹͸ɺϝτϦοΫ౤ߘ͕͞Εͳ͍৔߹͕͋Γ·͢ɻ ίϯςφΤʔδΣϯτ͕ ऴྃࣗ͠ಈୀ໾͍ͯ͠Δ

  41. 42 .BDLFSFM։ൃϩʔυϚοϓ • "84ΠϯςάϨʔγϣϯ֦ॆ • ػցֶशΛ׆༻ͨ͠ػೳ։ൃ • ίϯςφԽରԠ • GCPΠϯςάϨʔγϣϯͷ։ൃ

    • SAMLೝূରԠ • ࣌ܥྻσʔλϕʔεͷ֦ு ͋͘·Ͱ༧ఆͰ͋ΓίϛοτϝϯτͰ͸͋Γ·ͤΜ
  42. 43 Ձ֨ɺτϥΠΞϧ

  43. 44 αʔϏεϓϥϯ ϘϦϡʔϜσΟεΧ΢ϯτ͋Γ

  44. 45 .BDLFSFMͷಋೖ·Ͱͷϑϩʔ τϥΠΞϧ ຊ൪ಋೖ ӡ༻։࢝ ͝ܖ໿ Ϋʔϙϯ ίʔυൃߦ ੥ٻॻ෷͍ɾϘϦϡʔϜσΟεΧ΢ϯτͷΈ ˞िؒ

    ಋೖ͔Βӡ༻·Ͱɺ$3& ͕Ұ؏ͯ͠ ೔ຊޠ Ͱαϙʔτ͠·͢ʂ
  45. 48 ͓٬༷

  46. 49 ࣄྫͨ͘͞Μ࡞͍͖ͬͯ·͢ʂ IUUQTNBDLFSFMJPKBCMPH

  47. 50 NBDLFSFMJP