41
Mackerel standard @a_know Mackerel User Group Meeting Vol.1, 2016/6/14 1

Mackerel の standard プランを個人利用している話

  • Upload
    a-know

  • View
    1.561

  • Download
    2

Embed Size (px)

Citation preview

Page 1: Mackerel の standard プランを個人利用している話

Mackerel standard

@a_know

Mackerel User Group Meeting Vol.1, 2016/6/14 1

Page 2: Mackerel の standard プランを個人利用している話

Who am I ?

• @a_know / id:a-know / /

• a-know.me

• Rails

• Chef, serverspec / GCP / Team Building Mackerel User Group Meeting Vol.1, 2016/6/14 2

Page 3: Mackerel の standard プランを個人利用している話

Mackerel User Group Meeting Vol.1, 2016/6/14 3

Page 4: Mackerel の standard プランを個人利用している話

Mackerel

Mackerel User Group Meeting Vol.1, 2016/6/14 4

Page 5: Mackerel の standard プランを個人利用している話

• ...

• A Mackerel

• B fluent-plugin-mackerel

• C

• D Mackerel User Group Meeting Vol.1, 2016/6/14 5

Page 6: Mackerel の standard プランを個人利用している話

Mackerel User Group Meeting Vol.1, 2016/6/14 6

Page 7: Mackerel の standard プランを個人利用している話

Mackerel User Group Meeting Vol.1, 2016/6/14 7

Page 8: Mackerel の standard プランを個人利用している話

... !

Mackerel User Group Meeting Vol.1, 2016/6/14 8

Page 9: Mackerel の standard プランを個人利用している話

a-know.me

Mackerel User Group Meeting Vol.1, 2016/6/14 9

Page 10: Mackerel の standard プランを個人利用している話

!¥ 1,800 / month

Mackerel User Group Meeting Vol.1, 2016/6/14 10

Page 11: Mackerel の standard プランを個人利用している話

Mackerel User Group Meeting Vol.1, 2016/6/14 11

Page 12: Mackerel の standard プランを個人利用している話

Mackerel

Mackerel User Group Meeting Vol.1, 2016/6/14 12

Page 13: Mackerel の standard プランを個人利用している話

Mackerel •

• fluent-plugin-mackerel

Mackerel User Group Meeting Vol.1, 2016/6/14 13

Page 14: Mackerel の standard プランを個人利用している話

Mackerel User Group Meeting Vol.1, 2016/6/14 14

Page 15: Mackerel の standard プランを個人利用している話

Mackerel

Mackerel User Group Meeting Vol.1, 2016/6/14 15

Page 16: Mackerel の standard プランを個人利用している話

Dashing

• Dashing plugin widget Mackerel User Group Meeting Vol.1, 2016/6/14 16

Page 17: Mackerel の standard プランを個人利用している話

Mackerel User Group Meeting Vol.1, 2016/6/14 17

Page 18: Mackerel の standard プランを個人利用している話

• https://github.com/Shopify/dashing/wiki/Additional-Widgets

Mackerel User Group Meeting Vol.1, 2016/6/14 18

Page 19: Mackerel の standard プランを個人利用している話

• Dashing widget Ruby

• fitbit Widget

• Google Analytics visitor count widget

• 1 widget

• Mackerel

• Web API

Mackerel User Group Meeting Vol.1, 2016/6/14 19

Page 20: Mackerel の standard プランを個人利用している話

Mackerel User Group Meeting Vol.1, 2016/6/14 20

Page 21: Mackerel の standard プランを個人利用している話

• fitgem gem fitbit = Fitbit.new unit_system: 'METRIC'

fluent_logger('a-know-metricks') .post('activity', { todays_steps: fitbit.todays_steps })

Mackerel User Group Meeting Vol.1, 2016/6/14 21

Page 22: Mackerel の standard プランを個人利用している話

• td-agent.conf

<match a-know-metricks.activity.**> type mackerel api_key <%= @mackerel_api_key %> service <%= @mackerel_service_name %> metrics_name a-know-metricks-activity.todays_steps out_keys todays_steps</match>

Mackerel User Group Meeting Vol.1, 2016/6/14 22

Page 23: Mackerel の standard プランを個人利用している話

Mackerel User Group Meeting Vol.1, 2016/6/14 23

Page 24: Mackerel の standard プランを個人利用している話

Mackerel User Group Meeting Vol.1, 2016/6/14 24

Page 25: Mackerel の standard プランを個人利用している話

• google-api-client gem client = Google::APIClient.new(appinfo_hash)client.authorization = Signet::OAuth2::Client.new(credentials_hash)client.authorization.fetch_access_token!

analytics = client.discovered_api('analytics','v3')

# Execute the query, get the value `[["1"]]`response = client.execute(api_method: analytics.data.realtime.get, parameters: { ids: "ga:" + profile_id, metrics: "ga:activeVisitors",}).data.rows.flatten

number = response.empty? ? 0 : response.first.to_i

fluent_logger('blog-metricks') .post('active-visitors', { number: number })

Mackerel User Group Meeting Vol.1, 2016/6/14 25

Page 26: Mackerel の standard プランを個人利用している話

• td-agent.conf

<match blog-metricks.active-visitors.**> type mackerel api_key <%= @mackerel_api_key %> service <%= @mackerel_service_name %> metrics_name blog-metricks-active-visitors.number out_keys number</match>

Mackerel User Group Meeting Vol.1, 2016/6/14 26

Page 27: Mackerel の standard プランを個人利用している話

Mackerel User Group Meeting Vol.1, 2016/6/14 27

Page 28: Mackerel の standard プランを個人利用している話

Mackerel User Group Meeting Vol.1, 2016/6/14 28

Page 29: Mackerel の standard プランを個人利用している話

!

Mackerel User Group Meeting Vol.1, 2016/6/14 29

Page 30: Mackerel の standard プランを個人利用している話

wkwk ...

Mackerel User Group Meeting Vol.1, 2016/6/14 30

Page 31: Mackerel の standard プランを個人利用している話

Mackerel •

• fluent-plugin-mackerel

• a-know

Mackerel User Group Meeting Vol.1, 2016/6/14 31

Page 32: Mackerel の standard プランを個人利用している話

(?)...

Mackerel User Group Meeting Vol.1, 2016/6/14 32

Page 33: Mackerel の standard プランを個人利用している話

Mackerel User Group Meeting Vol.1, 2016/6/14 33

Page 34: Mackerel の standard プランを個人利用している話

• API

• standard (?)

• a-know.me https

Mackerel User Group Meeting Vol.1, 2016/6/14 34

Page 35: Mackerel の standard プランを個人利用している話

!

Mackerel User Group Meeting Vol.1, 2016/6/14 35

Page 36: Mackerel の standard プランを個人利用している話

API

Mackerel User Group Meeting Vol.1, 2016/6/14 36

Page 37: Mackerel の standard プランを個人利用している話

API

Mackerel User Group Meeting Vol.1, 2016/6/14 37

Page 38: Mackerel の standard プランを個人利用している話

Mackerel User Group Meeting Vol.1, 2016/6/14 38

Page 39: Mackerel の standard プランを個人利用している話

nginxlocation ~ /(blog_metricks|a_know_metricks)/.+ { allow 59.106.108.64/26; deny all; try_files $uri @unicorn;}

Mackerel User Group Meeting Vol.1, 2016/6/14 39

Page 40: Mackerel の standard プランを個人利用している話

...

Mackerel User Group Meeting Vol.1, 2016/6/14 40

Page 41: Mackerel の standard プランを個人利用している話

End ✋• http://goo.gl/fLWGhp

Mackerel User Group Meeting Vol.1, 2016/6/14 41