github.com/google/cadvisor@v0.49.1/client/README.md (about) 1 # Example REST API Client 2 3 This is an implementation of a cAdvisor REST API in Go. You can use it like this: 4 5 ```go 6 client, err := client.NewClient("http://192.168.59.103:8080/") 7 ``` 8 9 Obviously, replace the URL with the path to your actual cAdvisor REST endpoint. 10 11 12 ### MachineInfo 13 14 ```go 15 client.MachineInfo() 16 ``` 17 18 This method returns a cadvisor/v1.MachineInfo struct with all the fields filled in. Here is an example return value: 19 20 ``` 21 (*v1.MachineInfo)(0xc208022b10)({ 22 NumCores: (int) 4, 23 MemoryCapacity: (int64) 2106028032, 24 Filesystems: ([]v1.FsInfo) (len=1 cap=4) { 25 (v1.FsInfo) { 26 Device: (string) (len=9) "/dev/sda1", 27 Capacity: (uint64) 19507089408 28 } 29 } 30 }) 31 ``` 32 33 You can see the full specification of the [MachineInfo struct in the source](../info/v1/machine.go#L131) 34 35 ### ContainerInfo 36 37 Given a container name and a [ContainerInfoRequest](../info/v1/container.go#L101), will return all information about the specified container. See the [ContainerInfoRequest struct in the source](../info/v1/container.go#L101) for the full specification. 38 39 ```go 40 request := v1.ContainerInfoRequest{NumStats: 10} 41 sInfo, err := client.ContainerInfo("/docker/d9d3eb10179e6f93a...", &request) 42 ``` 43 Returns a [ContainerInfo struct](../info/v1/container.go#L128) 44 45 ### SubcontainersInfo 46 47 Given a container name and a [ContainerInfoRequest](../info/v1/container.go#L101), will recursively return all info about the container and all subcontainers contained within the container. See the [ContainerInfoRequest struct in the source](../info/v1/container.go#L101) for the full specification. 48 49 ```go 50 request := v1.ContainerInfoRequest{NumStats: 10} 51 sInfo, err := client.SubcontainersInfo("/docker", &request) 52 ``` 53 54 Returns a [ContainerInfo struct](../info/v1/container.go#L128) with the Subcontainers field populated.