/
metrics.go
158 lines (133 loc) · 2.96 KB
/
metrics.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
package collector
import "github.com/prometheus/client_golang/prometheus"
var (
containerStateMetric = prometheus.NewDesc(
"docker_container_state",
"State of the container",
[]string{"name", "state"},
nil,
)
containerInfo = prometheus.NewDesc(
"docker_container_info",
"Infos about the container",
[]string{"name", "image_name", "image"},
nil,
)
containerUptime = prometheus.NewDesc(
"docker_container_uptime",
"Uptime of the container in seconds",
[]string{"name"},
nil,
)
/*
CPU Metrics
*/
cpuUsagePercentage = prometheus.NewDesc(
"docker_container_cpu_usage_percentage",
"CPU usage in percentage",
[]string{"name"},
nil,
)
cpuOnlineCPUs = prometheus.NewDesc(
"docker_container_cpu_online_cpus",
"Number of online CPUs",
[]string{"name"},
nil,
)
/*
Memory Metrics
*/
memoryUsageBytes = prometheus.NewDesc(
"docker_container_memory_usage_bytes",
"Memory usage in bytes",
[]string{"name"},
nil,
)
memoryTotalBytes = prometheus.NewDesc(
"docker_container_memory_total_bytes",
"Total memory in bytes",
[]string{"name"},
nil,
)
memoryUsagePercentage = prometheus.NewDesc(
"docker_container_memory_usage_percentage",
"Memory usage in percentage",
[]string{"name"},
nil,
)
/*
Network Metrics
*/
networkRxBytes = prometheus.NewDesc(
"docker_container_network_rx_bytes",
"Network received bytes total",
[]string{"name", "network"},
nil,
)
networkRxPackets = prometheus.NewDesc(
"docker_container_network_rx_packets",
"Network received packets total",
[]string{"name", "network"},
nil,
)
networkRxDroppedPackets = prometheus.NewDesc(
"docker_container_network_rx_dropped_packets",
"Network dropped packets total",
[]string{"name", "network"},
nil,
)
networkRxErrors = prometheus.NewDesc(
"docker_container_network_rx_errors",
"Network received errors",
[]string{"name", "network"},
nil,
)
networkTxBytes = prometheus.NewDesc(
"docker_container_network_tx_bytes",
"Network sent bytes total",
[]string{"name", "network"},
nil,
)
networkTxPackets = prometheus.NewDesc(
"docker_container_network_tx_packets",
"Network sent packets total",
[]string{"name", "network"},
nil,
)
networkTxDroppedPackets = prometheus.NewDesc(
"docker_container_network_tx_dropped_packets",
"Network dropped packets total",
[]string{"name", "network"},
nil,
)
networkTxErrors = prometheus.NewDesc(
"docker_container_network_tx_errors",
"Network sent errors",
[]string{"name", "network"},
nil,
)
/*
BlockIO Metrics
*/
blockIOReadBytes = prometheus.NewDesc(
"docker_container_block_io_read_bytes",
"Block I/O read bytes total",
[]string{"name"},
nil,
)
blockIOWriteBytes = prometheus.NewDesc(
"docker_container_block_io_write_bytes",
"Block I/O write bytes total",
[]string{"name"},
nil,
)
/*
PIDs Metrics
*/
pidsCurrent = prometheus.NewDesc(
"docker_container_pids_current",
"Current number of pids",
[]string{"name"},
nil,
)
)