-
Notifications
You must be signed in to change notification settings - Fork 491
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Small utility to clean up search data for a metric.
- Loading branch information
Craig Peterson
committed
Apr 6, 2016
1 parent
50185c9
commit 458dc84
Showing
3 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package main | ||
|
||
import ( | ||
"flag" | ||
"fmt" | ||
|
||
"bosun.org/cmd/bosun/database" | ||
) | ||
|
||
// USAGE: go run purge_search_data.go -r redishost:6379 -m metricIWantToClear | ||
// use -n to see what would get deleted, without changing any data | ||
|
||
var redis = flag.String("r", "", "redis host:port") | ||
var metric = flag.String("m", "", "metric to purge") | ||
var noop = flag.Bool("n", false, "only print commands, don't run.") | ||
|
||
func main() { | ||
flag.Parse() | ||
if *redis == "" || *metric == "" { | ||
flag.PrintDefaults() | ||
return | ||
} | ||
db := database.NewDataAccess(*redis, true, 0, "").(interface { | ||
PurgeSearchData(string, bool) error | ||
}) | ||
err := db.PurgeSearchData(*metric, *noop) | ||
fmt.Println(err) | ||
} |