| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Dispatcher usage: | 5 // Dispatcher usage: |
| 6 // go run infra/monitoring/dispatcher | 6 // go run infra/monitoring/dispatcher |
| 7 // Expects gatekeeper.json to be in the current directory. | 7 // Expects gatekeeper.json to be in the current directory. |
| 8 // Runs a single check, prints out diagnosis and exits. | 8 // Runs a single check, prints out diagnosis and exits. |
| 9 // TODO(seanmccullough): Run continuously. Also, consider renaming to 'patrol' | 9 // TODO(seanmccullough): Run continuously. Also, consider renaming to 'patrol' |
| 10 // or 'scanner' because that's really what this thing does. | 10 // or 'scanner' because that's really what this thing does. |
| 11 | 11 |
| 12 package main | 12 package main |
| 13 | 13 |
| 14 import ( | 14 import ( |
| 15 "encoding/json" | 15 "encoding/json" |
| 16 "flag" | 16 "flag" |
| 17 "fmt" | 17 "fmt" |
| 18 "io/ioutil" | 18 "io/ioutil" |
| 19 "os" | 19 "os" |
| 20 "strings" | 20 "strings" |
| 21 "time" | 21 "time" |
| 22 | 22 |
| 23 » "infra/libs/logging/gologger" | 23 » "github.com/luci/luci-go/common/logging/gologger" |
| 24 | 24 |
| 25 "infra/monitoring/analyzer" | 25 "infra/monitoring/analyzer" |
| 26 "infra/monitoring/client" | 26 "infra/monitoring/client" |
| 27 "infra/monitoring/messages" | 27 "infra/monitoring/messages" |
| 28 ) | 28 ) |
| 29 | 29 |
| 30 var ( | 30 var ( |
| 31 dataURL = flag.String("data_url", "", "Url where alerts are
stored") | 31 dataURL = flag.String("data_url", "", "Url where alerts are
stored") |
| 32 masterFilter = flag.String("master-filter", "", "Filter out maste
rs that contain this string") | 32 masterFilter = flag.String("master-filter", "", "Filter out maste
rs that contain this string") |
| 33 masterOnly = flag.String("master", "", "Only check this master"
) | 33 masterOnly = flag.String("master", "", "Only check this master"
) |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 } | 168 } |
| 169 } | 169 } |
| 170 | 170 |
| 171 log.Infof("Filtered failures: %v", filteredFailures) | 171 log.Infof("Filtered failures: %v", filteredFailures) |
| 172 a.Client.DumpStats() | 172 a.Client.DumpStats() |
| 173 log.Infof("Elapsed time: %v", time.Since(start)) | 173 log.Infof("Elapsed time: %v", time.Since(start)) |
| 174 if len(errs) > 0 { | 174 if len(errs) > 0 { |
| 175 os.Exit(1) | 175 os.Exit(1) |
| 176 } | 176 } |
| 177 } | 177 } |
| OLD | NEW |