示例#1
0
func main() {
	if ok := len(os.Args); ok == 1 {
		fmt.Printf("./range expr, expr must be specified\n")
		os.Exit(0)
	}
	ranger, _ := ranger.InitRanger("monitor18.hy01.wandoujia.com")
	d := ranger.LoadExpr(os.Args[1])
	fmt.Println(strings.Join(d.Show(), "\n"))
}
示例#2
0
func HTTPMonitorInit() (*HTTPMonitor, error) {
	hm := &HTTPMonitor{}
	ranger, err := ranger.InitRanger(common.REDIS_SERVER_ADDR, common.REDIS_SERVER_PORT)
	if err != nil {
		return hm, err
	}
	hm.ranger = ranger
	hm.httpConfig = make(map[string]*confInfo)
	hm.record = make(map[string]string)
	hm.checkStamp = make(map[string]int64)
	hm.enQueue = make(chan *confInfo)
	hm.deQueue = make(chan []string)
	hm.alive = true

	return hm, nil
}