github.com/google/cadvisor@v0.49.1/client/v2/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 There is no v2 MachineInfo API, so the v2 client exposes the [v1 MachineInfo](../../info/v1/machine.go#L131) 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 ### VersionInfo 36 37 ```go 38 client.VersionInfo() 39 ``` 40 41 This method returns the cAdvisor version. 42 43 ### Attributes 44 45 ```go 46 client.Attributes() 47 ``` 48 49 This method returns a [cadvisor/info/v2/Attributes](../../info/v2/machine.go#L24) struct with all the fields filled in. Attributes includes hardware attributes (as returned by MachineInfo) as well as software attributes (eg. software versions). Here is an example return value: 50 51 ``` 52 (*v2.Attributes)({ 53 KernelVersion: (string) (len=17) "3.13.0-44-generic" 54 ContainerOsVersion: (string) (len=18) "Ubuntu 14.04.1 LTS" 55 DockerVersion: (string) (len=9) "1.5.0-rc4" 56 CadvisorVersion: (string) (len=6) "0.10.1" 57 NumCores: (int) 4, 58 MemoryCapacity: (int64) 2106028032, 59 Filesystems: ([]v2.FsInfo) (len=1 cap=4) { 60 (v2.FsInfo) { 61 Device: (string) (len=9) "/dev/sda1", 62 Capacity: (uint64) 19507089408 63 } 64 } 65 }) 66 ``` 67 68 You can see the full specification of the [Attributes struct in the source](../../info/v2/machine.go#L24) 69