func containerMemUsageHandler(params martini.Params) (int, string) {
	id := params["id"]

	containerMemory, err := mem.GetUsage(id)
	if err != nil {
		return 500, err.Error()
	}
	containerMemoryStr := strconv.FormatInt(containerMemory, 10)
	return 200, containerMemoryStr
}
func containerMemUsageHandler(params martini.Params, res http.ResponseWriter) {
	id := params["id"]

	containerMemoryUsage, err := mem.GetUsage(id)
	if err != nil {
		res.WriteHeader(500)
		res.Header().Set("Content-Type", "text/plain")
		fmt.Fprintf(res, err.Error())
		return
	}

	res.WriteHeader(200)
	res.Header().Set("Content-Type", "application/json")

	json.NewEncoder(res).Encode(&containerMemoryUsage)
}
func containerUsageHandler(res http.ResponseWriter, req *http.Request, params martini.Params) {
	id := params["id"]
	usage := client.Usage{}

	memUsage, err := mem.GetUsage(id)
	if err != nil {
		res.WriteHeader(500)
		res.Header().Set("Content-Type", "text/plain")
		fmt.Fprintf(res, err.Error())
		return
	}
	usage.Memory = &memUsage.MemoryUsage

	cpuUsage, err := cpu.GetUsage(id)
	if err != nil {
		res.WriteHeader(500)
		res.Header().Set("Content-Type", "text/plain")
		fmt.Fprintf(res, err.Error())
		return
	}
	usage.Cpu = (*client.CpuUsage)(&cpuUsage)

	if req.URL.Query().Get("net") == "true" {
		netUsage, err := net.GetUsage(id)
		if err != nil {
			res.WriteHeader(500)
			res.Header().Set("Content-Type", "text/plain")
			res.Write([]byte(err.Error()))
			return
		}
		usage.Net = (*client.NetUsage)(&netUsage)
	}

	res.WriteHeader(200)
	json.NewEncoder(res).Encode(&usage)
}