diff options
| author | Christine Dodrill <me@christine.website> | 2017-03-29 11:14:59 -0700 |
|---|---|---|
| committer | Christine Dodrill <me@christine.website> | 2017-03-29 11:14:59 -0700 |
| commit | e7824cb2609cc32d4229c9a7bc0de7b7153d36ef (patch) | |
| tree | e14b68f2ea178ca1d96fa87d5cb1686e71a41695 /docker | |
| parent | 77416787c09e1a45f487e5f932a5c688469c730d (diff) | |
| download | x-e7824cb2609cc32d4229c9a7bc0de7b7153d36ef.tar.xz x-e7824cb2609cc32d4229c9a7bc0de7b7153d36ef.zip | |
reorganization
Diffstat (limited to 'docker')
| -rw-r--r-- | docker/status/main.go | 44 | ||||
| -rw-r--r-- | docker/status/stats.go | 137 |
2 files changed, 0 insertions, 181 deletions
diff --git a/docker/status/main.go b/docker/status/main.go deleted file mode 100644 index 68fa28e..0000000 --- a/docker/status/main.go +++ /dev/null @@ -1,44 +0,0 @@ -package main - -import ( - "encoding/json" - "io/ioutil" - "log" - "net/http" - "time" - - "github.com/tv42/httpunix" -) - -func main() { - u := &httpunix.Transport{ - DialTimeout: 100 * time.Millisecond, - RequestTimeout: 2 * time.Second, - ResponseHeaderTimeout: 2 * time.Second, - } - u.RegisterLocation("docker", "/var/run/docker.sock") - - var client = http.Client{ - Transport: u, - } - - resp, err := client.Get("http+unix://docker/v1.12/containers/e1778874f60b5a4ff18a122606bfe2ba45ba41e2ba71b27ce8de1e2dd403aabd/stats?stream=0") - if err != nil { - log.Fatal(err) - } - defer resp.Body.Close() - - data, err := ioutil.ReadAll(resp.Body) - if err != nil { - log.Fatal(err) - } - - reply := &Stats{} - - err = json.Unmarshal(data, reply) - if err != nil { - log.Fatal(err) - } - - log.Printf("%#v", reply) -} diff --git a/docker/status/stats.go b/docker/status/stats.go deleted file mode 100644 index de38d49..0000000 --- a/docker/status/stats.go +++ /dev/null @@ -1,137 +0,0 @@ -package main - -type Stats struct { - Read string `json:"read"` - Network struct { - RxBytes int `json:"rx_bytes"` - RxPackets int `json:"rx_packets"` - RxErrors int `json:"rx_errors"` - RxDropped int `json:"rx_dropped"` - TxBytes int `json:"tx_bytes"` - TxPackets int `json:"tx_packets"` - TxErrors int `json:"tx_errors"` - TxDropped int `json:"tx_dropped"` - } `json:"network"` - PrecpuStats struct { - CPUUsage struct { - TotalUsage int64 `json:"total_usage"` - PercpuUsage []int64 `json:"percpu_usage"` - UsageInKernelmode int64 `json:"usage_in_kernelmode"` - UsageInUsermode int64 `json:"usage_in_usermode"` - } `json:"cpu_usage"` - SystemCPUUsage int64 `json:"system_cpu_usage"` - ThrottlingData struct { - Periods int `json:"periods"` - ThrottledPeriods int `json:"throttled_periods"` - ThrottledTime int `json:"throttled_time"` - } `json:"throttling_data"` - } `json:"precpu_stats"` - CPUStats struct { - CPUUsage struct { - TotalUsage int64 `json:"total_usage"` - PercpuUsage []int64 `json:"percpu_usage"` - UsageInKernelmode int64 `json:"usage_in_kernelmode"` - UsageInUsermode int64 `json:"usage_in_usermode"` - } `json:"cpu_usage"` - SystemCPUUsage int64 `json:"system_cpu_usage"` - ThrottlingData struct { - Periods int `json:"periods"` - ThrottledPeriods int `json:"throttled_periods"` - ThrottledTime int `json:"throttled_time"` - } `json:"throttling_data"` - } `json:"cpu_stats"` - MemoryStats struct { - Usage int `json:"usage"` - MaxUsage int `json:"max_usage"` - Stats struct { - ActiveAnon int `json:"active_anon"` - ActiveFile int `json:"active_file"` - Cache int `json:"cache"` - HierarchicalMemoryLimit int64 `json:"hierarchical_memory_limit"` - HierarchicalMemswLimit int64 `json:"hierarchical_memsw_limit"` - InactiveAnon int `json:"inactive_anon"` - InactiveFile int `json:"inactive_file"` - MappedFile int `json:"mapped_file"` - Pgfault int `json:"pgfault"` - Pgmajfault int `json:"pgmajfault"` - Pgpgin int `json:"pgpgin"` - Pgpgout int `json:"pgpgout"` - RecentRotatedAnon int `json:"recent_rotated_anon"` - RecentRotatedFile int `json:"recent_rotated_file"` - RecentScannedAnon int `json:"recent_scanned_anon"` - RecentScannedFile int `json:"recent_scanned_file"` - Rss int `json:"rss"` - RssHuge int `json:"rss_huge"` - Swap int `json:"swap"` - TotalActiveAnon int `json:"total_active_anon"` - TotalActiveFile int `json:"total_active_file"` - TotalCache int `json:"total_cache"` - TotalInactiveAnon int `json:"total_inactive_anon"` - TotalInactiveFile int `json:"total_inactive_file"` - TotalMappedFile int `json:"total_mapped_file"` - TotalPgfault int `json:"total_pgfault"` - TotalPgmajfault int `json:"total_pgmajfault"` - TotalPgpgin int `json:"total_pgpgin"` - TotalPgpgout int `json:"total_pgpgout"` - TotalRss int `json:"total_rss"` - TotalRssHuge int `json:"total_rss_huge"` - TotalSwap int `json:"total_swap"` - TotalUnevictable int `json:"total_unevictable"` - TotalWriteback int `json:"total_writeback"` - Unevictable int `json:"unevictable"` - Writeback int `json:"writeback"` - } `json:"stats"` - Failcnt int `json:"failcnt"` - Limit int64 `json:"limit"` - } `json:"memory_stats"` - BlkioStats struct { - IoServiceBytesRecursive []struct { - Major int `json:"major"` - Minor int `json:"minor"` - Op string `json:"op"` - Value int `json:"value"` - } `json:"io_service_bytes_recursive"` - IoServicedRecursive []struct { - Major int `json:"major"` - Minor int `json:"minor"` - Op string `json:"op"` - Value int `json:"value"` - } `json:"io_serviced_recursive"` - IoQueueRecursive []struct { - Major int `json:"major"` - Minor int `json:"minor"` - Op string `json:"op"` - Value int `json:"value"` - } `json:"io_queue_recursive"` - IoServiceTimeRecursive []struct { - Major int `json:"major"` - Minor int `json:"minor"` - Op string `json:"op"` - Value int `json:"value"` - } `json:"io_service_time_recursive"` - IoWaitTimeRecursive []struct { - Major int `json:"major"` - Minor int `json:"minor"` - Op string `json:"op"` - Value int `json:"value"` - } `json:"io_wait_time_recursive"` - IoMergedRecursive []struct { - Major int `json:"major"` - Minor int `json:"minor"` - Op string `json:"op"` - Value int `json:"value"` - } `json:"io_merged_recursive"` - IoTimeRecursive []struct { - Major int `json:"major"` - Minor int `json:"minor"` - Op string `json:"op"` - Value int `json:"value"` - } `json:"io_time_recursive"` - SectorsRecursive []struct { - Major int `json:"major"` - Minor int `json:"minor"` - Op string `json:"op"` - Value int `json:"value"` - } `json:"sectors_recursive"` - } `json:"blkio_stats"` -} |
