Skip to content

Commit

Permalink
Merge pull request #208 from linkernetworks/phstsai/VX-235
Browse files Browse the repository at this point in the history
[Task] VX-235: Get the dpdk interface in node-exporter
  • Loading branch information
Hung-Wei Chiu authored Aug 1, 2018
2 parents f35655f + b672316 commit e5b8d29
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 41 deletions.
74 changes: 36 additions & 38 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -857,87 +857,80 @@ Response Data:
{
"name": "cni0",
"default": false,
"dpdk": false,
"type": "virtual",
"pciID": ""
},
{
"name": "docker0",
"default": false,
"dpdk": false,
"type": "virtual",
"pciID": ""
},
{
"name": "enp0s8",
"default": false,
"type": "physical",
"pciID": "0000:00:08.0"
},
{
"name": "flannel.1",
"default": false,
"type": "virtual",
"pciID": ""
},
{
"name": "lo",
"name": "dpdk0",
"default": false,
"dpdk": true,
"type": "virtual",
"pciID": ""
"pciID": "0000:00:11.0"
},
{
"name": "veth0756b817",
"name": "dpdk1",
"default": false,
"dpdk": true,
"type": "virtual",
"pciID": ""
"pciID": "0000:00:12.0"
},
{
"name": "veth0ee29e7",
"name": "enp0s10",
"default": false,
"type": "virtual",
"pciID": ""
"dpdk": false,
"type": "physical",
"pciID": "0000:00:0a.0"
},
{
"name": "veth1fd22c92",
"name": "enp0s16",
"default": false,
"type": "virtual",
"pciID": ""
"dpdk": false,
"type": "physical",
"pciID": "0000:00:10.0"
},
{
"name": "veth22ed2ac7",
"name": "enp0s8",
"default": false,
"type": "virtual",
"pciID": ""
"dpdk": false,
"type": "physical",
"pciID": "0000:00:08.0"
},
{
"name": "veth256ca549",
"name": "enp0s9",
"default": false,
"type": "virtual",
"pciID": ""
"dpdk": false,
"type": "physical",
"pciID": "0000:00:09.0"
},
{
"name": "veth7da58df2",
"name": "flannel.1",
"default": false,
"dpdk": false,
"type": "virtual",
"pciID": ""
},
{
"name": "vethbd37bcbc",
"name": "lo",
"default": false,
"dpdk": false,
"type": "virtual",
"pciID": ""
},
{
"name": "vethddeea13c",
"name": "veth67bb7a60",
"default": false,
"dpdk": false,
"type": "virtual",
"pciID": ""
},
{
"name": "enp0s3",
"default": true,
"type": "physical",
"pciID": "0000:00:03.0"
}
} ...
]
}
```
Expand Down Expand Up @@ -1002,6 +995,11 @@ Response Data:
],
"nics": {
"eth0": {
"default": false,
"dpdk": false,
"type": "virtual",
"ip": "10.244.0.1/24",
"pciID": "",
"nicNetworkTraffic": {
"receiveBytesTotal": [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
image:
tag: latest
tag: 1.0.0
2 changes: 1 addition & 1 deletion deploy/helm/apps/charts/prometheus/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ kube-state-metrics:
tag: develop
node-exporter:
image:
tag: develop
tag: 1.0.0

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ spec:
serviceAccountName: prometheus
containers:
- name: node-exporter
image: sdnvortex/node-exporter:latest
image: sdnvortex/node-exporter:1.0.0
ports:
- name: http-metrics
containerPort: 9100
Expand Down
2 changes: 2 additions & 0 deletions src/entity/metrics_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type NICNetworkTrafficMetrics struct {
// NICMetrics is the structure for NIC metrics
type NICMetrics struct {
Default bool `json:"default"`
DPDK bool `json:"dpdk"`
Type string `json:"type"`
IP string `json:"ip"`
PCIID string `json:"pciID"`
Expand All @@ -29,6 +30,7 @@ type NICMetrics struct {
type NICOverviewMetrics struct {
Name string `json:"name"`
Default bool `json:"default"`
DPDK bool `json:"dpdk"`
Type string `json:"type"`
PCIID string `json:"pciID"`
}
Expand Down
10 changes: 10 additions & 0 deletions src/prometheuscontroller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ func ListNodeNICs(sp *serviceprovider.Container, id string) (entity.NodeNICsMetr
return nicList, err
}
nic.Default = defaultValue
dpdkValue, err := strconv.ParseBool(string(result.Metric["dpdk"]))
if err != nil {
return nicList, err
}
nic.DPDK = dpdkValue

nicList.NICs = append(nicList.NICs, nic)
}
Expand Down Expand Up @@ -588,6 +593,11 @@ func GetNode(sp *serviceprovider.Container, id string) (entity.NodeMetrics, erro
return node, err
}
nic.Default = defaultValue
dpdkValue, err := strconv.ParseBool(string(result.Metric["dpdk"]))
if err != nil {
return node, err
}
nic.DPDK = dpdkValue
nic.Type = string(result.Metric["type"])
nic.IP = string(result.Metric["ip_address"])
nic.PCIID = string(result.Metric["pci_id"])
Expand Down

0 comments on commit e5b8d29

Please sign in to comment.