-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathmetrics.go
57 lines (48 loc) · 1.53 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
package main
import "github.com/prometheus/client_golang/prometheus"
func addMetrics() map[string]*prometheus.GaugeVec {
gaugeVecs := make(map[string]*prometheus.GaugeVec)
// Node Metrics
gaugeVecs["nodes"] = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Namespace: namespace,
Name: "node_status",
Help: "status of node reported by kubernates",
}, []string{
"name",
"nodeState",
"osImage",
"containerRuntimeVersion",
"kubeletVersion",
"operatingSystem",
"architecture",
"hostname",
"externalIp",
"internalIp",
})
gaugeVecs["components"] = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Namespace: namespace,
Name: "component_status",
Help: "status of kubenetes component reported by kubernates",
}, []string{"name", "namespace"})
gaugeVecs["stacks"] = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Namespace: namespace,
Name: "stacks_status",
Help: "status of stacks reported by kubernates",
}, []string{"name", "namespace"})
gaugeVecs["controller"] = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Namespace: namespace,
Name: "controller_status",
Help: "status of kubernetest controller",
}, []string{"name", "namespace", "type"})
gaugeVecs["pods"] = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Namespace: namespace,
Name: "pod_status",
Help: "status of pod reported by kubernates",
}, []string{"name", "namespace", "podPhase", "hostIP", "podIP", "reason", "message", "containerCount"})
return gaugeVecs
}