func main() {
	h := handler.New("/etc/sensu/conf.d/handler-elasticsearch.json")
	lines := strings.Split(strings.TrimRight(h.Event.Check.Output, "\n"), "\n")

	for _, line := range lines {
		request, err := http.NewRequest("POST", url(&h.Event, &h.Config), strings.NewReader(payload(line)))
		if err != nil {
			continue
		}
		request.Header.Set("Content-Type", "application/json")

		http.DefaultClient.Do(request)
	}
}
func main() {
	h := handler.New("/etc/sensu/conf.d/handler-delete.json")

	status := h.Config.GetPath("delete", "status").MustInt()
	contain := contains(h.Event.Client.Subscriptions, h.Config.GetPath("delete", "subscriptions").MustArray())
	if h.Event.Check.Name != "keepalive" || h.Event.Check.Status != status || !contain {
		return
	}

	sensu.DefaultAPI = &sensu.API{
		Host:     h.Config.GetPath("delete", "host").MustString(),
		Port:     h.Config.GetPath("delete", "port").MustInt(),
		User:     h.Config.GetPath("delete", "user").MustString(),
		Password: h.Config.GetPath("delete", "password").MustString(),
	}
	sensu.DefaultAPI.DeleteClientsClient(h.Event.Client.Name)
}