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

Mackerel - Current status #mackerelio

A76985bd77fecba82109dee506b1fec2?s=47 Shinji Tanaka
September 24, 2014

Mackerel - Current status #mackerelio

Mackerel Meetup #2
Sep 24, 2014

A76985bd77fecba82109dee506b1fec2?s=128

Shinji Tanaka

September 24, 2014
Tweet

Transcript

  1. Mackerel ! - Current Status - 2014-09-24 Hatena Co., Ltd.

    @stanaka
  2. Mackerel https://mackerel.io/

  3. ΞδΣϯμ • Mackerel Overview & Update • Mackerel ਖ਼ࣜԽͱࠓޙͷ༧ఆ

  4. 1 Mackerel Overview & Update

  5. Mackerelʢ೔ຊޠͰḉʣ • αʔό؅ཧπʔϧ as a Service • લ਎: ͸ͯͳͷࣾ಺πʔϧ

  6. Mackerelͷಛ௃ • ؆୯ηοτΞοϓ • 1୆Ͱ΋਺ඦ୆Ͱ΋ศརʹ • ༷ʑͳ࣌ܥྻσʔλΛՄࢹԽɾ؂ࢹ • ֤छπʔϧͱͷڧྗͳ࿈ܞ

  7. ΞʔΩςΫνϟ

  8. Mackerelͷಛ௃ • ؆୯ηοτΞοϓ • 1୆Ͱ΋਺ඦ୆Ͱ΋ศརʹ • ༷ʑͳ࣌ܥྻσʔλΛՄࢹԽɾ؂ࢹ • ֤छπʔϧͱͷڧྗͳ࿈ܞ

  9. • Go Ͱॻ͔ΕͨެࣜΤʔδΣϯτ • Linux αϙʔτ (CentOS 5/6, Debian 6/7)

    • ϗετεϖοΫͱϝτϦοΫΛऩू mackerelio/mackerel-agent mackerel-agent
  10. agent: Πϯετʔϧ mackerel.io/my/instruction-agent • yum/apt ϦϙδτϦ͔Β • tarball • go

    get
  11. Mackerelͷಛ௃ • ؆୯ηοτΞοϓ • 1୆Ͱ΋਺ඦ୆Ͱ΋ศརʹ • ༷ʑͳ࣌ܥྻσʔλΛՄࢹԽɾ؂ࢹ • ֤छπʔϧͱͷڧྗͳ࿈ܞ

  12. αʔϏεͱϩʔϧ • αʔϏε • ͞·͟·ͳϗετ͕ڠௐ • Hatena-Bookmark, Hatena-Blog, … •

    ϗετ܈Λ໾ׂͰ·ͱΊΔ = ϩʔϧ • app, db, … IFMQKBNBDLFSFMJPFOUSZIPXUPDSFBUFTFSWJDFTBOESPMFT
  13. αʔϏε - ϩʔϧ • Hatena-Blog • app • host01, host02,

    … • db • memcached • Hatena-Bookmark • app • crawler
  14. agent: ϩʔϧઃఆ • ઃఆ͔ΒαʔϏεɾϩʔϧΛࢦఆ • ଘࡏ͠ͳ͔ͬͨΒ࡞੒͢Δ • cookbook-mackerel-agent Ͱ΋ར༻ #

     mackerel-­‐agent.conf   roles  =  [  “Mackerel:db”,  …  ]
  15. ChefͰηοτΞοϓ͢Δ • cookbook-mackerel-agent • mackerelio/cookbook-mackerel-agent #  APIΩʔΛઃఆ   node.default['mackerel-­‐agent']['apikey']  =

     <API  KEY>   #  αʔϏεɾϩʔϧΛࢦఆ   node.default['mackerel-­‐agent']['conf']['roles']  =  ["My-­‐Service:app",   “Another-­‐Service:db"]   #  ϓϥάΠϯΛࢦఆ   node.default['mackerel-­‐agent']['conf']['plugin.metrics.vmstat']  =  {      'command'  =>  'ruby  /etc/sensu/plugins/system/vmstat-­‐metrics.rb',   }   ! include_recipe  'mackerel-­‐agent'
  16. ϗετͷϥΠϑαΠΫϧ • εςʔλεͰঢ়ଶΛ؅ཧ standby working maintenance retired ηοτΞοϓ poweroff ؂ࢹର৅

    ௨஌ର৅
  17. ϥΠϑαΠΫϧͱϫʔΫϑϩʔ • ϗετΛ৽ن࡞੒ • ຊ൪౤ೖɾLB૊ࠐΈ • ো֐ରԠɺ໰୊෼ੳ • ୀ໾४උ •

    ୀ໾ standby working maintenance retired poweroff
  18. Mackerelͷಛ௃ • ؆୯ηοτΞοϓ • 1୆Ͱ΋਺ඦ୆Ͱ΋ศརʹ • ༷ʑͳ࣌ܥྻσʔλΛՄࢹԽɾ؂ࢹ • ֤छπʔϧͱͷڧྗͳ࿈ܞ

  19. agent: ϝτϦοΫऩू • ϗετͷϦιʔεͷ࣌ࠁ͝ͱͷ਺஋ • ඪ४: loadavg5, cpu.*, memory.*, interface.*,

    disk.* • ΧελϜ: ֤छϛυϧ΢ΣΞରԠϓϥάΠϯ • αʔϏεϝτϦοΫ • Ԡ౴࣌ؒɾΤϥʔ཰ɾΞΫςΟϒϢʔβʔ਺
  20. ϩʔϧຖͷάϥϑͰՄࢹԽ

  21. ΩϟύγςΟϓϥϯχϯάʹ

  22. ΦʔτεέʔϧରԠ • αʔό͕ॖୀͯ͠΋άϥϑ͸࢒Δ

  23. agent: ΧελϜϝτϦοΫ • plugin.metrics.*.command Λهड़ # mackerel-agent.conf [plugin.metrics.my-super-metric] command =

    “/path/to/my-super-metric.sh” IFMQKBNBDLFSFMJPFOUSZBEWBODFEDVTUPNNFUSJDT
  24. agent: ΧελϜϝτϦοΫ • Sensu ϓϥάΠϯޓ׵ͷग़ྗ
 ʢλϒ۠੾Γʣ % ~/.mackerel-agent/plugins/chrome-tabs-count.sh! browser.tabs.count 9

    1403153173! browser.tabs.works 7 1403153173
  25. ΧελϜϝτϦοΫͷऔಘ • mackerel-agent-plugins • MackerelͷެࣜϓϥάΠϯू •        mackerelio/mackerel-­‐agent-­‐plugins

      • ࠷৽(0.4.0): apache2, memcached, mysql, nginx, plack, postgres, redis • ࣍ϦϦʔε: haproxy, jvm, squid, varnish
  26. αʔϏεϝτϦοΫͷ౤ߘ • fluent-plugin-mackerel • tksmd/fluent-plugin-mackerel • ྫ: NginxͷΞΫηεϩά͔Βεςʔλείʔυ
 ͝ͱʹΧ΢ϯτ IFMQKBNBDLFSFMJPFOUSZBEWBODFEqVFOUE

  27. ྫ: NginxͷΞΫηεϩά͔Β
 εςʔλείʔυ͝ͱʹΧ΢ϯτ #1 • tail plugin #  LTSVܗࣜͷϩάϑΝΠϧΛಡΈࠐΉ  

    <source>      type  tail      format  ltsv      time_format  %d/%b/%Y:%H:%M:%S  %z      path  /var/log/nginx/access.log      pos_file  /var/log/nginx/access_log.pos      tag  access.nginx   </source>
  28. ྫ: NginxͷΞΫηεϩά͔Β
 εςʔλείʔυ͝ͱʹΧ΢ϯτ #2 • fluent-plugin-datacounter #  fluent-­‐plugin-­‐datacounterͰεςʔλείʔυผʹूܭ͢Δ   <match

     access.nginx>      type  datacounter      count_interval  1m      count_key  status      aggregate  all      tag  nginx.status      pattern1  2xx  ^2\d\d$      pattern2  3xx  ^3\d\d$      pattern3  4xx  ^4\d\d$      pattern4  5xx  ^5\d\d$   </match>
  29. ྫ: NginxͷΞΫηεϩά͔Β
 εςʔλείʔυ͝ͱʹΧ΢ϯτ #3 • fluent-plugin-mackerel #  fluent-­‐plugin-­‐mackerelʹΑΓαʔϏεϝτϦοΫΛ౤ߘ͢Δ   <match

     nginx.status.**>      type  mackerel      api_key  <౤ߘઌΦʔΨχθʔγϣϯͷAPIΩʔ>      service  <౤ߘઌαʔϏε໊>      metrics_name  access_num.${out_key}      out_keys  2xx_count,3xx_count,4xx_count,5xx_count   </match>
  30. CloudWatch → Mackerel • fluent-plugin-cloudwatch • fluent-plugin-mackerel

  31. ؂ࢹ(Monitor) • ࢮ׆؂ࢹ • ϝτϦοΫ؂ࢹ • Ұఆ࣌ؒɺᮢ஋Λӽ͑ΔͱΞϥʔτ • ݱঢ়͸શϗετ(working, standby)Λର৅

    IFMQKBNBDLFSFMJPFOUSZIPXUPBMFSUT
  32. ؂ࢹ(Monitor)ͷࠓޙ ! • ϗετ • ϩʔϧ୯Ґͷ৚݅ઃఆ(Coming Soon!) • αʔϏε •

    αʔϏεϝτϦοΫʹର͢Δ؂ࢹ(Coming Soon!)
  33. Mackerelͷಛ௃ • ؆୯ηοτΞοϓ • 1୆Ͱ΋਺ඦ୆Ͱ΋ศརʹ • ༷ʑͳ࣌ܥྻσʔλΛՄࢹԽɾ؂ࢹ • ֤छπʔϧͱͷڧྗͳ࿈ܞ

  34. Ξϥʔτͷ௨஌(νϟϯωϧ) • ϝʔϧ௨஌ • Webhook

  35. Webhook HuBot࿈ܞ • HuBotͰWebhookΛड͚औΓ௨஌ ! • mackerelio/hubot-mackerel-notifier IFMQKBNBDLFSFMJPFOUSZBEWBODFEIVCPU npm  install

     hubot-­‐mackerel-­‐notifier  -­‐-­‐save
  36. Slack΁ͷ௚઀ͷ௨஌ • Coming Soon!!

  37. mackerel-client gem rubygems.org/gems/mackerel-client hosts  =  client.get_hosts(     :service  =>

     'Hatena-­‐Blog',     :roles  =>  'proxy'   )   ! client.update_host_status     host_id,  'working'  
  38. mkr: CLI Mackerel Client • mkr host info --service Hatena-Blog

    --role proxy! • mkr host status —host-id <host_id> —status working
  39. Capistrano ࿈ܞ • config/deployͷMackerel APIͱͷ࿈ ܞΛهड़ → ৄࡉ͸ϔϧϓ΁ #  bundle

     exec  cap  deploy:echo      *  2014-­‐09-­‐23  21:36:28  executing  `deploy:echo'      *  executing  "echo  \"Integration  Test\""          servers:  ["127.0.0.1"]          [127.0.0.1]  executing  command    **  [out  ::  127.0.0.1]  Integration  Test          command  finished  in  435ms IFMQKBNBDLFSFMJPFOUSZBEWBODFEDBQJTUSBOPY
  40. 2 Mackerel ਖ਼ࣜԽͱࠓޙͷ༧ఆ

  41. ਖ਼ࣜԽ • ϕʔλϦϦʔε (5/8) • ඼࣭޲্ɾ҆ఆԽ(υοΫϑʔσΟϯά) • ࢖͑ΔϨϕϧ΁ػೳ։ൃ • ਖ਼ࣜϦϦʔε

    (9/19)
  42. Pricing • Standard • 2,000ԁ/ϗετɾ݄ • ϗετ୆਺ 20+ ͰϘϦϡʔϜσΟεΧ΢ϯτ •

    ແྉτϥΠΞϧ͋Γ • Free • 5୆·Ͱ • දࣔظؒ(24h)ɺαʔϏεϝτϦοΫ਺ɾ؂ࢹ਺ʹ੍ݶ
  43. Pricing next • ݸਓ&খن໛Ϣʔβʔ޲͚ϓϥϯΛ ݕ౼த

  44. Coming Soon!! • GitHubϩάΠϯ • Monitorର৅ͷৄࡉԽ(ϩʔϧ୯Ґ) • αʔϏεϝτϦοΫͷ؂ࢹ • ΧελϜϝτϦοΫϓϥάΠϯͷॆ࣮

    • Slack࿈ܞͳͲɺ௨஌ઌॆ࣮
  45. Next Development • Πϕϯτ(ΞϥʔτɾσϓϩΠͳͲ) • άϥϑ্ʹϓϩοτ σϓϩΠ

  46. Next Development • άϥϑվળ • ߴ଎Խɾ֎෦ష෇ɾࣗಈϦϑϨογϡ • Ξϥʔτվળ • ௨஌ઌͷॆ࣮ɾ৚݅ͷΧελϚΠζ

    • μογϡϘʔυΧελϚΠζ • ೚ҙͷάϥϑΛషΓ෇͚ΒΕΔΑ͏ʹ
  47. ϔϧϓ help-ja.mackerel.io

  48. None
  49. None
  50. mackerel.io