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

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

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

Mackerel User Group Meeting Vol.3

karupanerura

August 23, 2017
Tweet

More Decks by karupanerura

Other Decks in Programming

Transcript

  1. 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) } }