func init() { flag.Parse() if *url != "" { setStatByUrl(*url) } else { nagiosToJson.SetStatFile(*statusf) } }
// 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") }