Пример #1
0
func monitorServices() {
	println("Fear the reaper...")
	for {
		skylib.LoadConfig()
		clients := skylib.GetAllClientsByService("CommonService")
		println("#Agents:", len(clients))
		for _, x := range clients {
			fmt.Printf("%v\n", x)
			// Insert your code to do something for
			// each service here
			// or get rid of this loop
			// and do something else interesting!
			x.Close()
			skylib.Requests.Add(1) // Should we count Heartbeat requests?
		}
		syscall.Sleep(2000 * 1000000) // sleep then do it again!
	}
}
Пример #2
0
func monitorServices() {
	println("Fear the reaper...")
	for {
		skylib.LoadConfig()
		clients := skylib.GetAllClientsByService("CommonService")
		println("#Agents:", len(clients))
		for _, x := range clients {
			hc := skylib.HeartbeatRequest{Timestamp: time.Seconds()}
			hcr := skylib.HeartbeatResponse{}
			err := x.Call("CommonService.Ping", hc, &hcr)
			if err != nil {
				panic(err)
			}
			fmt.Printf("hcr:%v\n", hcr)
			x.Close()
			skylib.Requests.Add(1) // Should be count Heartbeat requests?
		}
		syscall.Sleep(2000 * 1000000) // sleep then do it again!
	}
}