Пример #1
0
func init() {
	flag.Parse()
	if *url != "" {
		setStatByUrl(*url)
	} else {
		nagiosToJson.SetStatFile(*statusf)
	}
}
Пример #2
0
// this is for sometime you testing status.dat file on local but need newest file
func setStatByUrl(url string) {
	var req gourl.Req
	req.Url = url
	res, err := req.GetString()
	if err != nil {
		log.Fatalln(err.Error())
	}
	err = ioutil.WriteFile("/tmp/temp.dat", []byte(res), 0644)
	if err != nil {
		log.Fatalln(err.Error())
	}
	nagiosToJson.SetStatFile("/tmp/temp.dat")
}