Skip to content

Commit db83d01

Browse files
zexiQiu Jian
andauthored
Automated cherry pick of #21692: fix: complete monitor metrics (#21695)
* fix: complete monitor metrics * fix(monitor): remove container related metrics --------- Co-authored-by: Qiu Jian <[email protected]>
1 parent c8510d0 commit db83d01

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+3783
-468
lines changed

pkg/hostman/guestfs/fsdriver/linux_init.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ After=local-fs.target
6969
After=network.target
7070
7171
[Service]
72+
LimitNOFILE=65535
73+
CapabilityBoundingSet=CAP_NET_RAW
74+
AmbientCapabilities=CAP_NET_RAW
7275
ExecStart=%s
7376
RemainAfterExit=true
7477
Type=%s

pkg/hostman/system_service/telegraf.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ func (s *STelegraf) GetConfig(kwargs map[string]interface{}) string {
196196
conf += "[[inputs.smart]]\n"
197197
conf += " path=\"/usr/sbin/smartctl\"\n"
198198
conf += "\n"
199+
conf += "[[inputs.sensors]]\n"
200+
conf += "\n"
199201
conf += "[[inputs.net]]\n"
200202
if nics, ok := kwargs["nics"]; ok {
201203
ns, _ := nics.([]map[string]interface{})
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
// Copyright 2019 Yunion
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package measurements
16+
17+
var All = []SMeasurement{
18+
bond,
19+
bondSlave,
20+
21+
cpu,
22+
disk,
23+
diskio,
24+
linuxSysctlFs,
25+
mem,
26+
net,
27+
netint,
28+
nvidia,
29+
processes,
30+
radeontop,
31+
system,
32+
vasmi,
33+
34+
vmCpu,
35+
vmMem,
36+
vmDisk,
37+
vmDiskio,
38+
vmNetio,
39+
40+
cloudAccount,
41+
42+
dcsRedisCpu,
43+
dcsRedisMem,
44+
dcsRedisNetio,
45+
dcsRedisConn,
46+
dcsRedisInstanceOpt,
47+
dcsRedisCachekeys,
48+
dcsRedisDatamem,
49+
50+
haproxy,
51+
52+
internalAgent,
53+
internalGather,
54+
internalMemstats,
55+
internalWrite,
56+
57+
jenkinsNode,
58+
jenkinsJob,
59+
60+
k8sPod,
61+
k8sDeploy,
62+
k8sNode,
63+
64+
kernel,
65+
kernelVmstat,
66+
67+
mysql,
68+
69+
netstat,
70+
71+
ntpq,
72+
73+
ossLatency,
74+
ossNetio,
75+
ossReq,
76+
77+
ping,
78+
79+
rabbitmqOverview,
80+
rabbitmqNode,
81+
rabbitmqQueue,
82+
83+
rdsConn,
84+
rdsCpu,
85+
rdsMem,
86+
rdsNetio,
87+
rdsDisk,
88+
89+
redis,
90+
redisKeyspace,
91+
92+
sensors,
93+
94+
smartctl,
95+
96+
storage,
97+
98+
swap,
99+
100+
temp,
101+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// Copyright 2019 Yunion
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package measurements
16+
17+
import "yunion.io/x/onecloud/pkg/apis/monitor"
18+
19+
var bond = SMeasurement{
20+
Context: []SMonitorContext{
21+
{
22+
Name: "bond",
23+
DisplayName: "Bond interface",
24+
ResourceType: monitor.METRIC_RES_TYPE_HOST,
25+
Database: monitor.METRIC_DATABASE_TELE,
26+
},
27+
},
28+
Metrics: []SMetric{
29+
{
30+
Name: "active_slave",
31+
DisplayName: "used SNAT port count",
32+
Unit: monitor.METRIC_UNIT_COUNT,
33+
},
34+
{
35+
Name: "status",
36+
DisplayName: "Status of bond interface (down = 0, up = 1)",
37+
Unit: monitor.METRIC_UNIT_NULL,
38+
},
39+
},
40+
}
41+
42+
var bondSlave = SMeasurement{
43+
Context: []SMonitorContext{
44+
{
45+
Name: "bond_slave",
46+
DisplayName: "Slave interfaces of bond interface",
47+
ResourceType: monitor.METRIC_RES_TYPE_HOST,
48+
Database: monitor.METRIC_DATABASE_TELE,
49+
},
50+
},
51+
Metrics: []SMetric{
52+
{
53+
Name: "status",
54+
DisplayName: "Status of bonds's slave interface (down = 0, up = 1)",
55+
Unit: monitor.METRIC_UNIT_NULL,
56+
},
57+
{
58+
Name: "failures",
59+
DisplayName: "Amount of failures for bond's slave interface",
60+
Unit: monitor.METRIC_UNIT_COUNT,
61+
},
62+
},
63+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright 2019 Yunion
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package measurements
16+
17+
import "yunion.io/x/onecloud/pkg/apis/monitor"
18+
19+
var cloudAccount = SMeasurement{
20+
Context: []SMonitorContext{
21+
{
22+
"cloudaccount_balance", "Cloud account balance",
23+
monitor.METRIC_RES_TYPE_CLOUDACCOUNT,
24+
monitor.METRIC_DATABASE_METER,
25+
},
26+
},
27+
Metrics: []SMetric{
28+
{
29+
"balance", "balance", monitor.METRIC_UNIT_NULL,
30+
},
31+
},
32+
}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
// Copyright 2019 Yunion
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package measurements
16+
17+
import "yunion.io/x/onecloud/pkg/apis/monitor"
18+
19+
var cpu = SMeasurement{
20+
Context: []SMonitorContext{
21+
{
22+
Name: "cpu",
23+
DisplayName: "CPU usage",
24+
ResourceType: monitor.METRIC_RES_TYPE_HOST,
25+
Database: monitor.METRIC_DATABASE_TELE,
26+
},
27+
{
28+
Name: "agent_cpu",
29+
DisplayName: "CPU usage",
30+
ResourceType: monitor.METRIC_RES_TYPE_AGENT,
31+
Database: monitor.METRIC_DATABASE_TELE,
32+
},
33+
},
34+
Metrics: []SMetric{
35+
{
36+
Name: "usage_active",
37+
DisplayName: "CPU active state utilization rate",
38+
Unit: monitor.METRIC_UNIT_PERCENT,
39+
},
40+
{
41+
Name: "usage_idle",
42+
DisplayName: "CPU idle state utilization rate",
43+
Unit: monitor.METRIC_UNIT_PERCENT,
44+
},
45+
{
46+
Name: "usage_system",
47+
DisplayName: "CPU system state utilization rate",
48+
Unit: monitor.METRIC_UNIT_PERCENT,
49+
},
50+
{
51+
Name: "usage_user",
52+
DisplayName: "CPU user mode utilization rate",
53+
Unit: monitor.METRIC_UNIT_PERCENT,
54+
},
55+
{
56+
Name: "usage_iowait",
57+
DisplayName: "CPU IO usage",
58+
Unit: monitor.METRIC_UNIT_PERCENT,
59+
},
60+
{
61+
Name: "usage_irq",
62+
DisplayName: "CPU IRQ usage",
63+
Unit: monitor.METRIC_UNIT_PERCENT,
64+
},
65+
{
66+
Name: "usage_guest",
67+
DisplayName: "CPU guest usage",
68+
Unit: monitor.METRIC_UNIT_PERCENT,
69+
},
70+
{
71+
Name: "usage_nice",
72+
DisplayName: "CPU priority switch utilization",
73+
Unit: monitor.METRIC_UNIT_PERCENT,
74+
},
75+
{
76+
Name: "usage_softirq",
77+
DisplayName: "CPU softirq usage",
78+
Unit: monitor.METRIC_UNIT_PERCENT,
79+
},
80+
{
81+
Name: "usage_steal",
82+
DisplayName: "CPU steal usage",
83+
Unit: monitor.METRIC_UNIT_PERCENT,
84+
},
85+
{
86+
Name: "usage_guest_nice",
87+
DisplayName: "CPU guest nice usage",
88+
Unit: monitor.METRIC_UNIT_PERCENT,
89+
},
90+
},
91+
}

0 commit comments

Comments
 (0)