mkr-check-self あるいはmackerel-agentのサブセットを作る方法

mkr-check-self あるいはmackerel-agentのサブセットを作る方法

Mackerel User Group Meeting Vol.3

F184d9a69a53293895f36730ca0b8289?s=128

karupanerura

August 23, 2017
Tweet

Transcript

  1. mkr-check-self ͋Δ͍͸mackerel-agentͷαϒηοτΛ࡞Δํ๏ id:karupanerura Mackerel User Group Meeting Vol.3

  2. mkr-check-self ͱ͸ • mackerel-agentͷઃఆΛΈͯ • check؂ࢹ߲໨Λ୳ͯ͠ • ·Δͬͱ࣮ߦ • Ҏ্

  3. DEMO

  4. ͳͥ΄͘͠ͳͬͨͷ͔ • GCPͷIaaSͰ͋ΔGoogle Compute Engine • StackdriverͰͷ؂ࢹ͕جຊ • ͍Ζ͍Ζ͋ͬͯmackerel΋࢖͍ͨ͘ͳͬͨ •

    େਓͷࣄ৘Ͱউखʹొ࿥ͯͨ͠Ί͠ʹ͍͘ • ͔͠͠ݕূ͸͍ͨ͠
  5. ͭ͘Γ͔ͨ

  6. mackerel-agent • OSSʹͳ͍ͬͯΔ • configͳͲ͸ผύοέʔδʹͳͬͯΔ • ͭ·Γ֎෦ϥΠϒϥϦͱͯ͠࢖͑Δʂ • ΍ͬͨʔʂ

  7. ίʔυ

  8. func main() { kingpin.Parse() logger := log.New(colorable.NewColorableStdout(), "", log.Ldate|log.Ltime| log.LUTC)

    conf, err := config.LoadConfig(*conffile) if err != nil { logger.Fatal(err) } ok := true for name, config := range conf.CheckPlugins { checker := checks.Checker{Name: name, Config: config} report := checker.Check() logger.Printf("%s: %s\n", statusColordString(report.Status), color.BlueString(checker.String())) if *verbose { logger.Print(report.Message) } ok = ok && report.Status == checks.StatusOK } if !ok { os.Exit(1) } }
  9. Έ͔͍͡ʂ ͓͕ͯΔʂ

  10. ͨͩ͠ • OSSʹͳ͍ͬͯΔͱ͸͍͑mackerel-agentͷ தͷύοέʔδ • ϥΠϒϥϦͱͯ͠࢖͑Δ͚ΕͲɺϥΠϒϥ Ϧͱͯ͠ར༻͢ΔͨΊʹެ։͞Ε͍ͯΔΘ͚ Ͱ͸ͳ͍ • ࢖͏৔߹͸ࣗݾ੹೚Ͱݸਓπʔϧ͘Β͍Ͱ

  11. ͓͠·͍ :D