-
Notifications
You must be signed in to change notification settings - Fork 109
/
nodeinfo_api.go
51 lines (46 loc) · 1.61 KB
/
nodeinfo_api.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
package collector
// NodeInfoResponse type
type NodeInfoResponse struct {
Host string `json:"host"`
Version string `json:"version"`
HTTPAddress string `json:"http_address"`
ID string `json:"id"`
Name string `json:"name"`
Pipeline struct {
Workers int `json:"workers"`
BatchSize int `json:"batch_size"`
BatchDelay int `json:"batch_delay"`
ConfigReloadAutomatic bool `json:"config_reload_automatic"`
ConfigReloadInterval int `json:"config_reload_interval"`
} `json:"pipeline"`
Os struct {
Name string `json:"name"`
Arch string `json:"arch"`
Version string `json:"version"`
AvailableProcessors int `json:"available_processors"`
} `json:"os"`
Jvm struct {
Pid int `json:"pid"`
Version string `json:"version"`
VMName string `json:"vm_name"`
VMVersion string `json:"vm_version"`
VMVendor string `json:"vm_vendor"`
StartTimeInMillis int64 `json:"start_time_in_millis"`
Mem struct {
HeapInitInBytes int `json:"heap_init_in_bytes"`
HeapMaxInBytes int `json:"heap_max_in_bytes"`
NonHeapInitInBytes int `json:"non_heap_init_in_bytes"`
NonHeapMaxInBytes int `json:"non_heap_max_in_bytes"`
} `json:"mem"`
GcCollectors []string `json:"gc_collectors"`
} `json:"jvm"`
}
// NodeInfo function
func NodeInfo(endpoint string) (NodeInfoResponse, error) {
var response NodeInfoResponse
handler := &HTTPHandler{
Endpoint: endpoint + "/_node",
}
err := getMetrics(handler, &response)
return response, err
}