mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/yunionio/cloudpods.git
synced 2026-09-20 08:03:53 +08:00
Compare commits
223 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c74fe459c | ||
|
|
f239e34d1b | ||
|
|
9c733ff130 | ||
|
|
aacdf17099 | ||
|
|
07f6572159 | ||
|
|
234741d0c4 | ||
|
|
e842e970ba | ||
|
|
acbbb6d6f5 | ||
|
|
3769869a08 | ||
|
|
4b0bdcfe8b | ||
|
|
9151709473 | ||
|
|
fb0645e837 | ||
|
|
cfa36774e7 | ||
|
|
b4516df1a4 | ||
|
|
6ccd2801f0 | ||
|
|
0baca192e3 | ||
|
|
fe7cbbfee8 | ||
|
|
fdbf01e158 | ||
|
|
e86e4d64e4 | ||
|
|
fc916a22f2 | ||
|
|
2887c8196f | ||
|
|
3e7a321ad3 | ||
|
|
dcf7bde095 | ||
|
|
9b2208a565 | ||
|
|
4dad40e3b2 | ||
|
|
4142d03cce | ||
|
|
39bcd4c471 | ||
|
|
9ad72f63f2 | ||
|
|
5150d3d86d | ||
|
|
47024114c6 | ||
|
|
34266ad52e | ||
|
|
8e942046e6 | ||
|
|
b3afdc7b93 | ||
|
|
08411e3061 | ||
|
|
d08864d9e7 | ||
|
|
62362a1887 | ||
|
|
167d3d25e8 | ||
|
|
a92e4d72a2 | ||
|
|
4d6490e7a1 | ||
|
|
807631b7ca | ||
|
|
be9bd32824 | ||
|
|
8742ba05d5 | ||
|
|
8271d86911 | ||
|
|
04ac34755c | ||
|
|
3e6d9f0a59 | ||
|
|
2fea602ecd | ||
|
|
31540c1feb | ||
|
|
c66e16190b | ||
|
|
8b3f7ef336 | ||
|
|
57005da632 | ||
|
|
68a98c8eb6 | ||
|
|
8dd802204f | ||
|
|
043b24cca1 | ||
|
|
4534f951b1 | ||
|
|
02447ea1f9 | ||
|
|
3b64b8709e | ||
|
|
117c5d60f4 | ||
|
|
5c9016bd0c | ||
|
|
c8c80dc95d | ||
|
|
43154ddc00 | ||
|
|
60d45f698b | ||
|
|
a7ee027326 | ||
|
|
b98983a2df | ||
|
|
1b50d263c4 | ||
|
|
24a3ff8fa9 | ||
|
|
6d2e8fdfc1 | ||
|
|
6a9dc28b72 | ||
|
|
de65b32a47 | ||
|
|
e715a725db | ||
|
|
6119e60c46 | ||
|
|
20b7b9b9f6 | ||
|
|
7d0a88a605 | ||
|
|
0516f72f46 | ||
|
|
c4f0cb4dcd | ||
|
|
f8ef56cf38 | ||
|
|
aa99aa449e | ||
|
|
386467927a | ||
|
|
f9281c738d | ||
|
|
ed8af7fc6f | ||
|
|
077390519d | ||
|
|
791e0753c4 | ||
|
|
ad0d7fde15 | ||
|
|
59780e863d | ||
|
|
fec651c425 | ||
|
|
968cd4e6ff | ||
|
|
ee78115b44 | ||
|
|
dac5f69abe | ||
|
|
309c69dcfd | ||
|
|
12cbc9c697 | ||
|
|
8b3bb04adc | ||
|
|
cc56f30de8 | ||
|
|
f0d7c4ea09 | ||
|
|
5b54fe3256 | ||
|
|
4dd3a6a163 | ||
|
|
32931791cf | ||
|
|
6c680c9294 | ||
|
|
7db9a50f79 | ||
|
|
bf98f587b8 | ||
|
|
9f9e5361f3 | ||
|
|
201443dcec | ||
|
|
034c743ba6 | ||
|
|
2dca05c9c2 | ||
|
|
2462128a32 | ||
|
|
6d6e46083d | ||
|
|
a0efef4c4d | ||
|
|
5cd9d07115 | ||
|
|
c9fa13c63b | ||
|
|
9379930c21 | ||
|
|
0a1307bb4d | ||
|
|
905dc803b9 | ||
|
|
a7824c6e42 | ||
|
|
ce6d4da16b | ||
|
|
fdfd9ad858 | ||
|
|
f68f09f067 | ||
|
|
44fc286a9c | ||
|
|
3491ebdcb9 | ||
|
|
409dd98850 | ||
|
|
21b831252d | ||
|
|
26c351796f | ||
|
|
7b78f205a9 | ||
|
|
ea99da1fb5 | ||
|
|
b13417cba2 | ||
|
|
3a573a2242 | ||
|
|
7554a59eea | ||
|
|
16d3cdc7aa | ||
|
|
f272e65780 | ||
|
|
5d6a431902 | ||
|
|
a9c27a2273 | ||
|
|
7cbf045638 | ||
|
|
1de4e19670 | ||
|
|
e8228e4e3c | ||
|
|
077fd3f891 | ||
|
|
4975acb914 | ||
|
|
85c5e33cf9 | ||
|
|
6671cf9fab | ||
|
|
6e987b0ba7 | ||
|
|
c9b3a4e95c | ||
|
|
6a0b463874 | ||
|
|
cfa1f8d3a1 | ||
|
|
91b1236e3f | ||
|
|
586fb7f7cf | ||
|
|
8fee86088b | ||
|
|
77f0dcb4c8 | ||
|
|
0e215facb9 | ||
|
|
4bfabe8c01 | ||
|
|
eb079f2dc0 | ||
|
|
24acccc0bf | ||
|
|
ae43d31287 | ||
|
|
5a113a4078 | ||
|
|
43450da351 | ||
|
|
64612c0f61 | ||
|
|
d3a8fa1315 | ||
|
|
70d67f9b0d | ||
|
|
1c0b7be8f7 | ||
|
|
1f4f93c518 | ||
|
|
3fa9918f3d | ||
|
|
c6d0a96db9 | ||
|
|
5d490741a0 | ||
|
|
fffbab915b | ||
|
|
3b93dfdd98 | ||
|
|
97df9f264d | ||
|
|
de1d772814 | ||
|
|
489d75a5ed | ||
|
|
9c2203a73d | ||
|
|
64d0e84d73 | ||
|
|
dd08d21b82 | ||
|
|
0b2a20f06b | ||
|
|
a869940020 | ||
|
|
30d1798767 | ||
|
|
60f868b259 | ||
|
|
e31524bc5d | ||
|
|
c7fc21fe79 | ||
|
|
93193e0170 | ||
|
|
c051f8f27e | ||
|
|
f9aade9c97 | ||
|
|
338f814cbc | ||
|
|
0b984efb97 | ||
|
|
982f4fa909 | ||
|
|
965ba3ee77 | ||
|
|
9b2b4141ad | ||
|
|
b8e1a841f1 | ||
|
|
16fbba70c8 | ||
|
|
0ca039b3ae | ||
|
|
b58bcf5a74 | ||
|
|
3e14278698 | ||
|
|
866facb6c1 | ||
|
|
4b442acb68 | ||
|
|
37f59cc9eb | ||
|
|
9c097bddc1 | ||
|
|
098b65c25d | ||
|
|
551b7dcc73 | ||
|
|
f6a9a12b6a | ||
|
|
24fb95b01b | ||
|
|
4113a0fb24 | ||
|
|
b8ad367a8c | ||
|
|
a09bcb6667 | ||
|
|
b5238c42ac | ||
|
|
760a53ac30 | ||
|
|
f32e044737 | ||
|
|
e274120935 | ||
|
|
8c1ca83b23 | ||
|
|
be400a0e6e | ||
|
|
585fa7bd35 | ||
|
|
b1a5ccd153 | ||
|
|
404fe5eaf7 | ||
|
|
0b3d196bfd | ||
|
|
04902ddd20 | ||
|
|
37cc198f81 | ||
|
|
282cfb079f | ||
|
|
02359b0bf8 | ||
|
|
3a0e3140dc | ||
|
|
82fd9c0a7e | ||
|
|
1a7cd22bb8 | ||
|
|
07ece80f42 | ||
|
|
95c836bed5 | ||
|
|
1d75cff5b4 | ||
|
|
c524d488a9 | ||
|
|
dcd06f7c94 | ||
|
|
683bc536bd | ||
|
|
898e62c42c | ||
|
|
5e9dafe4a8 | ||
|
|
19b2bbc88a | ||
|
|
ec3b2c321e |
15
Makefile
15
Makefile
@@ -241,6 +241,21 @@ y18n-check:
|
||||
|
||||
.PHONY: y18n-check
|
||||
|
||||
define hostdeployer-grpc-gen
|
||||
set -o errexit; \
|
||||
set -o pipefail; \
|
||||
protoc -I pkg/hostman/hostdeployer/apis \
|
||||
--go_out=pkg/hostman/hostdeployer/apis \
|
||||
--go_opt=paths=source_relative \
|
||||
--go-grpc_out=pkg/hostman/hostdeployer/apis \
|
||||
--go-grpc_opt=paths=source_relative \
|
||||
pkg/hostman/hostdeployer/apis/deploy.proto
|
||||
|
||||
endef
|
||||
|
||||
hostdeployer-grpc-gen:
|
||||
$(hostdeployer-grpc-gen)
|
||||
|
||||
check: fmt-check
|
||||
check: gendocgo-check
|
||||
check: goimports-check
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/host-deployer-base:1.1
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/host-deployer-base:1.2
|
||||
|
||||
MAINTAINER "Yaoqi Wan wanyaoqi@yunionyun.com"
|
||||
|
||||
|
||||
@@ -15,7 +15,10 @@
|
||||
package cloudid
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/cloudid"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options/cloudid"
|
||||
)
|
||||
@@ -35,4 +38,10 @@ func init() {
|
||||
cmd.Perform("reset-password", &cloudid.ClouduserResetPasswordOptions{})
|
||||
cmd.Perform("cloud-user-join-group", &cloudid.ClouduserGroupOptions{})
|
||||
cmd.Perform("cloud-user-leave-group", &cloudid.ClouduserGroupOptions{})
|
||||
cmd.GetWithCustomShow("access-keys", func(result jsonutils.JSONObject) {
|
||||
ret := modulebase.JSON2ListResult(result)
|
||||
shell.PrintList(ret, nil)
|
||||
}, &cloudid.ClouduserListAccessKeyInput{})
|
||||
cmd.Perform("delete-access-key", &cloudid.ClouduserDeleteAccessKeyInput{})
|
||||
cmd.Perform("create-access-key", &cloudid.ClouduserCreateAccessKeyInput{})
|
||||
}
|
||||
|
||||
@@ -17,69 +17,90 @@ package compute
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type BaremetalAgentListOptions struct {
|
||||
options.BaseListOptions
|
||||
}
|
||||
R(&BaremetalAgentListOptions{}, "agent-list", "List all agent", func(s *mcclient.ClientSession, args *BaremetalAgentListOptions) error {
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
result, err := modules.Baremetalagents.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printList(result, modules.Baremetalagents.GetColumns(s))
|
||||
return nil
|
||||
})
|
||||
|
||||
type BaremetalAgentOpsOperations struct {
|
||||
ID string `help:"ID or name of agent"`
|
||||
}
|
||||
R(&BaremetalAgentOpsOperations{}, "agent-show", "Show details of an agent", func(s *mcclient.ClientSession, args *BaremetalAgentOpsOperations) error {
|
||||
result, err := modules.Baremetalagents.Get(s, args.ID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&BaremetalAgentOpsOperations{}, "agent-enable", "Enable agent", func(s *mcclient.ClientSession, args *BaremetalAgentOpsOperations) error {
|
||||
result, err := modules.Baremetalagents.PerformAction(s, args.ID, "enable", nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&BaremetalAgentOpsOperations{}, "agent-disable", "Disable agent", func(s *mcclient.ClientSession, args *BaremetalAgentOpsOperations) error {
|
||||
result, err := modules.Baremetalagents.PerformAction(s, args.ID, "disable", nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&BaremetalAgentOpsOperations{}, "agent-delete", "Delete agent", func(s *mcclient.ClientSession, args *BaremetalAgentOpsOperations) error {
|
||||
result, err := modules.Baremetalagents.Delete(s, args.ID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
type AgentListOptions struct {
|
||||
options.BaseListOptions
|
||||
}
|
||||
|
||||
func (o AgentListOptions) Params() (jsonutils.JSONObject, error) {
|
||||
return o.BaseListOptions.Params()
|
||||
}
|
||||
|
||||
func (o AgentListOptions) Description() string {
|
||||
return "List all agent"
|
||||
}
|
||||
|
||||
type AgentOpsOperations struct {
|
||||
ID string `help:"ID or name of agent"`
|
||||
}
|
||||
|
||||
func (o AgentOpsOperations) GetId() string {
|
||||
return o.ID
|
||||
}
|
||||
|
||||
func (o AgentOpsOperations) Params() (jsonutils.JSONObject, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
type AgentShowOpt struct {
|
||||
AgentOpsOperations
|
||||
}
|
||||
|
||||
func (o AgentShowOpt) Description() string {
|
||||
return "Show details of an agent"
|
||||
}
|
||||
|
||||
type AgentEnableOpt struct {
|
||||
AgentOpsOperations
|
||||
}
|
||||
|
||||
func (o AgentEnableOpt) Description() string {
|
||||
return "Enable agent"
|
||||
}
|
||||
|
||||
type AgentDisableOpt struct {
|
||||
AgentOpsOperations
|
||||
}
|
||||
|
||||
func (o AgentDisableOpt) Description() string {
|
||||
return "Disable agent"
|
||||
}
|
||||
|
||||
type AgentDeleteOpt struct {
|
||||
AgentOpsOperations
|
||||
}
|
||||
|
||||
func (o AgentDeleteOpt) Description() string {
|
||||
return "Delete agent"
|
||||
}
|
||||
|
||||
type AgentEnableImageCacheOpt struct {
|
||||
AgentOpsOperations
|
||||
}
|
||||
|
||||
func (o AgentEnableImageCacheOpt) Description() string {
|
||||
return "Enable cache image of a agent"
|
||||
}
|
||||
|
||||
type AgentDisableImageCacheOpt struct {
|
||||
AgentOpsOperations
|
||||
}
|
||||
|
||||
func (o AgentDisableImageCacheOpt) Description() string {
|
||||
return "Disable cache image of a agent"
|
||||
}
|
||||
|
||||
func init() {
|
||||
cmd := shell.NewResourceCmd(&modules.Baremetalagents).WithKeyword("agent")
|
||||
cmd.List(new(AgentListOptions))
|
||||
cmd.Show(new(AgentShowOpt))
|
||||
cmd.Perform("enable", new(AgentEnableOpt))
|
||||
cmd.Perform("disable", new(AgentDisableOpt))
|
||||
cmd.Perform("enable-image-cache", new(AgentEnableImageCacheOpt))
|
||||
cmd.Perform("disable-image-cache", new(AgentDisableImageCacheOpt))
|
||||
cmd.Delete(new(AgentDeleteOpt))
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ func init() {
|
||||
return
|
||||
}
|
||||
for k, v := range rc {
|
||||
fmt.Printf(`export %s="%s"`+"\n", k, v)
|
||||
fmt.Printf(`export %s='%s'`+"\n", k, v)
|
||||
}
|
||||
}, &options.BaseIdOptions{})
|
||||
cmd.Get("storage-classes", &compute.CloudproviderStorageClassesOptions{})
|
||||
|
||||
31
cmd/climc/shell/compute/modelarts_pool.go
Normal file
31
cmd/climc/shell/compute/modelarts_pool.go
Normal file
@@ -0,0 +1,31 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options/compute"
|
||||
)
|
||||
|
||||
func init() {
|
||||
cmd := shell.NewResourceCmd(&modules.ModelartsPools).WithKeyword("modelarts-pool")
|
||||
cmd.List(&compute.ModelartsPoolListOptions{})
|
||||
cmd.Delete(&options.BaseIdOptions{})
|
||||
cmd.Create(&compute.ModelartsPoolCreateOption{})
|
||||
cmd.Perform("syncstatus", &compute.ModelartsPoolSyncstatusOption{})
|
||||
cmd.Perform("change-config", &compute.ModelartsPoolChangeConfigOption{})
|
||||
}
|
||||
26
cmd/climc/shell/compute/modelarts_pool_sku.go
Normal file
26
cmd/climc/shell/compute/modelarts_pool_sku.go
Normal file
@@ -0,0 +1,26 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options/compute"
|
||||
)
|
||||
|
||||
func init() {
|
||||
cmd := shell.NewResourceCmd(&modules.ModelartsPoolSku).WithKeyword("modelarts-pool-sku")
|
||||
cmd.List(&compute.ModelartsPoolSkuListOptions{})
|
||||
}
|
||||
@@ -66,6 +66,8 @@ func init() {
|
||||
cmd.PrintObjectYAML().Perform("migrate-forecast", new(options.ServerMigrateForecastOptions))
|
||||
cmd.Perform("migrate", new(options.ServerMigrateOptions))
|
||||
cmd.Perform("live-migrate", new(options.ServerLiveMigrateOptions))
|
||||
cmd.BatchPerform("cancel-live-migrate", new(options.ServerIdsOptions))
|
||||
cmd.Perform("set-live-migrate-params", new(options.ServerSetLiveMigrateParamsOptions))
|
||||
cmd.Perform("modify-src-check", new(options.ServerModifySrcCheckOptions))
|
||||
cmd.Perform("set-secgroup", new(options.ServerSecGroupsOptions))
|
||||
cmd.Perform("add-secgroup", new(options.ServerSecGroupsOptions))
|
||||
@@ -105,6 +107,10 @@ func init() {
|
||||
cmd.Perform("calculate-record-checksum", &options.ServerIdOptions{})
|
||||
cmd.Perform("set-class-metadata", &baseoptions.ResourceMetadataOptions{})
|
||||
cmd.BatchPerform("enable-memclean", new(options.ServerIdsOptions))
|
||||
cmd.Perform("qga-set-password", &options.ServerQgaSetPassword{})
|
||||
cmd.Perform("qga-command", &options.ServerQgaCommand{})
|
||||
cmd.Perform("set-password", &options.ServerSetPasswordOptions{})
|
||||
cmd.Perform("monitor", &options.ServerMonitorOptions{})
|
||||
|
||||
cmd.Get("vnc", new(options.ServerIdOptions))
|
||||
cmd.Get("desc", new(options.ServerIdOptions))
|
||||
@@ -306,23 +312,6 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.ServerMonitorOptions{}, "server-monitor", "Send commands to qemu monitor", func(s *mcclient.ClientSession, opts *options.ServerMonitorOptions) error {
|
||||
params, err := baseoptions.StructToParams(opts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ret, err := modules.Servers.PerformAction(s, opts.ID, "monitor", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
result, err := ret.GetString("results")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Println(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
type ServerDiskSnapshotOptions struct {
|
||||
SERVER string `help:"server ID or Name"`
|
||||
DISK string `help:"create snapshot disk id"`
|
||||
@@ -700,10 +689,11 @@ func init() {
|
||||
})
|
||||
|
||||
type ServerQemuParams struct {
|
||||
ID string `help:"ID or name of VM"`
|
||||
DisableIsaSerial string `help:"disable isa serial device" choices:"true|false"`
|
||||
DisablePvpanic string `help:"disable pvpanic device" choices:"true|false"`
|
||||
DisableUsbKbd string `help:"disable usb kbd" choices:"true|false"`
|
||||
ID string `help:"ID or name of VM"`
|
||||
DisableIsaSerial string `help:"disable isa serial device" choices:"true|false"`
|
||||
DisablePvpanic string `help:"disable pvpanic device" choices:"true|false"`
|
||||
DisableUsbKbd string `help:"disable usb kbd" choices:"true|false"`
|
||||
UsbControllerType string `help:"usb controller type" choices:"usb-ehci|qemu-xhci"`
|
||||
}
|
||||
|
||||
R(&ServerQemuParams{}, "server-set-qemu-params", "config qemu params", func(s *mcclient.ClientSession,
|
||||
@@ -718,6 +708,9 @@ func init() {
|
||||
if len(opts.DisableUsbKbd) > 0 {
|
||||
params.Set("disable_usb_kbd", jsonutils.NewString(opts.DisableUsbKbd))
|
||||
}
|
||||
if len(opts.UsbControllerType) > 0 {
|
||||
params.Set("usb_controller_type", jsonutils.NewString(opts.UsbControllerType))
|
||||
}
|
||||
result, err := modules.Servers.PerformAction(s, opts.ID, "set-qemu-params", params)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -74,6 +74,10 @@ func doMonitorEventList(s *mcclient.ClientSession, args *EventListOptions) error
|
||||
return DoEventList(modules.MonitorLogs, s, args)
|
||||
}
|
||||
|
||||
func doNotifyEventList(s *mcclient.ClientSession, args *EventListOptions) error {
|
||||
return DoEventList(modules.NotifyLogs, s, args)
|
||||
}
|
||||
|
||||
func DoEventList(man modulebase.ResourceManager, s *mcclient.ClientSession, args *EventListOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
if len(args.Type) > 0 {
|
||||
@@ -262,4 +266,9 @@ func init() {
|
||||
nargs := EventListOptions{BaseEventListOptions: args.BaseEventListOptions, Id: args.ID, Type: []string{"migrationalert"}}
|
||||
return doMonitorEventList(s, &nargs)
|
||||
})
|
||||
|
||||
R(&TypeEventListOptions{}, "notification-event", "Show operation event logs of a notification", func(s *mcclient.ClientSession, args *TypeEventListOptions) error {
|
||||
nargs := EventListOptions{BaseEventListOptions: args.BaseEventListOptions, Id: args.ID, Type: []string{"notification"}}
|
||||
return doNotifyEventList(s, &nargs)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ import (
|
||||
func init() {
|
||||
cmd := NewResourceCmd(monitor.Alerts)
|
||||
cmd.List(new(options.AlertListOptions))
|
||||
cmd.Create(new(options.AlertCreateOptions))
|
||||
// cmd.Create(new(options.AlertCreateOptions))
|
||||
cmd.Show(new(options.AlertShowOptions))
|
||||
cmd.Update(new(options.AlertUpdateOptions))
|
||||
cmd.BatchDelete(new(options.AlertDeleteOptions))
|
||||
|
||||
@@ -20,7 +20,8 @@ import (
|
||||
)
|
||||
|
||||
func init() {
|
||||
cmd := NewResourceCmd(modules.CommonAlertManager)
|
||||
cmd := NewResourceCmd(modules.CommonAlerts)
|
||||
cmd.Create(new(options.CommonAlertCreateOptions))
|
||||
cmd.List(new(options.CommonAlertListOptions))
|
||||
cmd.Show(new(options.CommonAlertShowOptions))
|
||||
cmd.Perform("enable", &options.CommonAlertShowOptions{})
|
||||
|
||||
26
cmd/climc/shell/monitor/unifiedmonitor.go
Normal file
26
cmd/climc/shell/monitor/unifiedmonitor.go
Normal file
@@ -0,0 +1,26 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package monitor
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules/monitor"
|
||||
options "yunion.io/x/onecloud/pkg/mcclient/options/monitor"
|
||||
)
|
||||
|
||||
func init() {
|
||||
cmd := shell.NewResourceCmd(monitor.UnifiedMonitorManager).WithKeyword("monitor")
|
||||
cmd.Show(&options.SimpleQueryOptions{})
|
||||
}
|
||||
@@ -1,158 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
"time"
|
||||
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/errors"
|
||||
"yunion.io/x/pkg/util/version"
|
||||
|
||||
_ "yunion.io/x/onecloud/pkg/cloudmon/collectors"
|
||||
"yunion.io/x/onecloud/pkg/cloudmon/options"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
)
|
||||
|
||||
func showErrorAndExit(e error) {
|
||||
fmt.Fprintf(os.Stderr, "%s", e)
|
||||
fmt.Fprintln(os.Stderr)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
func newClientSession(options *options.CloudMonOptions) (*mcclient.ClientSession, error) {
|
||||
if len(options.AuthURL) == 0 {
|
||||
return nil, errors.Error("empty auth_url")
|
||||
}
|
||||
if len(options.AdminUser) == 0 {
|
||||
return nil, errors.Error("empty admin_user")
|
||||
}
|
||||
if len(options.AdminPassword) == 0 {
|
||||
return nil, errors.Error("empty admin_password")
|
||||
}
|
||||
if len(options.AdminProject) == 0 {
|
||||
return nil, errors.Error("empty admin_project")
|
||||
}
|
||||
|
||||
client := mcclient.NewClient(
|
||||
options.AuthURL,
|
||||
options.ReqTimeout,
|
||||
options.Debug,
|
||||
options.Insecure,
|
||||
options.CertFile,
|
||||
options.KeyFile,
|
||||
)
|
||||
|
||||
token, err := client.AuthenticateWithSource(
|
||||
options.AdminUser,
|
||||
options.AdminPassword,
|
||||
options.AdminDomain,
|
||||
options.AdminProject,
|
||||
options.AdminProjectDomain,
|
||||
mcclient.AuthSourceAPI)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
session := client.NewSession(
|
||||
context.Background(),
|
||||
options.Region,
|
||||
"",
|
||||
options.EndpointType,
|
||||
token,
|
||||
)
|
||||
|
||||
return session, nil
|
||||
}
|
||||
|
||||
func TestCron() {
|
||||
parser, err := options.GetArgumentParser()
|
||||
if err != nil {
|
||||
showErrorAndExit(err)
|
||||
}
|
||||
|
||||
err = parser.ParseArgs2(os.Args[1:], false, false)
|
||||
|
||||
opts := parser.Options().(*options.SubCloudMonOptions)
|
||||
|
||||
if opts.Help {
|
||||
fmt.Println(parser.HelpString())
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
if opts.Version {
|
||||
fmt.Println(version.GetJsonString())
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
if len(opts.Config) == 0 {
|
||||
for _, p := range []string{"./etc", "/etc/yunion"} {
|
||||
confTmp := path.Join(p, "cloudmon.conf")
|
||||
if _, err := os.Stat(confTmp); err == nil {
|
||||
opts.Config = confTmp
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(opts.Config) > 0 {
|
||||
err := parser.ParseFile(opts.Config)
|
||||
if err != nil {
|
||||
showErrorAndExit(err)
|
||||
}
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
showErrorAndExit(err)
|
||||
}
|
||||
|
||||
parser.SetDefault()
|
||||
|
||||
subcmd := parser.GetSubcommand()
|
||||
subparser := subcmd.GetSubParser()
|
||||
if err != nil {
|
||||
if subparser != nil {
|
||||
fmt.Print(subparser.Usage())
|
||||
} else {
|
||||
fmt.Print(parser.Usage())
|
||||
}
|
||||
showErrorAndExit(err)
|
||||
}
|
||||
|
||||
suboptions := subparser.Options()
|
||||
if opts.Subcommand == "help" {
|
||||
err = subcmd.Invoke(suboptions)
|
||||
} else {
|
||||
timout := suboptions.(*options.ReportOptions).Timeout
|
||||
endChan := make(chan int, 1)
|
||||
go func() {
|
||||
ticker := time.NewTicker(time.Duration(timout) * time.Second)
|
||||
for {
|
||||
select {
|
||||
case <-ticker.C:
|
||||
log.Errorf("cmd: %s,provider: %v,end due to timeout: %d s", opts.Subcommand,
|
||||
suboptions.(*options.ReportOptions).Provider, suboptions.(*options.ReportOptions).Timeout)
|
||||
os.Exit(3)
|
||||
case <-endChan:
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
var session *mcclient.ClientSession
|
||||
session, err = newClientSession(&opts.CloudMonOptions)
|
||||
if err != nil {
|
||||
showErrorAndExit(err)
|
||||
}
|
||||
err = subcmd.Invoke(session, suboptions)
|
||||
endChan <- 1
|
||||
}
|
||||
if err != nil {
|
||||
showErrorAndExit(err)
|
||||
}
|
||||
}
|
||||
|
||||
//func main() {
|
||||
// TestCron()
|
||||
//}
|
||||
@@ -35,6 +35,8 @@ type BaseOptions struct {
|
||||
Port int `help:"Service port" default:"$VMWARE_PORT" metavar:"VMWARE_PORT"`
|
||||
Account string `help:"VCenter or ESXi Account" default:"$VMWARE_ACCOUNT" metavar:"VMWARE_ACCOUNT"`
|
||||
Password string `help:"Password" default:"$VMWARE_PASSWORD" metavar:"VMWARE_PASSWORD"`
|
||||
Debug bool
|
||||
Format string `choices:"xml|json" default:"json"`
|
||||
SUBCOMMAND string `help:"aliyuncli subcommand" subcommand:"true"`
|
||||
}
|
||||
|
||||
@@ -101,7 +103,7 @@ func newClient(options *BaseOptions) (*esxi.SESXiClient, error) {
|
||||
cloudprovider.ProviderConfig{
|
||||
ProxyFunc: proxyFunc,
|
||||
},
|
||||
),
|
||||
).Debug(options.Debug).Format(options.Format),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ import (
|
||||
type Options struct {
|
||||
Debug bool `help:"Show debug" default:"false"`
|
||||
AccessKey string `help:"Access key" default:"$JDCLOUD_ACCESS_KEY"`
|
||||
AccessSecret string `help:"Secret" default:"$JDCLOUD_ACCESS_SECRET"`
|
||||
AccessSecret string `help:"Secret" default:"$JDCLOUD_SECRET"`
|
||||
RegionId string `help:"RegionId" default:"$JDCLOUD_REGION"`
|
||||
SUBCOMMAND string `help:"jdcloudcli subcommand" subcommand:"true"`
|
||||
}
|
||||
@@ -69,7 +69,7 @@ func showErrorAndExit(e error) {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
func newClient(options *Options) (*jdcloud.SRegion, error) {
|
||||
func newClient(options *Options) (*jdcloud.SJDCloudClient, error) {
|
||||
if len(options.AccessKey) == 0 {
|
||||
return nil, fmt.Errorf("Missing access key")
|
||||
}
|
||||
@@ -91,15 +91,16 @@ func newClient(options *Options) (*jdcloud.SRegion, error) {
|
||||
return cfgProxyFunc(req.URL)
|
||||
}
|
||||
|
||||
cfcg := &cloudprovider.ProviderConfig{
|
||||
cfcg := cloudprovider.ProviderConfig{
|
||||
ProxyFunc: proxyFunc,
|
||||
}
|
||||
|
||||
region := jdcloud.NewRegion(regionId, options.AccessKey, options.AccessSecret, cfcg, options.Debug)
|
||||
if region == nil {
|
||||
return nil, fmt.Errorf("no such region %s", regionId)
|
||||
}
|
||||
return region, nil
|
||||
return jdcloud.NewJDCloudClient(
|
||||
jdcloud.NewJDCloudClientConfig(
|
||||
options.AccessKey,
|
||||
options.AccessSecret,
|
||||
).CloudproviderConfig(cfcg).Debug(options.Debug),
|
||||
)
|
||||
}
|
||||
|
||||
func main() {
|
||||
@@ -134,11 +135,15 @@ func main() {
|
||||
fmt.Print(subparser.HelpString())
|
||||
return
|
||||
}
|
||||
var region *jdcloud.SRegion
|
||||
region, err = newClient(options)
|
||||
client, err := newClient(options)
|
||||
if err != nil {
|
||||
showErrorAndExit(err)
|
||||
}
|
||||
region := client.GetRegion(options.RegionId)
|
||||
if region == nil {
|
||||
fmt.Printf("not found region: %s", options.RegionId)
|
||||
return
|
||||
}
|
||||
err = subcmd.Invoke(region, suboptions)
|
||||
if err != nil {
|
||||
showErrorAndExit(err)
|
||||
|
||||
@@ -40,6 +40,8 @@ func init() {
|
||||
Search []string `help:"search conditions, in format of field:value"`
|
||||
Field []string `help:"retrieve field info"`
|
||||
Scope string `help:"query scope" choices:"one|sub" default:"sub"`
|
||||
PageLimit uint32 `help:"page size" default:"100"`
|
||||
Limit uint32 `help:"maximal output items"`
|
||||
}
|
||||
shellutils.R(&LdapSearchOptions{}, "search", "search ldap", func(cli *ldaputils.SLDAPClient, args *LdapSearchOptions) error {
|
||||
search := make(map[string]string)
|
||||
@@ -50,13 +52,14 @@ func init() {
|
||||
}
|
||||
search[s[:colonPos]] = s[(colonPos + 1):]
|
||||
}
|
||||
entries, err := cli.Search(args.Base, args.Objectclass, search, "", args.Field, queryScope(args.Scope))
|
||||
total, err := cli.Search(args.Base, args.Objectclass, search, "", args.Field, queryScope(args.Scope), args.PageLimit, args.Limit, func(offset uint32, entry *ldap.Entry) error {
|
||||
entry.PrettyPrint(2)
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, entry := range entries {
|
||||
entry.PrettyPrint(2)
|
||||
}
|
||||
fmt.Println("Total:", total)
|
||||
return nil
|
||||
})
|
||||
|
||||
|
||||
27
go.mod
27
go.mod
@@ -67,7 +67,7 @@ require (
|
||||
github.com/serialx/hashring v0.0.0-20180504054112-49a4782e9908
|
||||
github.com/sevlyar/go-daemon v0.1.5
|
||||
github.com/shirou/gopsutil v3.21.11+incompatible
|
||||
github.com/sirupsen/logrus v1.6.0
|
||||
github.com/sirupsen/logrus v1.9.0
|
||||
github.com/skip2/go-qrcode v0.0.0-20190110000554-dc11ecdae0a9
|
||||
github.com/smartystreets/goconvey v1.6.4
|
||||
github.com/stretchr/testify v1.7.2
|
||||
@@ -82,16 +82,15 @@ require (
|
||||
github.com/vmware/govmomi v0.20.1
|
||||
go.etcd.io/etcd/api/v3 v3.5.0
|
||||
go.etcd.io/etcd/client/v3 v3.5.0
|
||||
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5
|
||||
golang.org/x/net v0.0.0-20210525063256-abc453219eb5
|
||||
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4
|
||||
golang.org/x/net v0.0.0-20220418201149-a630d4f3e7a2
|
||||
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
|
||||
golang.org/x/sys v0.0.0-20220429233432-b5fbb4746d32
|
||||
golang.org/x/sys v0.0.0-20220829200755-d48e67d00261
|
||||
golang.org/x/text v0.3.7
|
||||
golang.org/x/time v0.0.0-20191024005414-555d28b269f0
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
|
||||
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20191008142428-8d021180e987
|
||||
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c
|
||||
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20220916014741-473347a5e6e3
|
||||
google.golang.org/grpc v1.38.0
|
||||
google.golang.org/protobuf v1.27.1
|
||||
gopkg.in/fatih/set.v0 v0.2.1
|
||||
@@ -103,15 +102,17 @@ require (
|
||||
k8s.io/cluster-bootstrap v0.19.3
|
||||
moul.io/http2curl/v2 v2.3.0
|
||||
yunion.io/x/executor v0.0.0-20211018100936-39a2cd966656
|
||||
yunion.io/x/jsonutils v1.0.0
|
||||
yunion.io/x/jsonutils v1.0.1-0.20220819091305-3bab322ab4fd
|
||||
yunion.io/x/log v1.0.0
|
||||
yunion.io/x/ovsdb v0.0.0-20200526071744-27bf0940cbc7
|
||||
yunion.io/x/pkg v1.0.1-0.20220630095420-9925accd7c5e
|
||||
yunion.io/x/pkg v1.0.1-0.20220819080140-55b265a8658e
|
||||
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e
|
||||
yunion.io/x/sqlchemy v1.1.2-0.20220704015412-b0c3988ceaa2
|
||||
yunion.io/x/sqlchemy v1.1.2-0.20220923040147-ddd3e96868af
|
||||
yunion.io/x/structarg v0.0.0-20220312084958-9c6c79c7d1c6
|
||||
)
|
||||
|
||||
require github.com/google/uuid v1.3.0
|
||||
|
||||
require (
|
||||
cloud.google.com/go v0.65.0 // indirect
|
||||
github.com/Azure/go-autorest/autorest/adal v0.8.2 // indirect
|
||||
@@ -176,10 +177,8 @@ require (
|
||||
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
|
||||
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db // indirect
|
||||
github.com/google/btree v1.0.0 // indirect
|
||||
github.com/google/go-cmp v0.5.7 // indirect
|
||||
github.com/google/go-querystring v1.0.0 // indirect
|
||||
github.com/google/gofuzz v1.1.0 // indirect
|
||||
github.com/google/uuid v1.3.0 // indirect
|
||||
github.com/googleapis/gax-go/v2 v2.0.5 // indirect
|
||||
github.com/googleapis/gnostic v0.4.1 // indirect
|
||||
github.com/googollee/go-engine.io v0.0.0-20180829091931-e2f255711dcb // indirect
|
||||
@@ -192,7 +191,6 @@ require (
|
||||
github.com/jstemmer/go-junit-report v0.9.1 // indirect
|
||||
github.com/jtolds/gls v4.20.0+incompatible // indirect
|
||||
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 // indirect
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.3 // indirect
|
||||
github.com/leodido/go-urn v1.2.0 // indirect
|
||||
github.com/lestrrat-go/iter v0.0.0-20200422075355-fc1769541911 // indirect
|
||||
github.com/lestrrat-go/pdebug v0.0.0-20200204225717-4d6bd78da58d // indirect
|
||||
@@ -244,11 +242,13 @@ require (
|
||||
go.uber.org/zap v1.17.0 // indirect
|
||||
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect
|
||||
golang.org/x/mod v0.4.2 // indirect
|
||||
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b // indirect
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
|
||||
golang.org/x/tools v0.1.2 // indirect
|
||||
google.golang.org/api v0.30.0 // indirect
|
||||
google.golang.org/appengine v1.6.6 // indirect
|
||||
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c // indirect
|
||||
gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d // indirect
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/ini.v1 v1.44.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
@@ -261,5 +261,4 @@ require (
|
||||
replace (
|
||||
github.com/go-logr/logr => github.com/go-logr/logr v0.4.0
|
||||
github.com/jaypipes/ghw => github.com/zexi/ghw v0.9.1
|
||||
google.golang.org/grpc => google.golang.org/grpc v1.29.0
|
||||
)
|
||||
|
||||
92
go.sum
92
go.sum
@@ -1,5 +1,6 @@
|
||||
bazil.org/fuse v0.0.0-20180421153158-65cc252bf669 h1:FNCRpXiquG1aoyqcIWVFmpTSKVcx2bQD38uZZeGtdlw=
|
||||
bazil.org/fuse v0.0.0-20180421153158-65cc252bf669/go.mod h1:Xbm+BRKSBEpa4q4hTSxohYNQpsxXPbPry4JJWOB3LB8=
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
|
||||
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
|
||||
@@ -188,9 +189,11 @@ github.com/cheggaaa/pb/v3 v3.0.8/go.mod h1:UICbiLec/XO6Hw6k+BHEtHeQFzzBH4i2/qk/o
|
||||
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
|
||||
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58 h1:F1EaeKL/ta07PY/k9Os/UFtwERei2/XzGemhpGnBKNg=
|
||||
github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h4xcZ5GoxqC5SDxFQ8gwyZPKQoEzownBlhI80=
|
||||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
||||
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
||||
github.com/coredns/coredns v1.3.0 h1:Ubjr8ZrOpEj95/A9dqQqQAG2k5DWEFdg2ZB3tUXuULA=
|
||||
github.com/coredns/coredns v1.3.0/go.mod h1:zASH/MVDgR6XZTbxvOnsZfffS+31vg6Ackf/wo1+AM0=
|
||||
github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM=
|
||||
@@ -229,7 +232,10 @@ github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkg
|
||||
github.com/elgatito/upnp v0.0.0-20180711183757-2f244d205f9a h1:2Zw3pxDRTs4nX1WCLAEm27UN0hvjZSge7EaUUQexRZw=
|
||||
github.com/elgatito/upnp v0.0.0-20180711183757-2f244d205f9a/go.mod h1:afkYpY8JAIL4341N7Zj9xJ5yTovsg6BkWfBFlCzIoF4=
|
||||
github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
|
||||
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
||||
github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
|
||||
github.com/farsightsec/golang-framestream v0.0.0-20181102145529-8a0cb8ba8710 h1:QdyRyGZWLEvJG5Kw3VcVJvhXJ5tZ1MkRgqpJOEZSySM=
|
||||
@@ -302,6 +308,7 @@ github.com/goji/httpauth v0.0.0-20160601135302-2da839ab0f4d/go.mod h1:nnjvkQ9ptG
|
||||
github.com/golang-plus/errors v1.0.0 h1:9Rh4itnph6OYO7wm9u3FUTLMFMKCoL07+bLiYKELxWw=
|
||||
github.com/golang-plus/errors v1.0.0/go.mod h1:YTFZjOTBcUFieeZe4q+7Umfu/sceSr3XQyBIkTkzpd8=
|
||||
github.com/golang-plus/testing v1.0.0 h1:azmFWFV44LHK/j/jAkNTbzB2G2b6HdmqF358r73m8kg=
|
||||
github.com/golang-plus/testing v1.0.0/go.mod h1:psANDlKPZ0ycedUzCS0Trf8h98sFyOyB51FlqyU+Ltc=
|
||||
github.com/golang-plus/uuid v1.0.0 h1:ga84hG89vda++AGpup4N/cbfbM3O4d3R5ON9/jcN6AY=
|
||||
github.com/golang-plus/uuid v1.0.0/go.mod h1:pBDDRrdgRHHqyYlj1d1i2gwyBq62Zc+sP2cDiCDkBLI=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
@@ -371,6 +378,7 @@ github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hf
|
||||
github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
||||
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
|
||||
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
||||
@@ -424,7 +432,6 @@ github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGw
|
||||
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
|
||||
github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks=
|
||||
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
|
||||
github.com/jsimonetti/rtnetlink v0.0.0-20190606172950-9527aa82566a/go.mod h1:Oz+70psSo5OFh8DBl0Zv2ACw7Esh6pPUphlvZG9x7uw=
|
||||
github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
||||
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
||||
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
@@ -448,11 +455,11 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o
|
||||
github.com/koding/websocketproxy v0.0.0-20181220232114-7ed82d81a28c h1:N7A4JCA2G+j5fuFxCsJqjFU/sZe0mj8H0sSoSwbaikw=
|
||||
github.com/koding/websocketproxy v0.0.0-20181220232114-7ed82d81a28c/go.mod h1:Nn5wlyECw3iJrzi0AhIWg+AJUb4PlRQVW4/3XHH1LZA=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
|
||||
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
@@ -505,10 +512,6 @@ github.com/mdlayher/arp v0.0.0-20190313224443-98a83c8a2717/go.mod h1:eOj1DDj3NAZ
|
||||
github.com/mdlayher/ethernet v0.0.0-20190313224307-5b5fc417d966/go.mod h1:5s5p/sMJ6sNsFl6uCh85lkFGV8kLuIYJCRJLavVJwvg=
|
||||
github.com/mdlayher/ethernet v0.0.0-20190606142754-0394541c37b7 h1:lez6TS6aAau+8wXUP3G9I3TGlmPFEq2CTxBaRqY6AGE=
|
||||
github.com/mdlayher/ethernet v0.0.0-20190606142754-0394541c37b7/go.mod h1:U6ZQobyTjI/tJyq2HG+i/dfSoFUt8/aZCM+GKtmFk/Y=
|
||||
github.com/mdlayher/genetlink v0.0.0-20191004171646-5cf585d3b847/go.mod h1:LNhNWFVJapYK8zEjVHUIle4gy+Oahfc3UtcaqZ8Dz98=
|
||||
github.com/mdlayher/netlink v0.0.0-20190409211403-11939a169225/go.mod h1:eQB3mZE4aiYnlUsyGGCOpPETfdQq4Jhsgf1fk3cwQaA=
|
||||
github.com/mdlayher/netlink v0.0.0-20191004170026-3c8695cb0643/go.mod h1:KxeJAFOFLG6AjpyDkQ/iIhxygIUKD+vcwqcnu43w/+M=
|
||||
github.com/mdlayher/netlink v0.0.0-20191008140946-2a17fd90af51/go.mod h1:KxeJAFOFLG6AjpyDkQ/iIhxygIUKD+vcwqcnu43w/+M=
|
||||
github.com/mdlayher/raw v0.0.0-20190313224157-43dbcdd7739d/go.mod h1:r1fbeITl2xL/zLbVnNHFyOzQJTgr/3fpf1lJX/cjzR8=
|
||||
github.com/mdlayher/raw v0.0.0-20190606142536-fef19f00fc18/go.mod h1:7EpbotpCmVZcu+KCX4g9WaRNuu11uyhiW7+Le1dKawg=
|
||||
github.com/mdlayher/raw v0.0.0-20190606144222-a54781e5f38f h1:Xjvm7UTnKTwrlhbs+8qA6I0v1iX77rY3QxftSgvOVRk=
|
||||
@@ -519,7 +522,6 @@ github.com/mholt/caddy v0.10.11 h1:s8X+R8DuBbrrMuUTcWSxlDe567B0s5EDmiDBKSYsioY=
|
||||
github.com/mholt/caddy v0.10.11/go.mod h1:Wb1PlT4DAYSqOEd03MsqkdkXnTxA8v9pKjdpxbqM1kY=
|
||||
github.com/miekg/dns v1.1.25 h1:dFwPR6SfLtrSwgDcIq2bcU/gVutB4sNApq2HBdqcakg=
|
||||
github.com/miekg/dns v1.1.25/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso=
|
||||
github.com/mikioh/ipaddr v0.0.0-20190404000644-d465c8ab6721/go.mod h1:Ickgr2WtCLZ2MDGd4Gr0geeCH5HybhRJbonOgQpvSxc=
|
||||
github.com/minio/cli v1.20.0/go.mod h1:bYxnK0uS629N3Bq+AOZZ+6lwF77Sodk4+UL9vNuXhOY=
|
||||
github.com/minio/minio-go v6.0.14+incompatible h1:fnV+GD28LeqdN6vT2XdGKW8Qe/IfjJDswNVuni6km9o=
|
||||
github.com/minio/minio-go v6.0.14+incompatible/go.mod h1:7guKYtitv8dktvNUGrhzmNlA5wrAABTQXCoesZdFQO8=
|
||||
@@ -630,8 +632,9 @@ github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKl
|
||||
github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
|
||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||
github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I=
|
||||
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
|
||||
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
|
||||
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
||||
github.com/skip2/go-qrcode v0.0.0-20190110000554-dc11ecdae0a9 h1:lpEzuenPuO1XNTeikEmvqYFcU37GVLl8SRNblzyvGBE=
|
||||
github.com/skip2/go-qrcode v0.0.0-20190110000554-dc11ecdae0a9/go.mod h1:PLPIyL7ikehBD1OAjmKKiOEhbvWyHGaNDjquXMcYABo=
|
||||
github.com/smartystreets/assertions v0.0.0-20180607162144-eb5b59917fa2/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||
@@ -734,15 +737,13 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U
|
||||
golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190829043050-9756ffdc2472/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY=
|
||||
golang.org/x/crypto v0.0.0-20191002192127-34f69633bfdc/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 h1:HWj/xjIHfjYU5nVXpTM0s39J9CbLn7Cc5a7IC5rwsMQ=
|
||||
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 h1:kUhD7nTDoI3fVd9G4ORWrbV5NY0liEs/Jg2pv5f+bBA=
|
||||
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
||||
@@ -755,6 +756,7 @@ golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EH
|
||||
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
|
||||
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
||||
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
@@ -779,6 +781,7 @@ golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=
|
||||
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/net v0.0.0-20180524181706-dfa909b99c79/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
@@ -795,10 +798,7 @@ golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLL
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20191003171128-d98b1b443823/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20191007182048-72f939374954/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
@@ -817,8 +817,9 @@ golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwY
|
||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
|
||||
golang.org/x/net v0.0.0-20210525063256-abc453219eb5 h1:wjuX4b5yYQnEQHzd+CBcrcC6OVR2J1CN6mUy0oSxIPo=
|
||||
golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20220418201149-a630d4f3e7a2 h1:6mzvA99KwZxbOrxww4EvWVQUnN1+xEu9tafK5ZxkYeA=
|
||||
golang.org/x/net v0.0.0-20220418201149-a630d4f3e7a2/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
@@ -839,6 +840,7 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20180724212812-e072cadbbdc8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
@@ -847,7 +849,6 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h
|
||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190405154228-4b34438f7a67/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190411185658-b44545bcd369/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190418153312-f0ce4c0180be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
@@ -857,15 +858,11 @@ golang.org/x/sys v0.0.0-20190606122018-79a91cf218c4/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190830023255-19e00faab6ad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191003212358-c178f38b412c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
@@ -899,11 +896,13 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220429233432-b5fbb4746d32 h1:Js08h5hqB5xyWR789+QqueR6sDE8mk+YvpETZ+F6X9Y=
|
||||
golang.org/x/sys v0.0.0-20220429233432-b5fbb4746d32/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220829200755-d48e67d00261 h1:v6hYoSR9T5oet+pMXwUWkbiVqx/63mlHjefrHmxwfeY=
|
||||
golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b h1:9zKuko04nR4gjZ4+DNjHqRlAJqbJETHwiNKDqTfOjfE=
|
||||
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
@@ -921,6 +920,7 @@ golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxb
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20181011042414-1f849cf54d09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
@@ -972,9 +972,8 @@ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8T
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.zx2c4.com/wireguard v0.0.20190908/go.mod h1:LhfXh5z6bLC2lW2ve6BzYZFwnnsXK3OQjySR0Yh2dO8=
|
||||
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20191008142428-8d021180e987 h1:26OAgqBTufVr8WKonCEhhjO1oKsYhHv0iM5Dg92G1TM=
|
||||
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20191008142428-8d021180e987/go.mod h1:7hq1rEDsx7/FWl8IEEnfH2Xhs6M2MNnjUfN0PeI8Rm0=
|
||||
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20220916014741-473347a5e6e3 h1:ARxNdT6I+00ZyY5yRT/ZECkQti4iGrMZX9dvG/ao/LY=
|
||||
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20220916014741-473347a5e6e3/go.mod h1:yp4gl6zOlnDGOZeWeDfMwQcsdOIQnMdhuPx9mwwWBL4=
|
||||
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
|
||||
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
|
||||
google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
|
||||
@@ -992,12 +991,14 @@ google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0M
|
||||
google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM=
|
||||
google.golang.org/api v0.30.0 h1:yfrXXP61wVuLb0vBcG6qaOoIoqYEzOQS8jum51jkv2w=
|
||||
google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
|
||||
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||
google.golang.org/appengine v1.6.6 h1:lMO5rYAqUxkmaj76jAkRUvt5JZgFymx/+Q5Mzfivuhc=
|
||||
google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
@@ -1029,8 +1030,22 @@ google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6D
|
||||
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c h1:wtujag7C+4D6KMoulW9YauvK2lgdvCMS260jsqqBXr0=
|
||||
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0=
|
||||
google.golang.org/grpc v1.29.0 h1:2pJjwYOdkZ9HlN4sWRYBg9ttH5bCOlsueaM+b/oYjwo=
|
||||
google.golang.org/grpc v1.29.0/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
|
||||
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
|
||||
google.golang.org/grpc v1.22.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
|
||||
google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60=
|
||||
google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
|
||||
google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||
google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=
|
||||
google.golang.org/grpc v1.38.0 h1:/9BgsAsa5nWe26HqOlvlgJnqBuktYOLCgjCPqsa56W0=
|
||||
google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||
@@ -1050,8 +1065,9 @@ gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d h1:TxyelI5cVkbREznMhfzyc
|
||||
gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d/go.mod h1:cuepJuh7vyXfUyUwEgHQXw849cJrilpS5NeIjOWESAw=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
||||
gopkg.in/fatih/set.v0 v0.2.1 h1:Xvyyp7LXu34P0ROhCyfXkmQCAoOUKb1E2JS9I7SE5CY=
|
||||
gopkg.in/fatih/set.v0 v0.2.1/go.mod h1:5eLWEndGL4zGGemXWrKuts+wTJR0y+w+auqUJZbmyBg=
|
||||
@@ -1117,8 +1133,9 @@ sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
|
||||
yunion.io/x/executor v0.0.0-20211018100936-39a2cd966656 h1:0zlZD5uhZoIHgLVAWCz2aHaYk2ZrNsACCYD7R6EIBII=
|
||||
yunion.io/x/executor v0.0.0-20211018100936-39a2cd966656/go.mod h1:Uxuou9WQIeJXNpy7t2fPLL0BYLvLiMvGQwY7Qc6aSws=
|
||||
yunion.io/x/jsonutils v0.0.0-20190625054549-a964e1e8a051/go.mod h1:4N0/RVzsYL3kH3WE/H1BjUQdFiWu50JGCFQuuy+Z634=
|
||||
yunion.io/x/jsonutils v1.0.0 h1:ySgXdIoRqUZRYA0t8QVqRkWgV8IWJlh2JtGovqqc+iI=
|
||||
yunion.io/x/jsonutils v1.0.0/go.mod h1:p0nyMqGA/apTxxyLIU/o1k4V7Vujl2O6ey30L594sYE=
|
||||
yunion.io/x/jsonutils v0.0.0-20220106020632-953b71a4c3a8/go.mod h1:p0nyMqGA/apTxxyLIU/o1k4V7Vujl2O6ey30L594sYE=
|
||||
yunion.io/x/jsonutils v1.0.1-0.20220819091305-3bab322ab4fd h1:QUAIH9oqQoDRz/byjE8id4yZE1qbCc53QzhsfcLzQp8=
|
||||
yunion.io/x/jsonutils v1.0.1-0.20220819091305-3bab322ab4fd/go.mod h1:L5QYTYqiL+f56wzir14TWHurE3Vcn9elaFiQpPWhXsg=
|
||||
yunion.io/x/log v0.0.0-20190514041436-04ce53b17c6b/go.mod h1:+gauLs73omeJAPlsXcevLsJLKixV+sR/E7WSYTSx1fE=
|
||||
yunion.io/x/log v0.0.0-20190629062853-9f6483a7103d/go.mod h1:LC6f/4FozL0iaAbnFt2eDX9jlsyo3WiOUPm03d7+U4U=
|
||||
yunion.io/x/log v1.0.0 h1:VPgssPi8Om+KAHjlEjf6RDU86du//yO+X0upu+h6fZM=
|
||||
@@ -1128,11 +1145,12 @@ yunion.io/x/ovsdb v0.0.0-20200526071744-27bf0940cbc7/go.mod h1:0vLkNEhlmA64HViPB
|
||||
yunion.io/x/pkg v0.0.0-20190620104149-945c25821dbf/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E=
|
||||
yunion.io/x/pkg v0.0.0-20190628082551-f4033ba2ea30/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E=
|
||||
yunion.io/x/pkg v0.0.0-20200814072949-4f1b541857d6/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E=
|
||||
yunion.io/x/pkg v1.0.1-0.20220630095420-9925accd7c5e h1:p/Cb7z6gyJbZKnGMeOPL3pTmnphB9GLCU+8qMsln7qA=
|
||||
yunion.io/x/pkg v1.0.1-0.20220630095420-9925accd7c5e/go.mod h1:nYOMflWG1wQC6301rGVglQva9bYbJxHThEJUxRAgMFc=
|
||||
yunion.io/x/pkg v1.0.1-0.20220819080140-55b265a8658e h1:enPKN/yaKmRjw3PWEdA7HDd6VDqewvczIJbSRpO7R8E=
|
||||
yunion.io/x/pkg v1.0.1-0.20220819080140-55b265a8658e/go.mod h1:nYOMflWG1wQC6301rGVglQva9bYbJxHThEJUxRAgMFc=
|
||||
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e h1:v+EzIadodSwkdZ/7bremd7J8J50Cise/HCylsOJngmo=
|
||||
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e/go.mod h1:0iFKpOs1y4lbCxeOmq3Xx/0AcQoewVPwj62eRluioEo=
|
||||
yunion.io/x/sqlchemy v1.1.2-0.20220704015412-b0c3988ceaa2 h1:Kz+Np1WHxYIyn2SQJEolFrMifLoT1yNF6J34W0zbRc8=
|
||||
yunion.io/x/sqlchemy v1.1.2-0.20220704015412-b0c3988ceaa2/go.mod h1:xXVfJLIxxTRTnPEaVIIoRZXqWyO8+takIOYhc+zO5KE=
|
||||
yunion.io/x/sqlchemy v1.0.1/go.mod h1:FTdwPdGhMgh4E+UFXc9klI1Ok34fMuybTT+jLhOaIjI=
|
||||
yunion.io/x/sqlchemy v1.1.2-0.20220923040147-ddd3e96868af h1:WjaARkzdxBQBD6j5I1MDMlJ0Z3WOHzEp5bTQl+TScaU=
|
||||
yunion.io/x/sqlchemy v1.1.2-0.20220923040147-ddd3e96868af/go.mod h1:xXVfJLIxxTRTnPEaVIIoRZXqWyO8+takIOYhc+zO5KE=
|
||||
yunion.io/x/structarg v0.0.0-20220312084958-9c6c79c7d1c6 h1:WuWXhY3DvhdRTzWCJ/kwt3Ss6KIq7+KqJwb+esvNGwU=
|
||||
yunion.io/x/structarg v0.0.0-20220312084958-9c6c79c7d1c6/go.mod h1:EP6NSv2C0zzqBDTKumv8hPWLb3XvgMZDHQRfyuOrQng=
|
||||
|
||||
@@ -149,6 +149,9 @@ func (apb *SAnsiblePlaybookV2) runPlaybook(ctx context.Context, userCred mcclien
|
||||
return fmt.Errorf("playbook is already running")
|
||||
}
|
||||
|
||||
// hack: force Sleep 50s to wait some host ssh service started
|
||||
time.Sleep(50 * time.Second)
|
||||
|
||||
var (
|
||||
privateKey string
|
||||
err error
|
||||
|
||||
@@ -145,10 +145,8 @@ func (h *AuthHandlers) GetRegionsResponse(ctx context.Context, w http.ResponseWr
|
||||
Domains: []string{},
|
||||
ReturnFullDomains: false,
|
||||
Idps: []agapi.SIdp{},
|
||||
SCommonConfig: agapi.SCommonConfig{
|
||||
ApiServer: options.Options.ApiServer,
|
||||
},
|
||||
EncryptPasswd: true,
|
||||
EncryptPasswd: true,
|
||||
ApiServer: options.Options.ApiServer,
|
||||
}
|
||||
|
||||
s := auth.GetAdminSession(ctx, regions[0])
|
||||
@@ -195,12 +193,10 @@ func (h *AuthHandlers) GetRegionsResponse(ctx context.Context, w http.ResponseWr
|
||||
// fetch this option directly from Keystone
|
||||
commonCfg, err := modules.ServicesV3.GetSpecific(s, "common", "config", nil)
|
||||
if err == nil && commonCfg != nil {
|
||||
config := agapi.SCommonConfig{}
|
||||
commonCfg.Unmarshal(&config, "config", "default")
|
||||
if len(config.ApiServer) > 0 {
|
||||
ret.ApiServer = config.ApiServer
|
||||
apiServer, _ := commonCfg.GetString("config", "default", "api_server")
|
||||
if len(apiServer) > 0 {
|
||||
ret.ApiServer = apiServer
|
||||
}
|
||||
ret.IsForgetLoginUser = config.IsForgetLoginUser
|
||||
}
|
||||
return ret, nil
|
||||
}
|
||||
@@ -355,9 +351,14 @@ func (h *AuthHandlers) doCredentialLogin(ctx context.Context, req *http.Request,
|
||||
idpId, _ := body.GetString("idp_id")
|
||||
redirectUri := getSsoCallbackUrl(ctx, req, idpId)
|
||||
token, err = processSsoLoginData(body, cliIp, redirectUri)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "processSsoLoginData")
|
||||
}
|
||||
// if err != nil {
|
||||
// return nil, errors.Wrap(err, "processSsoLoginData")
|
||||
// }
|
||||
} else if body.Contains("verify_code") { // verify by mobile
|
||||
verifyCode, _ := body.GetString("verify_code")
|
||||
uid, _ := body.GetString("uid")
|
||||
contactType, _ := body.GetString("contact_type")
|
||||
token, err = processVerifyLoginData(uid, contactType, verifyCode, cliIp)
|
||||
} else {
|
||||
return nil, httperrors.NewInputParameterError("missing credential")
|
||||
}
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package handler
|
||||
|
||||
import (
|
||||
|
||||
24
pkg/apigateway/handler/verify.go
Normal file
24
pkg/apigateway/handler/verify.go
Normal file
@@ -0,0 +1,24 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package handler
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/auth"
|
||||
)
|
||||
|
||||
func processVerifyLoginData(uid, contactType, verifyCode string, cliIp string) (mcclient.TokenCredential, error) {
|
||||
return auth.Client().AuthenticateVerify(uid, contactType, verifyCode, "", "", "", cliIp)
|
||||
}
|
||||
@@ -1 +1,15 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package report // import "yunion.io/x/onecloud/pkg/apigateway/report"
|
||||
|
||||
@@ -104,6 +104,7 @@ func GetModels(opts *GetModelsOptions) error {
|
||||
listOptions := options.BaseListOptions{
|
||||
System: options.Bool(true),
|
||||
Admin: options.Bool(true),
|
||||
Scope: "system",
|
||||
Details: options.Bool(opts.IncludeDetails),
|
||||
ShowEmulated: options.Bool(opts.IncludeEmulated),
|
||||
Filter: []string{
|
||||
|
||||
@@ -23,21 +23,14 @@ type SIdp struct {
|
||||
IsDefault bool `json:"is_default"`
|
||||
}
|
||||
|
||||
type SCommonConfig struct {
|
||||
ApiServer string `json:"api_server,allowempty"`
|
||||
IsForgetLoginUser bool `json:"is_forget_login_user"`
|
||||
}
|
||||
|
||||
type SRegionsReponse struct {
|
||||
Regions []string `json:"regions,allowempty"`
|
||||
Domains []string `json:"domains,allowempty"`
|
||||
|
||||
Captcha bool `json:"captcha,allowempty"`
|
||||
|
||||
Idps []SIdp `json:"idps,allowempty"`
|
||||
ReturnFullDomains bool `json:"return_full_domains"`
|
||||
|
||||
EncryptPasswd bool `json:"encrypt_passwd"`
|
||||
|
||||
SCommonConfig
|
||||
ApiServer string `json:"api_server,allowempty"`
|
||||
}
|
||||
|
||||
@@ -268,3 +268,14 @@ type ClouduserChangeOwnerInput struct {
|
||||
// 本地用户Id
|
||||
UserId string `json:"user_id"`
|
||||
}
|
||||
|
||||
type ClouduserCreateAccessKeyInput struct {
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type ClouduserDeleteAccessKeyInput struct {
|
||||
AccessKey string `json:"access_key"`
|
||||
}
|
||||
|
||||
type ClouduserListAccessKeyInput struct {
|
||||
}
|
||||
|
||||
@@ -440,8 +440,9 @@ type ServerCreateInput struct {
|
||||
// 创建后自动启动
|
||||
// 部分云创建后会自动启动例如: 腾讯云, AWS, OpenStack, ZStack, Ucloud, Huawei, Azure, 天翼云
|
||||
// default: false
|
||||
AutoStart bool `json:"auto_start"`
|
||||
DeployConfigs []*DeployConfig `json:"deploy_configs"`
|
||||
AutoStart bool `json:"auto_start"`
|
||||
DeployConfigs []*DeployConfig `json:"deploy_configs"`
|
||||
DeployTelegraf bool `json:"deploy_telegraf"`
|
||||
|
||||
// 包年包月时长
|
||||
//
|
||||
@@ -579,6 +580,8 @@ type GuestBatchMigrateRequest struct {
|
||||
SkipCpuCheck bool `json:"skip_cpu_check"`
|
||||
SkipKernelCheck bool `json:"skip_kernel_check"`
|
||||
EnableTLS *bool `json:"enable_tls"`
|
||||
MaxBandwidthMb *int64 `json:"max_bandwidth_mb"`
|
||||
QuciklyFinish *bool `json:"quickly_finish"`
|
||||
}
|
||||
|
||||
type GuestBatchMigrateParams struct {
|
||||
@@ -589,6 +592,8 @@ type GuestBatchMigrateParams struct {
|
||||
EnableTLS *bool
|
||||
RescueMode bool
|
||||
OldStatus string
|
||||
MaxBandwidthMb *int64
|
||||
QuciklyFinish *bool
|
||||
}
|
||||
|
||||
type HostLoginInfo struct {
|
||||
|
||||
@@ -63,6 +63,30 @@ type BucketDetails struct {
|
||||
AccessUrls []cloudprovider.SBucketAccessUrl `json:"access_urls"`
|
||||
}
|
||||
|
||||
func (self BucketDetails) GetMetricTags() map[string]string {
|
||||
ret := map[string]string{
|
||||
"id": self.Id,
|
||||
"brand": self.Brand,
|
||||
"cloudregion": self.Cloudregion,
|
||||
"cloudregion_id": self.CloudregionId,
|
||||
"domain_id": self.DomainId,
|
||||
"oss_id": self.Id,
|
||||
"oss_name": self.Name,
|
||||
"project_domain": self.ProjectDomain,
|
||||
"region_ext_id": self.RegionExtId,
|
||||
"status": self.Status,
|
||||
"tenant": self.Project,
|
||||
"tenant_id": self.ProjectId,
|
||||
"external_id": self.ExternalId,
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func (self BucketDetails) GetMetricPairs() map[string]string {
|
||||
ret := map[string]string{}
|
||||
return ret
|
||||
}
|
||||
|
||||
type BucketObjectsActionInput struct {
|
||||
Key []string
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
@@ -144,6 +145,9 @@ type CloudaccountCreateInput struct {
|
||||
// swagger:ignore
|
||||
AccountId string
|
||||
|
||||
// 跳过重复账号注册检查
|
||||
SkipDuplicateAccountCheck bool
|
||||
|
||||
// 指定云平台品牌, 此参数默认和provider相同
|
||||
// requried: false
|
||||
//
|
||||
@@ -317,6 +321,25 @@ type CloudaccountDetail struct {
|
||||
ProjectMappingResourceInfo
|
||||
}
|
||||
|
||||
func (self CloudaccountDetail) GetMetricTags() map[string]string {
|
||||
ret := map[string]string{
|
||||
"id": self.Id,
|
||||
"cloudaccount_id": self.Id,
|
||||
"cloudaccount_name": self.Name,
|
||||
"brand": self.Brand,
|
||||
"domain_id": self.DomainId,
|
||||
"project_domain": self.ProjectDomain,
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func (self CloudaccountDetail) GetMetricPairs() map[string]string {
|
||||
ret := map[string]string{
|
||||
"balance": fmt.Sprintf("%.2f", self.Balance),
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
type CloudaccountUpdateInput struct {
|
||||
apis.EnabledStatusInfrasResourceBaseUpdateInput
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
@@ -317,6 +318,39 @@ type DBInstanceDetails struct {
|
||||
Zone2Name string `json:"zone2_name"`
|
||||
// Zone3名称
|
||||
Zone3Name string `json:"zone3_name"`
|
||||
|
||||
Databases []apis.IdNameDetails `json:"databases"`
|
||||
}
|
||||
|
||||
func (self DBInstanceDetails) GetMetricTags() map[string]string {
|
||||
ret := map[string]string{
|
||||
"id": self.Id,
|
||||
"rds_id": self.Id,
|
||||
"rds_name": self.Name,
|
||||
"zone": self.Zone1Name,
|
||||
"zone_id": self.Zone1,
|
||||
"status": self.Status,
|
||||
"engine": self.Engine,
|
||||
"server_type": strings.ToLower(self.Engine),
|
||||
"cloudregion": self.Cloudregion,
|
||||
"cloudregion_id": self.CloudregionId,
|
||||
"region_ext_id": self.RegionExtId,
|
||||
"tenant": self.Project,
|
||||
"tenant_id": self.ProjectId,
|
||||
"brand": self.Brand,
|
||||
"domain_id": self.DomainId,
|
||||
"project_domain": self.ProjectDomain,
|
||||
"external_id": self.ExternalId,
|
||||
}
|
||||
if len(self.IpAddrs) > 0 {
|
||||
ret["rds_ip"] = strings.ReplaceAll(self.IpAddrs, ",", "|")
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func (self DBInstanceDetails) GetMetricPairs() map[string]string {
|
||||
ret := map[string]string{}
|
||||
return ret
|
||||
}
|
||||
|
||||
type DBInstanceResourceInfoBase struct {
|
||||
|
||||
@@ -37,6 +37,34 @@ type ElasticcacheDetails struct {
|
||||
SlaveZoneInfos []apis.StandaloneShortDesc `json:"slave_zone_infos"`
|
||||
}
|
||||
|
||||
func (self ElasticcacheDetails) GetMetricTags() map[string]string {
|
||||
ret := map[string]string{
|
||||
"id": self.Id,
|
||||
"redis_id": self.Id,
|
||||
"redis_ip": self.PrivateIpAddr,
|
||||
"redis_name": self.Name,
|
||||
"zone": self.Zone,
|
||||
"zone_id": self.ZoneId,
|
||||
"zone_ext_id": self.ZoneExtId,
|
||||
"status": self.Status,
|
||||
"cloudregion": self.Cloudregion,
|
||||
"cloudregion_id": self.CloudregionId,
|
||||
"region_ext_id": self.RegionExtId,
|
||||
"tenant": self.Project,
|
||||
"tenant_id": self.ProjectId,
|
||||
"brand": self.Brand,
|
||||
"domain_id": self.DomainId,
|
||||
"project_domain": self.ProjectDomain,
|
||||
"external_id": self.ExternalId,
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func (self ElasticcacheDetails) GetMetricPairs() map[string]string {
|
||||
ret := map[string]string{}
|
||||
return ret
|
||||
}
|
||||
|
||||
type ElasticcacheResourceInfo struct {
|
||||
// 弹性缓存实例名称
|
||||
Elasticcache string `json:"elasticcache"`
|
||||
|
||||
@@ -71,6 +71,7 @@ const (
|
||||
|
||||
VM_START_MIGRATE = "start_migrate"
|
||||
VM_MIGRATING = "migrating"
|
||||
VM_LIVE_MIGRATING = "live_migrating"
|
||||
VM_MIGRATE_FAILED = "migrate_failed"
|
||||
|
||||
VM_CHANGE_FLAVOR = "change_flavor"
|
||||
@@ -154,6 +155,9 @@ const (
|
||||
|
||||
VM_SYNC_ISOLATED_DEVICE_FAILED = "sync_isolated_device_failed"
|
||||
|
||||
VM_QGA_SET_PASSWORD = "qga_set_password"
|
||||
VM_QGA_COMMAND_EXECUTING = "qga_command_executing"
|
||||
|
||||
SHUTDOWN_STOP = "stop"
|
||||
SHUTDOWN_TERMINATE = "terminate"
|
||||
|
||||
@@ -186,6 +190,13 @@ const (
|
||||
HYPERVISOR_DEFAULT = HYPERVISOR_KVM
|
||||
)
|
||||
|
||||
const (
|
||||
QGA_STATUS_UNKNOWN = "unknown"
|
||||
QGA_STATUS_EXCUTING = "executing"
|
||||
QGA_STATUS_EXECUTE_FAILED = "execute_failed"
|
||||
QGA_STATUS_AVAILABLE = "available"
|
||||
)
|
||||
|
||||
const (
|
||||
CPU_MODE_QEMU = "qemu"
|
||||
CPU_MODE_HOST = "host"
|
||||
|
||||
@@ -245,6 +245,46 @@ type ServerDetails struct {
|
||||
ScalingGroupId string `json:"scaling_group_id"`
|
||||
}
|
||||
|
||||
func (self ServerDetails) GetMetricTags() map[string]string {
|
||||
ret := map[string]string{
|
||||
"id": self.Id,
|
||||
"res_type": "guest",
|
||||
"is_vm": "true",
|
||||
"paltform": self.Hypervisor,
|
||||
"host": self.Host,
|
||||
"host_id": self.HostId,
|
||||
"vm_id": self.Id,
|
||||
"vm_name": self.Name,
|
||||
"zone": self.Zone,
|
||||
"zone_id": self.ZoneId,
|
||||
"zone_ext_id": self.ZoneExtId,
|
||||
"os_type": self.OsType,
|
||||
"status": self.Status,
|
||||
"cloudregion": self.Cloudregion,
|
||||
"cloudregion_id": self.CloudregionId,
|
||||
"region_ext_id": self.RegionExtId,
|
||||
"tenant": self.Project,
|
||||
"tenant_id": self.ProjectId,
|
||||
"brand": self.Brand,
|
||||
"vm_scaling_group_id": self.ScalingGroupId,
|
||||
"domain_id": self.DomainId,
|
||||
"project_domain": self.ProjectDomain,
|
||||
"account": self.Account,
|
||||
"account_id": self.AccountId,
|
||||
"external_id": self.ExternalId,
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func (self ServerDetails) GetMetricPairs() map[string]string {
|
||||
ret := map[string]string{
|
||||
"vcpu_count": fmt.Sprintf("%d", self.VcpuCount),
|
||||
"vmem_size": fmt.Sprintf("%d", self.VmemSize),
|
||||
"disk": fmt.Sprintf("%d", self.DiskSizeMb),
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
// GuestDiskInfo describe the information of disk on the guest.
|
||||
type GuestDiskInfo struct {
|
||||
Id string `json:"id"`
|
||||
@@ -395,6 +435,12 @@ type GuestLiveMigrateInput struct {
|
||||
SkipKernelCheck *bool `json:"skip_kernel_check"`
|
||||
// 是否启用 tls
|
||||
EnableTLS *bool `json:"enable_tls"`
|
||||
|
||||
// 迁移带宽限制
|
||||
MaxBandwidthMb *int64 `json:"max_bandwidth_mb"`
|
||||
// 快速完成,内存同步一定周期后调整 downtime
|
||||
QuicklyFinish *bool `json:"quickly_finish"`
|
||||
KeepDestGuestOnFailed *bool `json:"keep_dest_guest_on_failed"`
|
||||
}
|
||||
|
||||
type GuestSetSecgroupInput struct {
|
||||
@@ -574,6 +620,7 @@ type ServerMigrateForecastInput struct {
|
||||
LiveMigrate bool `json:"live_migrate"`
|
||||
SkipCpuCheck bool `json:"skip_cpu_check"`
|
||||
SkipKernelCheck bool `json:"skip_kernel_check"`
|
||||
IsRescueMode bool `json:"is_rescue_mode"`
|
||||
}
|
||||
|
||||
type ServerResizeDiskInput struct {
|
||||
@@ -618,6 +665,8 @@ type ServerDeployInput struct {
|
||||
|
||||
// swagger: ignore
|
||||
DeployConfigs []*DeployConfig `json:"deploy_configs"`
|
||||
// swagger: ignore
|
||||
DeployTelegraf bool `json:"deploy_telegraf"`
|
||||
}
|
||||
|
||||
type ServerUserDataInput struct {
|
||||
@@ -732,7 +781,7 @@ type GuestJsonDesc struct {
|
||||
UserData string `json:"user_data"`
|
||||
PendingDeleted bool `json:"pending_deleted"`
|
||||
|
||||
ScallingGroupId string `json:"scalling_group_id"`
|
||||
ScalingGroupId string `json:"scaling_group_id"`
|
||||
|
||||
// baremetal
|
||||
DiskConfig jsonutils.JSONObject `json:"disk_config"`
|
||||
@@ -841,7 +890,35 @@ type ServerGetCPUSetCoresResp struct {
|
||||
HostUsedCores []int `json:"host_used_cores"`
|
||||
}
|
||||
|
||||
type ServerMonitorInput struct {
|
||||
COMMAND string
|
||||
QMP bool
|
||||
}
|
||||
|
||||
type ServerQemuInfo struct {
|
||||
Version string `json:"version"`
|
||||
Cmdline string `json:"cmdline"`
|
||||
}
|
||||
|
||||
type ServerQgaSetPasswordInput struct {
|
||||
Username string
|
||||
Password string
|
||||
}
|
||||
|
||||
type ServerQgaCommandInput struct {
|
||||
Command string
|
||||
}
|
||||
|
||||
type ServerSetPasswordInput struct {
|
||||
Username string
|
||||
Password string
|
||||
|
||||
// deploy params
|
||||
ResetPassword bool
|
||||
AutoStart bool
|
||||
}
|
||||
|
||||
type ServerSetLiveMigrateParamsInput struct {
|
||||
MaxBandwidthMB *int64
|
||||
DowntimeLimitMS *int64
|
||||
}
|
||||
|
||||
@@ -228,6 +228,35 @@ type HostDetails struct {
|
||||
SysError string `json:"sys_error"`
|
||||
}
|
||||
|
||||
func (self HostDetails) GetMetricTags() map[string]string {
|
||||
ret := map[string]string{
|
||||
"id": self.Id,
|
||||
"host_id": self.Id,
|
||||
"host_ip": self.AccessIp,
|
||||
"host": self.Name,
|
||||
"zone": self.Zone,
|
||||
"zone_id": self.ZoneId,
|
||||
"zone_ext_id": self.ZoneExtId,
|
||||
"status": self.Status,
|
||||
"cloudregion": self.Cloudregion,
|
||||
"cloudregion_id": self.CloudregionId,
|
||||
"region_ext_id": self.RegionExtId,
|
||||
"brand": self.Brand,
|
||||
"domain_id": self.DomainId,
|
||||
"project_domain": self.ProjectDomain,
|
||||
"account": self.Account,
|
||||
"res_type": "host",
|
||||
"account_id": self.AccountId,
|
||||
"external_id": self.ExternalId,
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func (self HostDetails) GetMetricPairs() map[string]string {
|
||||
ret := map[string]string{}
|
||||
return ret
|
||||
}
|
||||
|
||||
type HostResourceInfo struct {
|
||||
// 归属云订阅ID
|
||||
ManagerId string `json:"manager_id"`
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package compute
|
||||
|
||||
const (
|
||||
|
||||
@@ -45,10 +45,36 @@ type KubeClusterCreateInput struct {
|
||||
|
||||
type KubeClusterDetails struct {
|
||||
apis.EnabledStatusInfrasResourceBaseDetails
|
||||
|
||||
SKubeCluster
|
||||
ManagedResourceInfo
|
||||
CloudregionResourceInfo
|
||||
}
|
||||
|
||||
func (self KubeClusterDetails) GetMetricTags() map[string]string {
|
||||
ret := map[string]string{
|
||||
"id": self.ExternalClusterId,
|
||||
"res_type": "kube_cluster",
|
||||
"cluster_id": self.ExternalClusterId,
|
||||
"cluster_name": self.Name,
|
||||
"status": self.Status,
|
||||
"cloudregion": self.Cloudregion,
|
||||
"cloudregion_id": self.CloudregionId,
|
||||
"region_ext_id": self.RegionExtId,
|
||||
"domain_id": self.DomainId,
|
||||
"project_domain": self.ProjectDomain,
|
||||
"account": self.Account,
|
||||
"account_id": self.AccountId,
|
||||
"external_id": self.ExternalId,
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func (self KubeClusterDetails) GetMetricPairs() map[string]string {
|
||||
ret := map[string]string{}
|
||||
return ret
|
||||
}
|
||||
|
||||
type KubeClusterUpdateInput struct {
|
||||
apis.EnabledStatusInfrasResourceBaseUpdateInput
|
||||
}
|
||||
|
||||
87
pkg/apis/compute/modelarts_pool.go
Normal file
87
pkg/apis/compute/modelarts_pool.go
Normal file
@@ -0,0 +1,87 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
)
|
||||
|
||||
const (
|
||||
MODELARTS_POOL_STATUS_RUNNING = "running"
|
||||
MODELARTS_POOL_STATUS_ABNORMAL = "abnormal"
|
||||
MODELARTS_POOL_STATUS_CREATING = "creating"
|
||||
MODELARTS_POOL_STATUS_DELETING = "deleting"
|
||||
MODELARTS_POOL_STATUS_CHANGE_CONFIG = "change_config"
|
||||
MODELARTS_POOL_STATUS_ERROR = "error"
|
||||
MODELARTS_POOL_STATUS_UNKNOWN = "unknown"
|
||||
)
|
||||
|
||||
type ModelartsPoolCreateInput struct {
|
||||
apis.VirtualResourceCreateInput
|
||||
DeletePreventableCreateInput
|
||||
|
||||
CloudregionResourceInput
|
||||
CloudproviderResourceInput
|
||||
|
||||
NodeCount int
|
||||
}
|
||||
|
||||
type ModelartsPoolUpdateInput struct {
|
||||
apis.StatusInfrasResourceBaseCreateInput
|
||||
CloudproviderResourceInput
|
||||
WorkType string `json:"work_type"`
|
||||
}
|
||||
|
||||
// 资源返回详情
|
||||
type ModelartsPoolDetails struct {
|
||||
apis.SVirtualResourceBase
|
||||
apis.VirtualResourceDetails
|
||||
|
||||
apis.SExternalizedResourceBase
|
||||
SBillingResourceBase
|
||||
ManagedResourceInfo
|
||||
CloudregionResourceInfo
|
||||
}
|
||||
|
||||
func (self ModelartsPoolDetails) GetMetricTags() map[string]string {
|
||||
ret := map[string]string{
|
||||
"id": self.Id,
|
||||
"modelarts_pool_id": self.Id,
|
||||
"modelarts_pool_name": self.Name,
|
||||
"status": self.Status,
|
||||
"tenant_id": self.ProjectId,
|
||||
"brand": self.Brand,
|
||||
"domain_id": self.DomainId,
|
||||
"account_id": self.AccountId,
|
||||
"account": self.Account,
|
||||
"external_id": self.ExternalId,
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
type ModelartsPoolListInput struct {
|
||||
apis.VirtualResourceListInput
|
||||
apis.ExternalizedResourceBaseListInput
|
||||
ManagedResourceListInput
|
||||
RegionalFilterListInput
|
||||
apis.DeletePreventableResourceBaseListInput
|
||||
}
|
||||
|
||||
type ModelartsPoolSyncstatusInput struct {
|
||||
}
|
||||
|
||||
type ModelartsPoolChangeConfigInput struct {
|
||||
NodeCount int
|
||||
}
|
||||
36
pkg/apis/compute/modelarts_pool_sku.go
Normal file
36
pkg/apis/compute/modelarts_pool_sku.go
Normal file
@@ -0,0 +1,36 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type ModelartsPoolSkuDetails struct {
|
||||
apis.EnabledStatusStandaloneResourceDetails
|
||||
ManagedResourceInfo
|
||||
CloudregionResourceInfo
|
||||
}
|
||||
|
||||
const (
|
||||
MODELARTS_POOL_SKU_AVAILABLE = "available"
|
||||
MODELARTS_POOL_SKU_SOLDOUT = "soldout"
|
||||
)
|
||||
|
||||
type ModelartsPoolSkuListInput struct {
|
||||
apis.EnabledStatusStandaloneResourceListInput
|
||||
apis.ExternalizedResourceBaseListInput
|
||||
|
||||
RegionalFilterListInput
|
||||
ManagedResourceListInput
|
||||
}
|
||||
@@ -83,6 +83,9 @@ type ServerSkuListInput struct {
|
||||
|
||||
// 预付费状态
|
||||
PrepaidStatus string `json:"prepaid_status"`
|
||||
|
||||
// 按套餐名称去重
|
||||
Distinct bool `json:"distinct"`
|
||||
}
|
||||
|
||||
type ElasticcacheSkuListInput struct {
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
@@ -147,6 +149,31 @@ type StorageDetails struct {
|
||||
CommitBound float32 `json:"commit_bound"`
|
||||
}
|
||||
|
||||
func (self StorageDetails) GetMetricTags() map[string]string {
|
||||
ret := map[string]string{
|
||||
"id": self.Id,
|
||||
"storage_id": self.Id,
|
||||
"storage_name": self.Name,
|
||||
"brand": self.Brand,
|
||||
"domain_id": self.DomainId,
|
||||
"project_domain": self.ProjectDomain,
|
||||
"external_id": self.ExternalId,
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func (self StorageDetails) GetMetricPairs() map[string]string {
|
||||
usageActive := "0"
|
||||
if self.Capacity > 0 {
|
||||
usageActive = strconv.FormatFloat(float64(self.ActualCapacityUsed/self.Capacity*100.0), 'f', -1, 64)
|
||||
}
|
||||
ret := map[string]string{
|
||||
"free": strconv.FormatFloat(float64(self.Capacity-self.ActualCapacityUsed), 'f', 2, 64),
|
||||
"usage_active": usageActive,
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
type StorageResourceInfo struct {
|
||||
// 归属云订阅ID
|
||||
ManagerId string `json:"manager_id"`
|
||||
|
||||
@@ -236,4 +236,7 @@ type StorageListInput struct {
|
||||
|
||||
// filter storages which attached the specified host
|
||||
HostId string `json:"host_id"`
|
||||
|
||||
// filter storages of baremetal host
|
||||
IsBaremetal *bool `json:"is_baremetal"`
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ const (
|
||||
SERVICE_TYPE_MONITOR = "monitor"
|
||||
SERVICE_TYPE_LOG = "log"
|
||||
SERVICE_TYPE_REGION = "compute"
|
||||
SERVICE_TYPE_CLOUDMON = "cloudmon"
|
||||
|
||||
SERVICE_TYPE_ETCD = "etcd"
|
||||
SERVICE_TYPE_INFLUXDB = "influxdb"
|
||||
|
||||
@@ -31,3 +31,9 @@ type HostTopology struct {
|
||||
type HostCPUInfo struct {
|
||||
*cpu.Info
|
||||
}
|
||||
|
||||
type GuestSetPasswordRequest struct {
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
Crypted bool `json:"crypted"`
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ const (
|
||||
AUTH_METHOD_SAML = "saml"
|
||||
AUTH_METHOD_OIDC = "oidc"
|
||||
AUTH_METHOD_OAuth2 = "oauth2"
|
||||
AUTH_METHOD_VERIFY = "verify"
|
||||
|
||||
// AUTH_METHOD_ID_PASSWORD = 1
|
||||
// AUTH_METHOD_ID_TOKEN = 2
|
||||
@@ -103,7 +104,6 @@ var (
|
||||
"default": []string{
|
||||
"enable_quota_check",
|
||||
"default_quota_value",
|
||||
"enable_rbac",
|
||||
"non_default_domain_projects",
|
||||
"time_zone",
|
||||
"domainized_namespace",
|
||||
@@ -114,9 +114,6 @@ var (
|
||||
"ignore_nonrunning_guests",
|
||||
"platform_name",
|
||||
"platform_names",
|
||||
"is_forget_login_user",
|
||||
"enable_organization",
|
||||
"enable_tls_migration",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -377,3 +377,8 @@ type OpsLogListInput struct {
|
||||
|
||||
Until time.Time `json:"until"`
|
||||
}
|
||||
|
||||
type IdNameDetails struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
@@ -159,6 +159,8 @@ type AlertListInput struct {
|
||||
}
|
||||
|
||||
type AlertDetails struct {
|
||||
SAlert
|
||||
|
||||
apis.StatusStandaloneResourceDetails
|
||||
apis.ScopedResourceBaseInfo
|
||||
}
|
||||
|
||||
@@ -20,6 +20,13 @@ import (
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
)
|
||||
|
||||
const (
|
||||
AlertNotificationUsedByMeterAlert = "meter_alert"
|
||||
AlertNotificationUsedByNodeAlert = "node_alert"
|
||||
AlertNotificationUsedByCommonAlert = "common_alert"
|
||||
AlertNotificationUsedByMigrationAlert = "migration_alert"
|
||||
)
|
||||
|
||||
type AlertJointResourceBaseDetails struct {
|
||||
apis.JointResourceBaseDetails
|
||||
SAlertJointsBase
|
||||
|
||||
@@ -42,6 +42,8 @@ type AlertRecordListInput struct {
|
||||
}
|
||||
|
||||
type AlertRecordDetails struct {
|
||||
SAlertRecord
|
||||
|
||||
apis.StatusStandaloneResourceDetails
|
||||
apis.ScopedResourceBaseInfo
|
||||
|
||||
@@ -50,6 +52,20 @@ type AlertRecordDetails struct {
|
||||
TriggerTime time.Time
|
||||
}
|
||||
|
||||
func (self AlertRecordDetails) GetMetricTags() map[string]string {
|
||||
ret := map[string]string{
|
||||
"id": self.Id,
|
||||
"alert_id": self.AlertId,
|
||||
"alert_name": self.AlertName,
|
||||
"domain_id": self.DomainId,
|
||||
"project_domain": self.ProjectDomain,
|
||||
"res_type": self.ResType,
|
||||
"tenant": self.Tenant,
|
||||
"tenant_id": self.TenantId,
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
type AlertRecordCreateInput struct {
|
||||
apis.StandaloneResourceCreateInput
|
||||
|
||||
|
||||
@@ -21,8 +21,9 @@ const (
|
||||
ALERT_STATUS_DELETING = "deleting"
|
||||
ALERT_STATUS_DELETED = "deleted"
|
||||
|
||||
CommonAlertSystemAlertType = "system"
|
||||
CommonAlertNomalAlertType = "normal"
|
||||
CommonAlertSystemAlertType = "system"
|
||||
CommonAlertNomalAlertType = "normal"
|
||||
CommonAlertServiceAlertType = "service"
|
||||
|
||||
MonitorComponentType = "default-monitor"
|
||||
MonitorComponentPort = 30093
|
||||
@@ -40,16 +41,15 @@ const (
|
||||
|
||||
METRIC_QUERY_TYPE_NO_DATA = "nodata_query"
|
||||
METRIC_QUERY_NO_DATA_THESHOLD = "nodata"
|
||||
|
||||
CommonAlertLevelNormal = "normal"
|
||||
CommonAlertLevelImportant = "important"
|
||||
CommonAlertLevelFatal = "fatal"
|
||||
)
|
||||
|
||||
var CommonAlertLevels = []string{"normal", "important", "fatal"}
|
||||
var CommonAlertLevels = []string{CommonAlertLevelNormal, CommonAlertLevelImportant, CommonAlertLevelFatal}
|
||||
|
||||
type CommonAlertCreateInput struct {
|
||||
CommonMetricInputQuery
|
||||
AlertCreateInput
|
||||
|
||||
// 查询指标周期
|
||||
Period string `json:"period"`
|
||||
type CommonAlertCreateBaseInput struct {
|
||||
// 报警连续持续周期数
|
||||
AlertDuration int64 `json:"alert_duration"`
|
||||
// 通知方式, 比如: email, mobile
|
||||
@@ -76,6 +76,15 @@ type CommonAlertCreateInput struct {
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
type CommonAlertCreateInput struct {
|
||||
CommonMetricInputQuery
|
||||
AlertCreateInput
|
||||
CommonAlertCreateBaseInput
|
||||
|
||||
// 查询指标周期
|
||||
Period string `json:"period"`
|
||||
}
|
||||
|
||||
type CommonMetricInputQuery struct {
|
||||
From string `json:"from"`
|
||||
To string `json:"to"`
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
package monitor
|
||||
|
||||
import (
|
||||
"time"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -51,39 +51,79 @@ type NodeAlertCreateInput struct {
|
||||
NodeName string `json:"node_name"`
|
||||
// 监控资源 Id
|
||||
NodeId string `json:"node_id"`
|
||||
|
||||
// CommonAlertCreateInput injected by server and do not pass it through API
|
||||
CommonAlertCreateInput *CommonAlertCreateInput `json:"common_alert_create_input,omitempty"`
|
||||
}
|
||||
|
||||
func (input NodeAlertCreateInput) ToAlertCreateInput(
|
||||
func (input NodeAlertCreateInput) ToCommonAlertCreateInput(
|
||||
name string,
|
||||
field string,
|
||||
measurement string,
|
||||
db string) AlertCreateInput {
|
||||
freq, _ := time.ParseDuration(input.Window)
|
||||
ret := AlertCreateInput{
|
||||
Name: name,
|
||||
Frequency: int64(freq / time.Second),
|
||||
Level: input.Level,
|
||||
Settings: AlertSetting{
|
||||
Conditions: []AlertCondition{
|
||||
db string) CommonAlertCreateInput {
|
||||
ret := CommonAlertCreateInput{
|
||||
AlertCreateInput: AlertCreateInput{
|
||||
Name: name,
|
||||
Level: input.Level,
|
||||
},
|
||||
CommonAlertCreateBaseInput: CommonAlertCreateBaseInput{
|
||||
Channel: strings.Split(input.Channel, ","),
|
||||
Recipients: strings.Split(input.Recipients, ","),
|
||||
AlertType: CommonAlertNomalAlertType,
|
||||
},
|
||||
CommonMetricInputQuery: CommonMetricInputQuery{
|
||||
MetricQuery: []*CommonAlertQuery{
|
||||
{
|
||||
Type: "query",
|
||||
Operator: "and",
|
||||
Query: AlertQuery{
|
||||
AlertQuery: &AlertQuery{
|
||||
Model: input.GetQuery(field, measurement, db),
|
||||
From: input.Period,
|
||||
To: "now",
|
||||
},
|
||||
Evaluator: input.GetEvaluator(),
|
||||
Reducer: Condition{
|
||||
Type: "avg",
|
||||
},
|
||||
Comparator: input.Comparator,
|
||||
Threshold: input.Threshold,
|
||||
ConditionType: "query",
|
||||
Reduce: "avg",
|
||||
},
|
||||
},
|
||||
},
|
||||
Period: input.Window,
|
||||
}
|
||||
ret.UsedBy = AlertNotificationUsedByNodeAlert
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
// func (input NodeAlertCreateInput) ToAlertCreateInput(
|
||||
// name string,
|
||||
// field string,
|
||||
// measurement string,
|
||||
// db string) AlertCreateInput {
|
||||
// freq, _ := time.ParseDuration(input.Window)
|
||||
// ret := AlertCreateInput{
|
||||
// Name: name,
|
||||
// Frequency: int64(freq / time.Second),
|
||||
// Level: input.Level,
|
||||
// Settings: AlertSetting{
|
||||
// Conditions: []AlertCondition{
|
||||
// {
|
||||
// Type: "query",
|
||||
// Operator: "and",
|
||||
// Query: AlertQuery{
|
||||
// Model: input.GetQuery(field, measurement, db),
|
||||
// From: input.Period,
|
||||
// To: "now",
|
||||
// },
|
||||
// Evaluator: input.GetEvaluator(),
|
||||
// Reducer: Condition{
|
||||
// Type: "avg",
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// }
|
||||
// return ret
|
||||
// }
|
||||
|
||||
func (input NodeAlertCreateInput) GetQuery(field, measurement, db string) MetricQuery {
|
||||
return GetNodeAlertQuery(input.Type, field, measurement, db, input.NodeId)
|
||||
}
|
||||
@@ -102,8 +142,9 @@ func GetNodeAlertQuery(typ, field, measurement, db, nodeId string) MetricQuery {
|
||||
Selects: sels,
|
||||
Tags: []MetricQueryTag{
|
||||
{
|
||||
Key: idField,
|
||||
Value: nodeId,
|
||||
Key: idField,
|
||||
Operator: "=",
|
||||
Value: nodeId,
|
||||
},
|
||||
},
|
||||
GroupBy: []MetricQueryPart{
|
||||
@@ -145,7 +186,7 @@ type V1AlertListInput struct {
|
||||
}
|
||||
|
||||
type NodeAlertListInput struct {
|
||||
V1AlertListInput
|
||||
AlertListInput
|
||||
|
||||
// 监控指标名称
|
||||
Metric string `json:"metric"`
|
||||
@@ -157,6 +198,13 @@ type NodeAlertListInput struct {
|
||||
NodeId string `json:"node_id"`
|
||||
}
|
||||
|
||||
func (o NodeAlertListInput) ToCommonAlertListInput() CommonAlertListInput {
|
||||
return CommonAlertListInput{
|
||||
AlertListInput: o.AlertListInput,
|
||||
Metric: o.Metric,
|
||||
}
|
||||
}
|
||||
|
||||
type AlertV1Details struct {
|
||||
AlertDetails
|
||||
|
||||
@@ -185,7 +233,7 @@ type NodeAlertDetails struct {
|
||||
}
|
||||
|
||||
type NodeAlertUpdateInput struct {
|
||||
V1AlertUpdateInput
|
||||
AlertUpdateInput
|
||||
|
||||
// 监控指标名称
|
||||
Metric *string `json:"metric"`
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
|
||||
package monitor
|
||||
|
||||
import "time"
|
||||
|
||||
var (
|
||||
UNIFIED_MONITOR_FIELD_OPT_TYPE = []string{"Aggregations", "Selectors"}
|
||||
UNIFIED_MONITOR_GROUPBY_OPT_TYPE = []string{"time", "tag", "fill"}
|
||||
@@ -83,3 +85,25 @@ type MetricInputQuery struct {
|
||||
Signature string `json:"signature"`
|
||||
ShowMeta bool `json:"show_meta"`
|
||||
}
|
||||
|
||||
type SimpleQueryInput struct {
|
||||
// 资源Id, 可以不填, 代表查询指定监控的所有监控数据
|
||||
Id string `json:"id"`
|
||||
// 查询指定数据库
|
||||
// default: telegraf
|
||||
Database string `json:"database"`
|
||||
// 监控指标: https://github.com/codelinz/cloudpods/blob/monitor/pkg/cloudprovider/metrics.go
|
||||
MetricName string `json:"metric_name"`
|
||||
// 开始时间
|
||||
StartTime time.Time `json:"start_time"`
|
||||
// 结束时间
|
||||
EndTime time.Time `json:"end_time"`
|
||||
// 指定标签
|
||||
Tags map[string]string `json:"tag_pairs"`
|
||||
}
|
||||
|
||||
type SimpleQueryOutput struct {
|
||||
Id string `json:"id"`
|
||||
Time time.Time `json:"time"`
|
||||
Value float64 `json:"value"`
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ type ReceiveDetail struct {
|
||||
ReceiverId string `json:"receiver_id"`
|
||||
ReceiverName string `json:"receiver_name"`
|
||||
Contact string `json:"contact"`
|
||||
ReceiverType string `json:"receiver_type"`
|
||||
SendAt time.Time `json:"sendAt"`
|
||||
SendBy string `json:"send_by"`
|
||||
Status string `json:"status"`
|
||||
|
||||
@@ -43,6 +43,9 @@ type ReceiverCreateInput struct {
|
||||
// description: enabled contact types for user
|
||||
// example: {"email", "mobile", "feishu", "dingtalk", "workwx"}
|
||||
EnabledContactTypes []string `json:"enabled_contact_types"`
|
||||
|
||||
// force verified if admin create the records
|
||||
ForceVerified bool `json:"force_verified"`
|
||||
}
|
||||
|
||||
type SInternationalMobile struct {
|
||||
@@ -129,6 +132,8 @@ type ReceiverUpdateInput struct {
|
||||
// description: enabled contacts for user
|
||||
// example: {"email", "mobile", "feishu", "dingtalk", "workwx"}
|
||||
EnabledContactTypes []string `json:"enabled_contact_types"`
|
||||
|
||||
ForceVerified bool `json:"force_verified"`
|
||||
}
|
||||
|
||||
type ReceiverTriggerVerifyInput struct {
|
||||
|
||||
@@ -67,6 +67,8 @@ type Application struct {
|
||||
idleConnsClosed chan struct{}
|
||||
httpServer *http.Server
|
||||
slaveHttpServer *http.Server
|
||||
|
||||
isTLS bool
|
||||
}
|
||||
|
||||
const (
|
||||
@@ -315,6 +317,9 @@ func (app *Application) defaultHandle(w http.ResponseWriter, r *http.Request, ri
|
||||
w.Header().Set("Server", "Yunion AppServer/Go/2018.4")
|
||||
w.Header().Set("X-Frame-Options", "SAMEORIGIN")
|
||||
w.Header().Set("X-XSS-Protection", "1; mode=block")
|
||||
if app.isTLS {
|
||||
w.Header().Set("Strict-Transport-Security", "max-age=31536000; includeSubDomains")
|
||||
}
|
||||
isCors := app.handleCORS(w, r)
|
||||
handler := app.getRoot(r.Method).Match(segs, params)
|
||||
if handler != nil {
|
||||
@@ -500,6 +505,7 @@ func (app *Application) ListenAndServeWithoutCleanup(addr, certFile, keyFile str
|
||||
}
|
||||
|
||||
func (app *Application) ListenAndServeTLSWithCleanup2(addr string, certFile, keyFile string, onStop func(), isMaster bool) {
|
||||
app.isTLS = true
|
||||
httpSrv := app.initServer(addr)
|
||||
if isMaster {
|
||||
app.addDefaultHandlers()
|
||||
|
||||
@@ -41,11 +41,9 @@ var (
|
||||
baremetalAgent *SBaremetalAgent
|
||||
)
|
||||
|
||||
//
|
||||
// BaremetalAgent has two types of address
|
||||
// - AccessAddress/Address: this is the address controller to accesss the agent
|
||||
// - ListenAddress: this is the address baremetal to access the agent
|
||||
//
|
||||
type SBaremetalAgent struct {
|
||||
agent.SBaseAgent
|
||||
|
||||
@@ -84,6 +82,10 @@ func (agent *SBaremetalAgent) GetAdminSession() *mcclient.ClientSession {
|
||||
return auth.GetAdminSession(context.TODO(), o.Options.Region)
|
||||
}
|
||||
|
||||
func (agent *SBaremetalAgent) GetPublicAdminSession() *mcclient.ClientSession {
|
||||
return auth.GetAdminSessionWithPublic(context.TODO(), o.Options.Region)
|
||||
}
|
||||
|
||||
func (agent *SBaremetalAgent) GetListenIP() (net.IP, error) {
|
||||
return agent.FindListenIP(o.Options.ListenAddress)
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ import (
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
api "yunion.io/x/onecloud/pkg/apis/compute"
|
||||
apiidenty "yunion.io/x/onecloud/pkg/apis/identity"
|
||||
o "yunion.io/x/onecloud/pkg/baremetal/options"
|
||||
"yunion.io/x/onecloud/pkg/baremetal/profiles"
|
||||
"yunion.io/x/onecloud/pkg/baremetal/pxe"
|
||||
@@ -100,6 +101,10 @@ func (m *SBaremetalManager) GetClientSession() *mcclient.ClientSession {
|
||||
return m.Agent.GetAdminSession()
|
||||
}
|
||||
|
||||
func (m *SBaremetalManager) GetPublicClientSession() *mcclient.ClientSession {
|
||||
return m.Agent.GetPublicAdminSession()
|
||||
}
|
||||
|
||||
func (m *SBaremetalManager) GetZoneId() string {
|
||||
return m.Agent.Zone.Id
|
||||
}
|
||||
@@ -549,6 +554,10 @@ func (b *SBaremetalInstance) GetClientSession() *mcclient.ClientSession {
|
||||
return b.manager.GetClientSession()
|
||||
}
|
||||
|
||||
func (b *SBaremetalInstance) GetPublicClientSession() *mcclient.ClientSession {
|
||||
return b.manager.GetPublicClientSession()
|
||||
}
|
||||
|
||||
func (b *SBaremetalInstance) Keyword() string {
|
||||
return "host"
|
||||
}
|
||||
@@ -1061,7 +1070,15 @@ func (b *SBaremetalInstance) getTftpFileUrl(filename string) string {
|
||||
return fmt.Sprintf("http://%s/tftp/%s", endpoint, filename)
|
||||
}
|
||||
|
||||
func (b *SBaremetalInstance) GetImageCacheUrl() string {
|
||||
func (b *SBaremetalInstance) GetImageUrl(disableImageCache bool) string {
|
||||
if disableImageCache {
|
||||
url, err := b.GetPublicClientSession().GetServiceURL(apis.SERVICE_TYPE_IMAGE, apiidenty.EndpointInterfacePublic, "")
|
||||
if err != nil {
|
||||
log.Errorf("Get image public url: %v", err)
|
||||
return ""
|
||||
}
|
||||
return url
|
||||
}
|
||||
serverIP, err := b.manager.Agent.GetDHCPServerIP()
|
||||
if err != nil {
|
||||
log.Errorf("Get http file server: %v", err)
|
||||
@@ -1607,7 +1624,7 @@ func (b *SBaremetalInstance) adjustUEFIWrapper(cli *ssh.Client, f func() error)
|
||||
return errors.Wrap(err, "Check is uefi boot")
|
||||
}
|
||||
if !isUEFI {
|
||||
return nil
|
||||
return b.CleanUEFIInfo()
|
||||
}
|
||||
return f()
|
||||
}
|
||||
@@ -1625,13 +1642,8 @@ func (b *SBaremetalInstance) AdjustUEFICurrentBootOrder(hostCli *ssh.Client) err
|
||||
})
|
||||
}
|
||||
|
||||
func (b *SBaremetalInstance) SendUEFIInfo(mgr *uefi.BootMgr) error {
|
||||
info, err := mgr.ToEFIBootMgrInfo()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
func (b *SBaremetalInstance) updateUEFIInfo(uefiData jsonutils.JSONObject) error {
|
||||
desc := b.desc
|
||||
uefiData := jsonutils.Marshal(info)
|
||||
desc.Add(uefiData, "uefi_info")
|
||||
if err := b.SaveDesc(desc); err != nil {
|
||||
return errors.Wrap(err, "Save uefi_info")
|
||||
@@ -1644,6 +1656,24 @@ func (b *SBaremetalInstance) SendUEFIInfo(mgr *uefi.BootMgr) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *SBaremetalInstance) CleanUEFIInfo() error {
|
||||
if err := b.updateUEFIInfo(jsonutils.NewDict()); err != nil {
|
||||
return errors.Wrap(err, "CleanUEFIInfo")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *SBaremetalInstance) SendUEFIInfo(mgr *uefi.BootMgr) error {
|
||||
info, err := mgr.ToEFIBootMgrInfo()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := b.updateUEFIInfo(jsonutils.Marshal(info)); err != nil {
|
||||
return errors.Wrap(err, "SendUEFIInfo")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *SBaremetalInstance) adjustServerUEFIBootOrder(srvCli *ssh.Client) error {
|
||||
return b.adjustUEFIWrapper(srvCli, func() error {
|
||||
info, err := b.GetUEFIInfo()
|
||||
@@ -2651,10 +2681,10 @@ func replaceHostAddr(urlStr string, addr string) string {
|
||||
return urlComp.String()
|
||||
}
|
||||
|
||||
func (s *SBaremetalServer) doCreateRoot(term *ssh.Client, devName string) error {
|
||||
func (s *SBaremetalServer) doCreateRoot(term *ssh.Client, devName string, disableImageCache bool) error {
|
||||
session := s.baremetal.GetClientSession()
|
||||
token := session.GetToken().GetTokenString()
|
||||
urlStr := s.baremetal.GetImageCacheUrl()
|
||||
urlStr := s.baremetal.GetImageUrl(disableImageCache)
|
||||
imageId := s.GetRootTemplateId()
|
||||
cmd := fmt.Sprintf("/lib/mos/rootcreate.sh %s %s %s %s", token, urlStr, imageId, devName)
|
||||
log.Infof("rootcreate cmd: %q", cmd)
|
||||
@@ -2664,7 +2694,7 @@ func (s *SBaremetalServer) doCreateRoot(term *ssh.Client, devName string) error
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *SBaremetalServer) DoPartitionDisk(tool *disktool.SSHPartitionTool, term *ssh.Client) ([]*disktool.Partition, error) {
|
||||
func (s *SBaremetalServer) DoPartitionDisk(tool *disktool.SSHPartitionTool, term *ssh.Client, disableImageCache bool) ([]*disktool.Partition, error) {
|
||||
raid, nonRaid, pcie, err := detect_storages.DetectStorageInfo(term, false)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -2697,7 +2727,7 @@ func (s *SBaremetalServer) DoPartitionDisk(tool *disktool.SSHPartitionTool, term
|
||||
if len(rootImageId) > 0 {
|
||||
rootDisk := disks[0]
|
||||
rootSize, _ := rootDisk.Int("size")
|
||||
err = s.doCreateRoot(term, tool.GetRootDisk().GetDevName())
|
||||
err = s.doCreateRoot(term, tool.GetRootDisk().GetDevName(), disableImageCache)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "Failed to create root")
|
||||
}
|
||||
@@ -2739,7 +2769,7 @@ func (s *SBaremetalServer) DoPartitionDisk(tool *disktool.SSHPartitionTool, term
|
||||
return tool.GetPartitions(), nil
|
||||
}
|
||||
|
||||
func (s *SBaremetalServer) DoRebuildRootDisk(tool *disktool.SSHPartitionTool, term *ssh.Client) ([]*disktool.Partition, error) {
|
||||
func (s *SBaremetalServer) DoRebuildRootDisk(tool *disktool.SSHPartitionTool, term *ssh.Client, disableImageCache bool) ([]*disktool.Partition, error) {
|
||||
// raid, nonRaid, pcie, err := detect_storages.DetectStorageInfo(term, false)
|
||||
// if err != nil {
|
||||
// return nil, err
|
||||
@@ -2770,7 +2800,7 @@ func (s *SBaremetalServer) DoRebuildRootDisk(tool *disktool.SSHPartitionTool, te
|
||||
rootDisk := disks[0]
|
||||
rootSize, _ := rootDisk.Int("size")
|
||||
rd := tool.GetRootDisk()
|
||||
err := s.doCreateRoot(term, rd.GetDevName())
|
||||
err := s.doCreateRoot(term, rd.GetDevName(), disableImageCache)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Failed to create root: %v", err)
|
||||
}
|
||||
@@ -2847,7 +2877,9 @@ func (s *SBaremetalServer) DoDeploy(tool *disktool.SSHPartitionTool, term *ssh.C
|
||||
password = seclib.RandomPassword(12)
|
||||
}
|
||||
deployInfo := deployapi.NewDeployInfo(publicKey, deployapi.JsonDeploysToStructs(deploys),
|
||||
password, isInit, true, o.Options.LinuxDefaultRootUser, o.Options.WindowsDefaultAdminUser, false, "")
|
||||
password, isInit, true, o.Options.LinuxDefaultRootUser, o.Options.WindowsDefaultAdminUser, false, "",
|
||||
false, "",
|
||||
)
|
||||
return s.deployFs(tool, term, deployInfo)
|
||||
}
|
||||
|
||||
|
||||
@@ -69,6 +69,10 @@ func (self *SBaremetalServerBaseDeployTask) NeedPXEBoot() bool {
|
||||
return self.needPXEBoot
|
||||
}
|
||||
|
||||
func (self *SBaremetalServerBaseDeployTask) IsDisableImageCache() bool {
|
||||
return jsonutils.QueryBoolean(self.data, "disable_image_cache", false)
|
||||
}
|
||||
|
||||
func (self *SBaremetalServerBaseDeployTask) GetFinishAction() string {
|
||||
if self.data != nil {
|
||||
action, _ := self.data.GetString("on_finish")
|
||||
|
||||
@@ -97,7 +97,7 @@ func (self *SBaremetalCdromTask) DoInsertISO(ctx context.Context, args interface
|
||||
if !fileutils2.Exists(localImagePath) {
|
||||
return errors.Error("image not cached")
|
||||
}
|
||||
imageBaseUrl := self.Baremetal.GetImageCacheUrl()
|
||||
imageBaseUrl := self.Baremetal.GetImageUrl(true)
|
||||
if len(imageBaseUrl) == 0 {
|
||||
return errors.Error("empty image base url")
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ func (self *SBaremetalServerCreateTask) DoDeploys(term *ssh.Client) (jsonutils.J
|
||||
return nil, self.onError(term, err)
|
||||
}
|
||||
time.Sleep(2 * time.Second)
|
||||
parts, err := self.Baremetal.GetServer().DoPartitionDisk(tool, term)
|
||||
parts, err := self.Baremetal.GetServer().DoPartitionDisk(tool, term, self.IsDisableImageCache())
|
||||
if err != nil {
|
||||
return nil, self.onError(term, err)
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ type IBaremetal interface {
|
||||
GenerateBootISO() error
|
||||
SendNicInfo(nic *types.SNicDevInfo, idx int, nicType string, reset bool, ipAddr string, reserve bool) error
|
||||
DoNTPConfig() error
|
||||
GetImageCacheUrl() string
|
||||
GetImageUrl(needImageCache bool) string
|
||||
|
||||
RemoveServer()
|
||||
InitializeServer(session *mcclient.ClientSession, name string) error
|
||||
|
||||
@@ -55,7 +55,7 @@ func (self *SBaremetalServerRebuildTask) DoDeploys(term *ssh.Client) (jsonutils.
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "NewConfigedSSHPartitionTool")
|
||||
}
|
||||
parts, err := self.Baremetal.GetServer().DoRebuildRootDisk(tool, term)
|
||||
parts, err := self.Baremetal.GetServer().DoRebuildRootDisk(tool, term, self.IsDisableImageCache())
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Rebuild root disk: %v", err)
|
||||
}
|
||||
|
||||
@@ -31,9 +31,9 @@ type IBaremetalServer interface {
|
||||
DoDiskUnconfig(term *ssh.Client) error
|
||||
DoDiskConfig(term *ssh.Client) (*disktool.SSHPartitionTool, error)
|
||||
DoEraseDisk(term *ssh.Client) error
|
||||
DoPartitionDisk(tool *disktool.SSHPartitionTool, term *ssh.Client) ([]*disktool.Partition, error)
|
||||
DoPartitionDisk(tool *disktool.SSHPartitionTool, term *ssh.Client, disableImageCache bool) ([]*disktool.Partition, error)
|
||||
NewConfigedSSHPartitionTool(term *ssh.Client) (*disktool.SSHPartitionTool, error)
|
||||
DoRebuildRootDisk(tool *disktool.SSHPartitionTool, term *ssh.Client) ([]*disktool.Partition, error)
|
||||
DoRebuildRootDisk(tool *disktool.SSHPartitionTool, term *ssh.Client, disableImageCache bool) ([]*disktool.Partition, error)
|
||||
SyncPartitionSize(term *ssh.Client, parts []*disktool.Partition) ([]jsonutils.JSONObject, error)
|
||||
DoDeploy(tool *disktool.SSHPartitionTool, term *ssh.Client, data jsonutils.JSONObject, isInit bool) (jsonutils.JSONObject, error)
|
||||
SaveDesc(desc jsonutils.JSONObject) error
|
||||
|
||||
@@ -1 +1,15 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package grub // import "yunion.io/x/onecloud/pkg/baremetal/utils/grub"
|
||||
|
||||
@@ -18,7 +18,9 @@ import "fmt"
|
||||
|
||||
func GetYunionOSConfig(sleepTime int, httpSite, kernel string, kernelArgs string, initrd string) string {
|
||||
kernel = fmt.Sprintf("(http,${http_site})/tftp/%s", kernel)
|
||||
// kernel = fmt.Sprintf("(tftp,10.127.100.2)/%s", kernel)
|
||||
initrd = fmt.Sprintf("(http,${http_site})/tftp/%s", initrd)
|
||||
// initrd = fmt.Sprintf("(tftp,10.127.100.2)/%s", initrd)
|
||||
return fmt.Sprintf(`
|
||||
set timeout=%d
|
||||
set http_site=%s
|
||||
|
||||
@@ -62,7 +62,11 @@ func InitAuth(options *common_options.CommonOptions, authComplete auth.AuthCompl
|
||||
|
||||
if options.SessionEndpointType != "" {
|
||||
if !utils.IsInStringArray(options.SessionEndpointType,
|
||||
[]string{identity.EndpointInterfacePublic, identity.EndpointInterfaceInternal}) {
|
||||
[]string{
|
||||
identity.EndpointInterfacePublic,
|
||||
identity.EndpointInterfaceInternal,
|
||||
identity.EndpointInterfaceApigateway,
|
||||
}) {
|
||||
log.Fatalf("Invalid session endpoint type %s", options.SessionEndpointType)
|
||||
}
|
||||
auth.SetEndpointType(options.SessionEndpointType)
|
||||
@@ -85,10 +89,12 @@ func InitAuth(options *common_options.CommonOptions, authComplete auth.AuthCompl
|
||||
|
||||
InitBaseAuth(&options.BaseOptions)
|
||||
|
||||
watcher := newEndpointChangeManager()
|
||||
watcher.StartWatching(&identity_modules.EndpointsV3)
|
||||
if options.SessionEndpointType == identity.EndpointInterfaceInternal {
|
||||
watcher := newEndpointChangeManager()
|
||||
watcher.StartWatching(&identity_modules.EndpointsV3)
|
||||
|
||||
startEtcdEndpointPuller()
|
||||
startEtcdEndpointPuller()
|
||||
}
|
||||
}
|
||||
|
||||
func InitBaseAuth(options *common_options.BaseOptions) {
|
||||
@@ -106,7 +112,7 @@ func FetchEtcdServiceInfo() (*identity.EndpointDetails, error) {
|
||||
|
||||
func startEtcdEndpointPuller() {
|
||||
retryInterval := 60
|
||||
etecdUrl, err := auth.GetServiceURL(apis.SERVICE_TYPE_ETCD, consts.GetRegion(), "", "")
|
||||
etecdUrl, err := auth.GetServiceURL(apis.SERVICE_TYPE_ETCD, consts.GetRegion(), "", identity.EndpointInterfaceInternal)
|
||||
if err != nil {
|
||||
log.Errorf("[etcd] GetServiceURL fail %s, retry after %d seconds", err, retryInterval)
|
||||
} else if len(etecdUrl) == 0 {
|
||||
|
||||
@@ -38,6 +38,7 @@ var (
|
||||
)
|
||||
|
||||
type TCronJobFunction func(ctx context.Context, userCred mcclient.TokenCredential, isStart bool)
|
||||
type TCronJobFunctionWithStartTime func(ctx context.Context, userCred mcclient.TokenCredential, start time.Time, isStart bool)
|
||||
|
||||
var manager *SCronJobManager
|
||||
|
||||
@@ -72,11 +73,13 @@ func (t *TimerHour) Next(now time.Time) time.Time {
|
||||
}
|
||||
|
||||
type SCronJob struct {
|
||||
Name string
|
||||
job TCronJobFunction
|
||||
Timer ICronTimer
|
||||
Next time.Time
|
||||
StartRun bool
|
||||
Name string
|
||||
job TCronJobFunction
|
||||
jobWithStartTime TCronJobFunctionWithStartTime
|
||||
Timer ICronTimer
|
||||
Next time.Time
|
||||
StartRun bool
|
||||
times []time.Time
|
||||
}
|
||||
|
||||
type CronJobTimerHeap []*SCronJob
|
||||
@@ -161,6 +164,38 @@ func (self *SCronJobManager) AddJobAtIntervals(name string, interval time.Durati
|
||||
return self.AddJobAtIntervalsWithStartRun(name, interval, jobFunc, false)
|
||||
}
|
||||
|
||||
func (self *SCronJobManager) AddJobAtIntervalsWithStarTime(name string, interval time.Duration, jobFunc TCronJobFunctionWithStartTime) error {
|
||||
return self.AddJobAtIntervalsWithStarTimeStartRun(name, interval, jobFunc, false)
|
||||
}
|
||||
|
||||
func (self *SCronJobManager) AddJobAtIntervalsWithStarTimeStartRun(name string, interval time.Duration, jobFunc TCronJobFunctionWithStartTime, startRun bool) error {
|
||||
if interval <= 0 {
|
||||
return errors.Error("AddJobAtIntervals: interval must > 0")
|
||||
}
|
||||
self.dataLock.Lock()
|
||||
defer self.dataLock.Unlock()
|
||||
|
||||
if !self.IsNameUnique(name) {
|
||||
return ErrCronJobNameConflict
|
||||
}
|
||||
|
||||
t := Timer1{
|
||||
dur: interval,
|
||||
}
|
||||
job := SCronJob{
|
||||
Name: name,
|
||||
jobWithStartTime: jobFunc,
|
||||
Timer: &t,
|
||||
StartRun: startRun,
|
||||
}
|
||||
if !self.running {
|
||||
self.jobs = append(self.jobs, &job)
|
||||
} else {
|
||||
self.addJob(&job)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *SCronJobManager) AddJobAtIntervalsWithStartRun(name string, interval time.Duration, jobFunc TCronJobFunction, startRun bool) error {
|
||||
if interval <= 0 {
|
||||
return errors.Error("AddJobAtIntervals: interval must > 0")
|
||||
@@ -268,7 +303,7 @@ func (self *SCronJobManager) addJob(newJob *SCronJob) {
|
||||
now := time.Now()
|
||||
newJob.Next = newJob.Timer.Next(now)
|
||||
if newJob.StartRun {
|
||||
newJob.runJob(true)
|
||||
newJob.runJob(true, now)
|
||||
}
|
||||
heap.Push(&self.jobs, newJob)
|
||||
go func() { self.add <- struct{}{} }()
|
||||
@@ -335,7 +370,7 @@ func (self *SCronJobManager) init() {
|
||||
for i := 0; i < len(self.jobs); i += 1 {
|
||||
if self.jobs[i].StartRun {
|
||||
self.jobs[i].StartRun = false
|
||||
self.jobs[i].runJob(true)
|
||||
self.jobs[i].runJob(true, now)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -369,7 +404,7 @@ func (self *SCronJobManager) runJobs(now time.Time) {
|
||||
defer self.dataLock.Unlock()
|
||||
for i := 0; i < len(self.jobs); i++ {
|
||||
if !(self.jobs[i].Next.After(now) || self.jobs[i].Next.IsZero()) {
|
||||
self.jobs[i].runJob(false)
|
||||
self.jobs[i].runJob(false, now)
|
||||
self.jobs[i].Next = self.jobs[i].Timer.Next(now)
|
||||
heap.Fix(&self.jobs, i)
|
||||
}
|
||||
@@ -377,19 +412,25 @@ func (self *SCronJobManager) runJobs(now time.Time) {
|
||||
}
|
||||
|
||||
func (job *SCronJob) Run() {
|
||||
job.runJobInWorker(job.StartRun)
|
||||
startTime := time.Now()
|
||||
if len(job.times) > 0 {
|
||||
startTime = job.times[0]
|
||||
job.times = job.times[1:]
|
||||
}
|
||||
job.runJobInWorker(job.StartRun, startTime)
|
||||
}
|
||||
|
||||
func (job *SCronJob) Dump() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (job *SCronJob) runJob(isStart bool) {
|
||||
func (job *SCronJob) runJob(isStart bool, now time.Time) {
|
||||
job.StartRun = isStart
|
||||
job.times = append(job.times, now)
|
||||
manager.workers.Run(job, nil, nil)
|
||||
}
|
||||
|
||||
func (job *SCronJob) runJobInWorker(isStart bool) {
|
||||
func (job *SCronJob) runJobInWorker(isStart bool, startTime time.Time) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
log.Errorf("CronJob task %s run error: %s", job.Name, r)
|
||||
@@ -397,10 +438,14 @@ func (job *SCronJob) runJobInWorker(isStart bool) {
|
||||
}
|
||||
}()
|
||||
|
||||
log.Debugf("Cron job: %s started", job.Name)
|
||||
log.Debugf("Cron job: %s started, startTime: %s", job.Name, startTime)
|
||||
ctx := context.Background()
|
||||
ctx = context.WithValue(ctx, appctx.APP_CONTEXT_KEY_APPNAME, "Cron-Service")
|
||||
ctx = context.WithValue(ctx, appctx.APP_CONTEXT_KEY_TASKNAME, fmt.Sprintf("%s-%d", job.Name, time.Now().Unix()))
|
||||
userCred := DefaultAdminSessionGenerator()
|
||||
job.job(ctx, userCred, isStart)
|
||||
if job.job != nil {
|
||||
job.job(ctx, userCred, isStart)
|
||||
} else if job.jobWithStartTime != nil {
|
||||
job.jobWithStartTime(ctx, userCred, startTime, isStart)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1684,6 +1684,7 @@ func updateItem(manager IModelManager, item IModel, ctx context.Context, userCre
|
||||
if len(diff) > 0 {
|
||||
OpsLog.LogEvent(item, ACT_UPDATE, diff, userCred)
|
||||
logclient.AddActionLogWithContext(ctx, item, logclient.ACT_UPDATE, diff, userCred, true)
|
||||
CallUpdateNotifyHook(ctx, userCred, item)
|
||||
}
|
||||
|
||||
item.PostUpdate(ctx, userCred, query, data)
|
||||
|
||||
@@ -692,6 +692,17 @@ func IsMetadataKeySystemAdmin(key string) bool {
|
||||
return strings.HasPrefix(key, SYSTEM_ADMIN_PREFIX)
|
||||
}
|
||||
|
||||
func IsMetadataKeyPrivateKey(key string) bool {
|
||||
for _, k := range []string{"admin", "project"} {
|
||||
for _, v := range []string{"ssh-private-key", "ssh-public-key"} {
|
||||
if key == fmt.Sprintf("%s-%s", k, v) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return strings.HasPrefix(key, SYSTEM_ADMIN_PREFIX)
|
||||
}
|
||||
|
||||
func IsMetadataKeySysTag(key string) bool {
|
||||
return strings.HasPrefix(key, SYS_TAG_PREFIX)
|
||||
}
|
||||
@@ -701,7 +712,7 @@ func (manager *SMetadataManager) GetSysadminKey(key string) string {
|
||||
}
|
||||
|
||||
func IsMetadataKeyVisiable(key string) bool {
|
||||
return !(IsMetadataKeySysTag(key) || IsMetadataKeySystemAdmin(key))
|
||||
return !(IsMetadataKeySysTag(key) || IsMetadataKeySystemAdmin(key) || IsMetadataKeyPrivateKey(key))
|
||||
}
|
||||
|
||||
func GetVisiableMetadata(ctx context.Context, model IStandaloneModel, userCred mcclient.TokenCredential) (map[string]string, error) {
|
||||
|
||||
@@ -12,20 +12,30 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package collectors
|
||||
package db
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/pkg/cloudmon/collectors/common"
|
||||
"yunion.io/x/onecloud/pkg/cloudmon/options"
|
||||
"context"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/util/shellutils"
|
||||
)
|
||||
|
||||
func init() {
|
||||
shellutils.R(&options.ReportOptions{}, "report-host", "Report Host", reportHost)
|
||||
var (
|
||||
updateNotifyHook updateNotifyHookFunc
|
||||
)
|
||||
|
||||
type updateNotifyHookFunc func(ctx context.Context, userCred mcclient.TokenCredential, obj IModel)
|
||||
|
||||
func SetUpdateNotifyHook(f updateNotifyHookFunc) {
|
||||
if updateNotifyHook != nil {
|
||||
panic("updateNotifyHook already set")
|
||||
}
|
||||
updateNotifyHook = f
|
||||
}
|
||||
|
||||
//入口函数[aliyun、huawei]
|
||||
func reportHost(session *mcclient.ClientSession, args *options.ReportOptions) error {
|
||||
return common.ReportCloudMetricOfoperatorType(string(common.HOST), session, args)
|
||||
func CallUpdateNotifyHook(ctx context.Context, userCred mcclient.TokenCredential, obj IModel) {
|
||||
if updateNotifyHook == nil {
|
||||
return
|
||||
}
|
||||
updateNotifyHook(ctx, userCred, obj)
|
||||
}
|
||||
@@ -150,6 +150,9 @@ const (
|
||||
ACT_VM_DEPLOY = "deploy"
|
||||
ACT_VM_DEPLOY_FAIL = "deploy_fail"
|
||||
|
||||
ACT_SET_USER_PASSWORD = "set_user_password"
|
||||
ACT_SET_USER_PASSWORD_FAIL = "set_user_password_fail"
|
||||
|
||||
ACT_VM_IO_THROTTLE = "io_throttle"
|
||||
ACT_VM_IO_THROTTLE_FAIL = "io_throttle_fail"
|
||||
|
||||
|
||||
@@ -178,6 +178,10 @@ func (manager *SProjectizedResourceBaseManager) FetchCustomizeColumns(
|
||||
}
|
||||
}
|
||||
}
|
||||
domainRows := manager.SDomainizedResourceBaseManager.FetchCustomizeColumns(ctx, userCred, query, objs, fields, isList)
|
||||
for i := range ret {
|
||||
ret[i].DomainizedResourceInfo = domainRows[i]
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ type SVirtualResourceBase struct {
|
||||
IsSystem bool `nullable:"true" default:"false" list:"admin" create:"optional" json:"is_system"`
|
||||
|
||||
// 资源放入回收站时间
|
||||
PendingDeletedAt time.Time `json:"pending_deleted_at" list:"user"`
|
||||
PendingDeletedAt time.Time `json:"pending_deleted_at" list:"user" update:"admin"`
|
||||
// 资源是否处于回收站中
|
||||
PendingDeleted bool `nullable:"false" default:"false" index:"true" get:"user" list:"user" json:"pending_deleted"`
|
||||
// 资源是否被冻结
|
||||
@@ -608,6 +608,8 @@ func (model *SVirtualResourceBase) GetShortDesc(ctx context.Context) *jsonutils.
|
||||
tc, _ := TenantCacheManager.FetchTenantById(ctx, model.ProjectId)
|
||||
if tc != nil {
|
||||
desc.Add(jsonutils.NewString(tc.GetName()), "owner_tenant")
|
||||
metadata, _ := GetVisiableMetadata(ctx, tc, nil)
|
||||
desc.Set("project_tags", jsonutils.Marshal(metadata))
|
||||
}
|
||||
return desc
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ package notifyclient
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
@@ -36,10 +37,30 @@ var (
|
||||
|
||||
notifyAdminUsers []string
|
||||
notifyAdminGroups []string
|
||||
|
||||
notifyDBHookResources sync.Map
|
||||
)
|
||||
|
||||
func init() {
|
||||
notifyClientWorkerMan = appsrv.NewWorkerManager("NotifyClientWorkerManager", 1, 50, false)
|
||||
|
||||
// set db notify hook
|
||||
db.SetUpdateNotifyHook(func(ctx context.Context, userCred mcclient.TokenCredential, obj db.IModel) {
|
||||
_, ok := notifyDBHookResources.Load(obj.KeywordPlural())
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
EventNotify(ctx, userCred, SEventNotifyParam{
|
||||
Obj: obj,
|
||||
Action: ActionUpdate,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
func AddNotifyDBHookResources(keywordPlurals ...string) {
|
||||
for _, kp := range keywordPlurals {
|
||||
notifyDBHookResources.Store(kp, true)
|
||||
}
|
||||
}
|
||||
|
||||
func NotifyWithCtx(ctx context.Context, recipientId []string, isGroup bool, priority npk.TNotifyPriority, event string, data jsonutils.JSONObject) {
|
||||
|
||||
@@ -53,9 +53,6 @@ func OnBaseOptionsChange(oOpts, nOpts interface{}) bool {
|
||||
if oldOpts.ApiServer != newOpts.ApiServer {
|
||||
log.Debugf("api_server changed from %s to %s", oldOpts.ApiServer, newOpts.ApiServer)
|
||||
}
|
||||
if oldOpts.EnableTlsMigration != newOpts.EnableTlsMigration {
|
||||
log.Debugf("enable_tls_migration changed from %v to %v", oldOpts.EnableTlsMigration, newOpts.EnableTlsMigration)
|
||||
}
|
||||
return changed
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,9 @@ import (
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/util/reflectutils"
|
||||
|
||||
identity_api "yunion.io/x/onecloud/pkg/apis/identity"
|
||||
"yunion.io/x/onecloud/pkg/appsrv"
|
||||
"yunion.io/x/onecloud/pkg/cloudcommon/consts"
|
||||
"yunion.io/x/onecloud/pkg/cloudcommon/syncman/watcher"
|
||||
@@ -78,7 +80,13 @@ func StartOptionManagerWithSessionDriver(options interface{}, refreshSeconds int
|
||||
OptionManager.FirstSync()
|
||||
|
||||
if session.IsRemote() {
|
||||
OptionManager.StartWatching(&identity.ServicesV3)
|
||||
var opts *CommonOptions
|
||||
err := reflectutils.FindAnonymouStructPointer(options, &opts)
|
||||
if err != nil {
|
||||
log.Errorf("cannot find CommonOptions in options")
|
||||
} else if opts.SessionEndpointType == identity_api.EndpointInterfaceInternal {
|
||||
OptionManager.StartWatching(&identity.ServicesV3)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -110,8 +110,6 @@ type BaseOptions struct {
|
||||
|
||||
PlatformName string `help:"identity name of this platform" default:"Cloudpods"`
|
||||
PlatformNames map[string]string `help:"identity name of this platform by language"`
|
||||
|
||||
EnableTlsMigration bool `help:"Enable TLS migration" default:"false"`
|
||||
}
|
||||
|
||||
const (
|
||||
|
||||
@@ -239,14 +239,14 @@ type policyTask struct {
|
||||
}
|
||||
|
||||
func (t *policyTask) Run() {
|
||||
val := t.manager.policyCache.Get(t.key)
|
||||
val := t.manager.policyCache.AtomicGet(t.key)
|
||||
result := fetchResult{}
|
||||
if gotypes.IsNil(val) {
|
||||
pg, err := DefaultPolicyFetcher(context.Background(), t.userCred)
|
||||
if err != nil {
|
||||
result.err = errors.Wrap(err, "DefaultPolicyFetcher")
|
||||
} else {
|
||||
t.manager.policyCache.Set(t.key, pg)
|
||||
t.manager.policyCache.AtomicSet(t.key, pg)
|
||||
result.output = pg
|
||||
}
|
||||
} else {
|
||||
@@ -297,7 +297,7 @@ func (manager *SPolicyManager) allow(scope rbacutils.TRbacScope, userCred mcclie
|
||||
policySet = rbacutils.TPolicySet{}
|
||||
}
|
||||
result := manager.allowWithoutCache(policySet, scope, userCred, service, resource, action, extra...)
|
||||
manager.permissionCache.Set(key, result)
|
||||
manager.permissionCache.AtomicSet(key, result)
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
@@ -828,6 +828,10 @@ func NewIPv4AddrValidator(key string) *ValidatorIPv4Addr {
|
||||
}
|
||||
|
||||
var ValidateModel = func(userCred mcclient.TokenCredential, manager db.IStandaloneModelManager, id *string) (db.IModel, error) {
|
||||
if len(*id) == 0 {
|
||||
return nil, httperrors.NewMissingParameterError(manager.Keyword())
|
||||
}
|
||||
|
||||
model, err := manager.FetchByIdOrName(userCred, *id)
|
||||
if err != nil {
|
||||
if errors.Cause(err) == sql.ErrNoRows {
|
||||
|
||||
@@ -1874,18 +1874,29 @@ func (self *SCloudaccount) SyncCloudroles(ctx context.Context, userCred mcclient
|
||||
return result
|
||||
}
|
||||
|
||||
func (self *SCloudaccount) GetUserCloudgroups(userId string) ([]string, error) {
|
||||
func (self *SCloudaccount) GetUserCloudgroups(userCred mcclient.TokenCredential) ([]string, error) {
|
||||
ret := []string{}
|
||||
q := CloudgroupManager.Query()
|
||||
samlusers := SamluserManager.Query("cloudgroup_id").Equals("owner_id", userId).Equals("cloudaccount_id", self.Id).SubQuery()
|
||||
q = q.In("id", samlusers)
|
||||
q := SamluserManager.Query().Equals("owner_id", userCred.GetUserId()).Equals("cloudaccount_id", self.Id)
|
||||
users := []SSamluser{}
|
||||
err := db.FetchModelObjects(SamluserManager, q, &users)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "db.FetchModelObjects")
|
||||
}
|
||||
if len(users) == 0 {
|
||||
return nil, fmt.Errorf("no available saml user for %s %s", userCred.GetUserName(), userCred.GetUserId())
|
||||
}
|
||||
groupIds := []string{}
|
||||
for i := range users {
|
||||
groupIds = append(groupIds, users[i].CloudgroupId)
|
||||
}
|
||||
q = CloudgroupManager.Query().In("id", groupIds)
|
||||
groups := []SCloudgroup{}
|
||||
err := db.FetchModelObjects(CloudgroupManager, q, &groups)
|
||||
err = db.FetchModelObjects(CloudgroupManager, q, &groups)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "db.FetchModelObjects")
|
||||
}
|
||||
if len(groups) == 0 {
|
||||
return ret, nil
|
||||
return ret, fmt.Errorf("no available cloudgroup for %s %s", userCred.GetUserName(), userCred.GetUserId())
|
||||
}
|
||||
for i := range groups {
|
||||
cache, err := CloudgroupcacheManager.Register(&groups[i], self)
|
||||
|
||||
@@ -1512,3 +1512,48 @@ func (self *SClouduser) SyncCustomCloudpoliciesForCloud(ctx context.Context, use
|
||||
|
||||
return account.SyncCustomCloudpoliciesForCloud(ctx, userCred, self)
|
||||
}
|
||||
|
||||
func (self *SClouduser) PerformCreateAccessKey(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, input api.ClouduserCreateAccessKeyInput) (jsonutils.JSONObject, error) {
|
||||
user, err := self.GetIClouduser()
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "GetIClouduser error")
|
||||
}
|
||||
ak, err := user.CreateAccessKey(input.Name)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "GetDetailsAccessKeys error")
|
||||
}
|
||||
return jsonutils.Marshal(ak), nil
|
||||
}
|
||||
|
||||
func (self *SClouduser) GetDetailsAccessKeys(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) (jsonutils.JSONObject, error) {
|
||||
user, err := self.GetIClouduser()
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "GetIClouduser")
|
||||
}
|
||||
aks, err := user.GetAccessKeys()
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "GetAccessKeys")
|
||||
}
|
||||
ret := struct {
|
||||
Data []cloudprovider.SAccessKey
|
||||
Total int
|
||||
Limit int
|
||||
}{
|
||||
Data: aks,
|
||||
Total: len(aks),
|
||||
Limit: 20,
|
||||
}
|
||||
return jsonutils.Marshal(ret), nil
|
||||
}
|
||||
|
||||
func (self *SClouduser) PerformDeleteAccessKey(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, input api.ClouduserDeleteAccessKeyInput) (jsonutils.JSONObject, error) {
|
||||
user, err := self.GetIClouduser()
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "GetIClouduser")
|
||||
}
|
||||
err = user.DeleteAccessKey(input.AccessKey)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "DeleteAccessKey")
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
@@ -68,13 +68,10 @@ func (d *SHuaweiSAMLDriver) GetIdpInitiatedLoginData(ctx context.Context, userCr
|
||||
if len(idpId) == 0 {
|
||||
return data, httperrors.NewInputParameterError("saml auth url %s missing idp", uri)
|
||||
}
|
||||
groups, err := account.GetUserCloudgroups(userCred.GetUserId())
|
||||
groups, err := account.GetUserCloudgroups(userCred)
|
||||
if err != nil {
|
||||
return data, httperrors.NewGeneralError(errors.Wrapf(err, "GetUserCloudgroups"))
|
||||
}
|
||||
if len(groups) == 0 {
|
||||
return data, httperrors.NewResourceNotFoundError("no available group found")
|
||||
}
|
||||
|
||||
data.NameId = userCred.GetUserName()
|
||||
data.NameIdFormat = samlutils.NAME_ID_FORMAT_TRANSIENT
|
||||
@@ -129,13 +126,10 @@ func (d *SHuaweiSAMLDriver) GetSpInitiatedLoginData(ctx context.Context, userCre
|
||||
return data, httperrors.NewResourceNotReadyError("SAMLProvider for account %s not ready", account.Id)
|
||||
}
|
||||
|
||||
groups, err := account.GetUserCloudgroups(userCred.GetUserId())
|
||||
groups, err := account.GetUserCloudgroups(userCred)
|
||||
if err != nil {
|
||||
return data, httperrors.NewGeneralError(errors.Wrapf(err, "GetUserCloudgroups"))
|
||||
}
|
||||
if len(groups) == 0 {
|
||||
return data, httperrors.NewResourceNotFoundError("no available group found")
|
||||
}
|
||||
|
||||
data.NameId = userCred.GetUserName()
|
||||
data.NameIdFormat = samlutils.NAME_ID_FORMAT_TRANSIENT
|
||||
|
||||
@@ -70,7 +70,10 @@ func (d *SAliyunSAMLDriver) GetIdpInitiatedLoginData(ctx context.Context, userCr
|
||||
Values: []string{v},
|
||||
})
|
||||
}
|
||||
data.RelayState = "https://homenew.console.aliyun.com/"
|
||||
if len(redirectUrl) == 0 {
|
||||
redirectUrl = "https://homenew.console.aliyun.com/"
|
||||
}
|
||||
data.RelayState = redirectUrl
|
||||
return data, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -87,7 +87,10 @@ func (d *SAWSSAMLDriver) GetIdpInitiatedLoginData(ctx context.Context, userCred
|
||||
Values: []string{v.value},
|
||||
})
|
||||
}
|
||||
data.RelayState = "https://console.aws.amazon.com/"
|
||||
if len(redirectUrl) == 0 {
|
||||
redirectUrl = "https://console.aws.amazon.com/"
|
||||
}
|
||||
data.RelayState = redirectUrl
|
||||
|
||||
return data, nil
|
||||
}
|
||||
|
||||
@@ -86,7 +86,10 @@ func (d *SAWSCNSAMLDriver) GetIdpInitiatedLoginData(ctx context.Context, userCre
|
||||
Values: []string{v.value},
|
||||
})
|
||||
}
|
||||
data.RelayState = "https://console.amazonaws.cn/"
|
||||
if len(redirectUrl) == 0 {
|
||||
redirectUrl = "https://console.amazonaws.cn/"
|
||||
}
|
||||
data.RelayState = redirectUrl
|
||||
|
||||
return data, nil
|
||||
}
|
||||
|
||||
@@ -84,7 +84,10 @@ func (d *SQcloudSAMLDriver) GetIdpInitiatedLoginData(ctx context.Context, userCr
|
||||
Values: []string{v.value},
|
||||
})
|
||||
}
|
||||
data.RelayState = "https://console.cloud.tencent.com/"
|
||||
if len(redirectUrl) == 0 {
|
||||
redirectUrl = "https://console.cloud.tencent.com/"
|
||||
}
|
||||
data.RelayState = redirectUrl
|
||||
|
||||
return data, nil
|
||||
}
|
||||
|
||||
@@ -1,142 +0,0 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package alertrecordhistorymon
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"golang.org/x/sync/errgroup"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/errors"
|
||||
"yunion.io/x/pkg/util/timeutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/cloudmon/collectors/common"
|
||||
"yunion.io/x/onecloud/pkg/cloudmon/options"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/monitor"
|
||||
)
|
||||
|
||||
func init() {
|
||||
factory := SAlertRecordHistoryFactory{}
|
||||
common.RegisterFactory(&factory)
|
||||
}
|
||||
|
||||
type SAlertRecordHistoryFactory struct {
|
||||
}
|
||||
|
||||
func (self *SAlertRecordHistoryFactory) MyRoutineInteval(monOptions options.CloudMonOptions) time.Duration {
|
||||
return time.Duration(monOptions.AlertRecordHistoryInterval)
|
||||
}
|
||||
|
||||
func (self *SAlertRecordHistoryFactory) MyRoutineFunc() common.RoutineFunc {
|
||||
return common.MakePullMetricRoutineAtZeroPoint
|
||||
}
|
||||
|
||||
func (self *SAlertRecordHistoryFactory) NewCloudReport(provider *common.SProvider, session *mcclient.ClientSession,
|
||||
args *options.ReportOptions,
|
||||
operatorType string) common.ICloudReport {
|
||||
return &SAlertRecordHistoryReport{
|
||||
common.CloudReportBase{
|
||||
SProvider: nil,
|
||||
Session: session,
|
||||
Args: args,
|
||||
Operator: string(common.ALERT_RECORD),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (S *SAlertRecordHistoryFactory) GetId() string {
|
||||
return string(common.ALERT_RECORD)
|
||||
}
|
||||
|
||||
type SAlertRecordHistoryReport struct {
|
||||
common.CloudReportBase
|
||||
}
|
||||
|
||||
func (self *SAlertRecordHistoryReport) Report() error {
|
||||
alerts, err := self.getMonitorCommonAlert()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
errs := make([]error, 0)
|
||||
recordGroup, _ := errgroup.WithContext(context.Background())
|
||||
count := 0
|
||||
for i, _ := range alerts {
|
||||
tmp := alerts[i]
|
||||
count++
|
||||
recordGroup.Go(func() error {
|
||||
alert_id, _ := tmp.GetString("id")
|
||||
alertRecords, err := self.getAlertRecordsByAlertId(alert_id)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "getAlertRecordsByAlertId:%s error", alert_id)
|
||||
}
|
||||
return self.collectMetric(alertRecords)
|
||||
})
|
||||
if count == 4 {
|
||||
err := recordGroup.Wait()
|
||||
if err != nil {
|
||||
errs = append(errs, errors.Wrap(err, "alertRecordHistoryReport collectMetric error"))
|
||||
}
|
||||
count = 0
|
||||
}
|
||||
}
|
||||
err = recordGroup.Wait()
|
||||
if err != nil {
|
||||
errs = append(errs, errors.Wrap(err, "alertRecordHistoryReport collectMetric error"))
|
||||
}
|
||||
return errors.NewAggregate(errs)
|
||||
}
|
||||
|
||||
func (self *SAlertRecordHistoryReport) getMonitorCommonAlert() ([]jsonutils.JSONObject, error) {
|
||||
alerts := make([]jsonutils.JSONObject, 0)
|
||||
query := jsonutils.NewDict()
|
||||
query.Add(jsonutils.NewString("0"), common.KEY_LIMIT)
|
||||
//query.Add(jsonutils.NewBool(true), common.DETAILS)
|
||||
query.Add(jsonutils.NewString("system"), "scope")
|
||||
|
||||
alerts, err := self.ListAllResource(modules.CommonAlertManager, query)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "getMonitorCommonAlert error")
|
||||
}
|
||||
return alerts, nil
|
||||
}
|
||||
|
||||
func (self *SAlertRecordHistoryReport) getAlertRecordsByAlertId(id string) ([]jsonutils.JSONObject, error) {
|
||||
now := time.Now().UTC()
|
||||
period64, err := strconv.ParseInt(self.Args.Interval, 10, 8)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
query := jsonutils.NewDict()
|
||||
query.Add(jsonutils.NewString("0"), common.KEY_LIMIT)
|
||||
query.Add(jsonutils.NewBool(true), common.DETAILS)
|
||||
query.Add(jsonutils.NewString("system"), "scope")
|
||||
query.Add(jsonutils.NewString(id), "alert_id")
|
||||
query.Add(jsonutils.NewString("alerting"), "state")
|
||||
query.Add(jsonutils.NewString(fmt.Sprintf(`created_at.between("%s","%s")`,
|
||||
now.Add(-time.Hour*24*time.Duration(period64)).Format(timeutils.MysqlTimeFormat),
|
||||
now.Format(timeutils.MysqlTimeFormat))),
|
||||
"filter")
|
||||
|
||||
alertRecords, err := self.ListAllResource(modules.AlertRecordManager, query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return alertRecords, nil
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package alertrecordhistorymon
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/cloudmon/collectors/common"
|
||||
"yunion.io/x/onecloud/pkg/util/influxdb"
|
||||
)
|
||||
|
||||
func (self *SAlertRecordHistoryReport) collectMetric(alertRecords []jsonutils.JSONObject) error {
|
||||
dataList := make([]influxdb.SMetricData, 0)
|
||||
matchRecord := self.getMaxEvalMatchOfAlertRecord(alertRecords)
|
||||
if matchRecord == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
metric, err := self.NewMetricFromJson(matchRecord)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
metric.Timestamp = time.Now()
|
||||
metric.Name = ALERT_RECORD_HISTORY_MEASUREMENT
|
||||
dataList = append(dataList, metric)
|
||||
return common.SendMetrics(self.Session, dataList, self.Args.Debug, ALERT_RECORD_HISTORY_DATABASE)
|
||||
}
|
||||
|
||||
func (self *SAlertRecordHistoryReport) getMaxEvalMatchOfAlertRecord(alertRecords []jsonutils.JSONObject) jsonutils.JSONObject {
|
||||
var matchRecord jsonutils.JSONObject
|
||||
maxCount := int64(0)
|
||||
for _, record := range alertRecords {
|
||||
resNum, _ := record.Int("res_num")
|
||||
if resNum > maxCount {
|
||||
maxCount = resNum
|
||||
matchRecord = record
|
||||
}
|
||||
}
|
||||
return matchRecord
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package alertrecordhistorymon // import "yunion.io/x/onecloud/pkg/cloudmon/collectors/alertrecordhistorymon"
|
||||
@@ -1,96 +0,0 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package alimon
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/cloudmon/collectors/common"
|
||||
|
||||
const (
|
||||
SERVER_METRIC_NAMESPACE = "acs_ecs_dashboard"
|
||||
|
||||
REDIS_METRIC_NAMESPACE = "acs_kvstore"
|
||||
RDS_METRIC_NAMESPACE = "acs_rds_dashboard"
|
||||
OSS_METRIC_NAMESPACE = "acs_oss"
|
||||
ELB_METRIC_NAMESPACE = "acs_slb_dashboard"
|
||||
|
||||
K8S_METRIC_NAMESPACE = "acs_k8s"
|
||||
)
|
||||
|
||||
//multiCloud查询指标列表组装
|
||||
var aliMetricSpecs = map[string][]string{
|
||||
"CPUUtilization": {common.DEFAULT_STATISTICS, common.UNIT_PERCENT, common.INFLUXDB_FIELD_CPU_USAGE},
|
||||
"InternetInRate": {common.DEFAULT_STATISTICS, common.UNIT_BPS, common.INFLUXDB_FIELD_NET_BPS_RX_INTERNET},
|
||||
"IntranetInRate": {common.DEFAULT_STATISTICS, common.UNIT_BPS, common.INFLUXDB_FIELD_NET_BPS_RX_INTRANET},
|
||||
"InternetOutRate": {common.DEFAULT_STATISTICS, common.UNIT_BPS, common.INFLUXDB_FIELD_NET_BPS_TX_INTERNET},
|
||||
"IntranetOutRate": {common.DEFAULT_STATISTICS, common.UNIT_BPS, common.INFLUXDB_FIELD_NET_BPS_TX_INTRANET},
|
||||
"DiskReadBPS": {common.DEFAULT_STATISTICS, common.UNIT_BYTEPS, common.INFLUXDB_FIELD_DISK_READ_BPS},
|
||||
"DiskWriteBPS": {common.DEFAULT_STATISTICS, common.UNIT_BYTEPS, common.INFLUXDB_FIELD_DISK_WRITE_BPS},
|
||||
"DiskReadIOPS": {common.DEFAULT_STATISTICS, common.UNIT_CPS, common.INFLUXDB_FIELD_DISK_READ_IOPS},
|
||||
"DiskWriteIOPS": {common.DEFAULT_STATISTICS, common.UNIT_CPS, common.INFLUXDB_FIELD_DISK_WRITE_IOPS},
|
||||
}
|
||||
var aliRdsMetricSpecs = map[string][]string{
|
||||
"CpuUsage": {common.DEFAULT_STATISTICS, common.UNIT_PERCENT, common.INFLUXDB_FIELD_RDS_CPU_USAGE},
|
||||
"MemoryUsage": {common.DEFAULT_STATISTICS, common.UNIT_PERCENT, common.INFLUXDB_FIELD_RDS_MEM_USAGE},
|
||||
"MySQL_NetworkInNew": {common.DEFAULT_STATISTICS, common.UNIT_BPS, common.INFLUXDB_FIELD_RDS_NET_BPS_RX_MYSQL},
|
||||
"MySQL_NetworkOutNew": {common.DEFAULT_STATISTICS, common.UNIT_BPS, common.INFLUXDB_FIELD_RDS_NET_BPS_TX_MYSQL},
|
||||
"DiskUsage": {common.DEFAULT_STATISTICS, common.UNIT_PERCENT, common.INFLUXDB_FIELD_RDS_DISK_USAGE},
|
||||
"SQLServer_NetworkInNew": {common.DEFAULT_STATISTICS, common.UNIT_BPS, common.INFLUXDB_FIELD_RDS_NET_BPS_RX_SQLSERVER},
|
||||
"SQLServer_NetworkOutNew": {common.DEFAULT_STATISTICS, common.UNIT_BPS, common.INFLUXDB_FIELD_RDS_NET_BPS_TX_SQLSERVER},
|
||||
"ConnectionUsage": {common.DEFAULT_STATISTICS, common.UNIT_PERCENT, common.INFLUXDB_FIELD_RDS_CONN_USAGE},
|
||||
}
|
||||
var aliRedisMetricSpecs = map[string][]string{
|
||||
"CpuUsage": {common.DEFAULT_STATISTICS, common.UNIT_PERCENT, common.INFLUXDB_FIELD_REDIS_CPU_USAGE},
|
||||
"MemoryUsage": {common.DEFAULT_STATISTICS, common.UNIT_PERCENT, common.INFLUXDB_FIELD_REDIS_MEM_USAGE},
|
||||
"IntranetIn": {common.DEFAULT_STATISTICS, common.UNIT_BPS, common.INFLUXDB_FIELD_REDIS_NET_BPS_RX},
|
||||
"IntranetOut": {common.DEFAULT_STATISTICS, common.UNIT_BPS, common.INFLUXDB_FIELD_REDIS_NET_BPS_TX},
|
||||
"UsedConnection": {common.DEFAULT_STATISTICS, common.UNIT_COUNT, common.INFLUXDB_FIFLD_REDIS_CONN_USAGE},
|
||||
"UsedQPS": {common.DEFAULT_STATISTICS, common.UNIT_COUNT, common.INFLUXDB_FIFLD_REDIS_OPT_SES},
|
||||
"Keys": {common.DEFAULT_STATISTICS, common.UNIT_COUNT, common.INFLUXDB_FIFLD_REDIS_CACHE_KEYS},
|
||||
"ExpiredKeys": {common.DEFAULT_STATISTICS, common.UNIT_COUNT, common.INFLUXDB_FIFLD_REDIS_CACHE_EXP_KEYS},
|
||||
"UsedMemory": {common.DEFAULT_STATISTICS, common.UNIT_MEM, common.INFLUXDB_FIFLD_REDIS_DATA_MEM_USAGE},
|
||||
}
|
||||
var aliOSSMetricSpecs = map[string][]string{
|
||||
"InternetSend": {common.DEFAULT_STATISTICS, common.UNIT_MEM, common.INFLUXDB_FIELD_OSS_NET_BPS_TX_INTERNET},
|
||||
"InternetRecv": {common.DEFAULT_STATISTICS, common.UNIT_MEM, common.INFLUXDB_FIELD_OSS_NET_BPS_RX_INTERNET},
|
||||
"IntranetSend": {common.DEFAULT_STATISTICS, common.UNIT_MEM, common.INFLUXDB_FIELD_OSS_NET_BPS_TX_INTRANET},
|
||||
"IntranetRecv": {common.DEFAULT_STATISTICS, common.UNIT_MEM, common.INFLUXDB_FIELD_OSS_NET_BPS_RX_INTRANET},
|
||||
"GetObjectE2eLatency": {common.DEFAULT_STATISTICS, common.UNIT_MSEC, common.INFLUXDB_FIELD_OSS_LATECY_GET},
|
||||
"PostObjectE2eLatency": {common.DEFAULT_STATISTICS, common.UNIT_MSEC, common.INFLUXDB_FIELD_OSS_LATECY_POST},
|
||||
"GetObjectCount": {common.DEFAULT_STATISTICS, common.UNIT_COUNT, common.INFLUXDB_FIELD_OSS_REQ_COUNT_GET},
|
||||
"PostObjectCount": {common.DEFAULT_STATISTICS, common.UNIT_COUNT, common.INFLUXDB_FIELD_OSS_REQ_COUNT_POST},
|
||||
"ServerErrorCount": {common.DEFAULT_STATISTICS, common.UNIT_COUNT, common.INFLUXDB_FIELD_OSS_REQ_COUNT_5XX},
|
||||
}
|
||||
var aliElbMetricSpecs = map[string][]string{
|
||||
"InstanceTrafficRX": {common.DEFAULT_STATISTICS, common.UNIT_BPS, common.INFLUXDB_FIELD_ELB_NET_BPS_RX},
|
||||
"InstanceTrafficTX": {common.DEFAULT_STATISTICS, common.UNIT_BPS, common.INFLUXDB_FIELD_ELB_NET_BPS_TX},
|
||||
"InstanceStatusCode2xx": {common.DEFAULT_STATISTICS, common.UNIT_COUNT_SEC, common.INFLUXDB_FIELD_ELB_HRSP_COUNT_2XX},
|
||||
"InstanceStatusCode3xx": {common.DEFAULT_STATISTICS, common.UNIT_COUNT_SEC, common.INFLUXDB_FIELD_ELB_HRSP_COUNT_3XX},
|
||||
"InstanceStatusCode4xx": {common.DEFAULT_STATISTICS, common.UNIT_COUNT_SEC, common.INFLUXDB_FIELD_ELB_HRSP_COUNT_4XX},
|
||||
"InstanceStatusCode5xx": {common.DEFAULT_STATISTICS, common.UNIT_COUNT_SEC, common.INFLUXDB_FIELD_ELB_HRSP_COUNT_5XX},
|
||||
}
|
||||
|
||||
var aliK8SClusterMetricSpecs = map[string][]string{
|
||||
"cluster.cpu.utilization": {common.DEFAULT_STATISTICS, common.UNIT_PERCENT, common.INFLUXDB_FIELD_K8S_CLUSTER_CPU_USAGE},
|
||||
"cluster.memory.utilization": {common.DEFAULT_STATISTICS, common.UNIT_PERCENT, common.INFLUXDB_FIELD_K8S_CLUSTER_MEM_USAGE},
|
||||
}
|
||||
|
||||
var aliK8SPodMetricSpecs = map[string][]string{
|
||||
"pod.cpu.utilization": {common.DEFAULT_STATISTICS, common.UNIT_PERCENT, common.INFLUXDB_FIELD_K8S_POD_CPU_USAGE},
|
||||
"pod.memory.utilization": {common.DEFAULT_STATISTICS, common.UNIT_PERCENT, common.INFLUXDB_FIELD_K8S_POD_MEM_USAGE},
|
||||
}
|
||||
|
||||
var aliK8SNodeMetricSpecs = map[string][]string{
|
||||
"node.cpu.utilization": {common.DEFAULT_STATISTICS, common.UNIT_PERCENT, common.INFLUXDB_FIELD_K8S_NODE_CPU_USAGE},
|
||||
"node.memory.utilization": {common.DEFAULT_STATISTICS, common.UNIT_PERCENT, common.INFLUXDB_FIELD_K8S_NODE_MEM_USAGE},
|
||||
}
|
||||
@@ -1,143 +0,0 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package alimon
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis/compute"
|
||||
"yunion.io/x/onecloud/pkg/cloudmon/collectors/common"
|
||||
"yunion.io/x/onecloud/pkg/cloudmon/options"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
)
|
||||
|
||||
func init() {
|
||||
factory := SAliCloudReportFactory{}
|
||||
common.RegisterFactory(&factory)
|
||||
cluster := &AliK8sClusterHelper{
|
||||
K8sClusterMetricBaseHelper: &common.K8sClusterMetricBaseHelper{
|
||||
ModuleHelper: map[common.K8sClusterModuleType]common.IK8sClusterModuleHelper{},
|
||||
},
|
||||
}
|
||||
cluster.RegisterModuleHelper(new(AliK8sClusterPodHelper))
|
||||
cluster.RegisterModuleHelper(new(AliK8sClusterNodeHelper))
|
||||
common.RegisterK8sClusterHelper(cluster)
|
||||
}
|
||||
|
||||
type SAliCloudReportFactory struct {
|
||||
common.CommonReportFactory
|
||||
}
|
||||
|
||||
func (self *SAliCloudReportFactory) NewCloudReport(provider *common.SProvider, session *mcclient.ClientSession,
|
||||
args *options.ReportOptions, operatorType string) common.ICloudReport {
|
||||
return &SAliCloudReport{
|
||||
common.CloudReportBase{
|
||||
SProvider: provider,
|
||||
Session: session,
|
||||
Args: args,
|
||||
Operator: operatorType,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (self *SAliCloudReportFactory) GetId() string {
|
||||
return compute.CLOUD_PROVIDER_ALIYUN
|
||||
}
|
||||
|
||||
type SAliCloudReport struct {
|
||||
common.CloudReportBase
|
||||
}
|
||||
|
||||
func (self *SAliCloudReport) Report() error {
|
||||
var servers []jsonutils.JSONObject
|
||||
var err error
|
||||
|
||||
servers, err = self.GetResourceByOperator()
|
||||
|
||||
providerInstance, err := self.InitProviderInstance()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
regionList, regionServerMap, err := self.GetAllRegionOfServers(servers, providerInstance)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, region := range regionList {
|
||||
servers := regionServerMap[region.GetGlobalId()]
|
||||
switch common.MonType(self.Operator) {
|
||||
case common.REDIS:
|
||||
err = self.collectRegionMetricOfRedis(region, servers)
|
||||
case common.K8S:
|
||||
err = self.collectRegionMetricOfResource(region, servers)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
self.Impl = self
|
||||
err = self.CollectRegionMetricOfK8sModules(region, servers)
|
||||
default:
|
||||
err = self.collectRegionMetricOfResource(region, servers)
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type AliK8sClusterHelper struct {
|
||||
*common.K8sClusterMetricBaseHelper
|
||||
}
|
||||
|
||||
func (a AliK8sClusterHelper) HelperBrand() string {
|
||||
return compute.CLOUD_PROVIDER_ALIYUN
|
||||
}
|
||||
|
||||
type AliK8sClusterPodHelper struct {
|
||||
common.K8sClusterModuleQueryHelper
|
||||
}
|
||||
|
||||
func (q AliK8sClusterPodHelper) MyModuleType() common.K8sClusterModuleType {
|
||||
return common.K8S_MODULE_POD
|
||||
}
|
||||
|
||||
func (q AliK8sClusterPodHelper) MyResDimensionId() common.DimensionId {
|
||||
return common.DimensionId{
|
||||
LocalId: "name",
|
||||
ExtId: "pod",
|
||||
}
|
||||
}
|
||||
|
||||
func (q AliK8sClusterPodHelper) MyNamespaceAndMetrics() (string, map[string][]string) {
|
||||
return K8S_METRIC_NAMESPACE, aliK8SPodMetricSpecs
|
||||
}
|
||||
|
||||
type AliK8sClusterNodeHelper struct {
|
||||
common.K8sClusterModuleQueryHelper
|
||||
}
|
||||
|
||||
func (a AliK8sClusterNodeHelper) MyModuleType() common.K8sClusterModuleType {
|
||||
return common.K8S_MODULE_NODE
|
||||
}
|
||||
|
||||
func (a AliK8sClusterNodeHelper) MyResDimensionId() common.DimensionId {
|
||||
return common.DimensionId{
|
||||
LocalId: "name",
|
||||
ExtId: "node",
|
||||
}
|
||||
}
|
||||
|
||||
func (a AliK8sClusterNodeHelper) MyNamespaceAndMetrics() (string, map[string][]string) {
|
||||
return K8S_METRIC_NAMESPACE, aliK8SNodeMetricSpecs
|
||||
}
|
||||
@@ -1,315 +0,0 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package alimon
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/log"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/cloudmon/collectors/common"
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
"yunion.io/x/onecloud/pkg/multicloud/aliyun"
|
||||
"yunion.io/x/onecloud/pkg/util/influxdb"
|
||||
)
|
||||
|
||||
func (self *SAliCloudReport) collectRegionMetricOfResource(region cloudprovider.ICloudRegion, servers []jsonutils.JSONObject) error {
|
||||
dataList := make([]influxdb.SMetricData, 0)
|
||||
aliReg := region.(*aliyun.SRegion)
|
||||
since, until, err := common.TimeRangeFromArgs(self.Args)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
namespace, metrics := self.getMetricSpecs(servers)
|
||||
dimensionId := self.getDimensionId()
|
||||
dataCnt := 0
|
||||
for metricName, influxDbSpecs := range metrics {
|
||||
rtnArray, _, err := aliReg.DescribeMetricList(metricName, namespace, since, until, "", nil)
|
||||
if err != nil {
|
||||
log.Errorln(err)
|
||||
continue
|
||||
}
|
||||
dataCnt = len(dataList)
|
||||
if len(rtnArray) > 0 {
|
||||
for _, rtnMetric := range rtnArray {
|
||||
for _, server := range servers {
|
||||
external_id, _ := server.GetString(dimensionId.LocalId)
|
||||
if instanceId, _ := rtnMetric.GetString(dimensionId.ExtId); instanceId == external_id {
|
||||
if self.Operator == string(common.SERVER) {
|
||||
metric, err := common.FillVMCapacity(server.(*jsonutils.JSONDict))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
dataList = append(dataList, metric)
|
||||
}
|
||||
serverMetric, err := self.collectMetricFromThisServer(server, rtnMetric, influxDbSpecs, metricName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
dataList = append(dataList, serverMetric)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
log.Debugf("%s %s %s report %d metric", self.SProvider.Name, self.Operator, metricName, len(dataList)-dataCnt)
|
||||
}
|
||||
return common.SendMetrics(self.Session, dataList, self.Args.Debug, "")
|
||||
}
|
||||
|
||||
func (self *SAliCloudReport) collectRegionMetricOfRedis(region cloudprovider.ICloudRegion,
|
||||
servers []jsonutils.JSONObject) error {
|
||||
dataList := make([]influxdb.SMetricData, 0)
|
||||
aliReg := region.(*aliyun.SRegion)
|
||||
since, until, err := common.TimeRangeFromArgs(self.Args)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
redisDeployType := make(map[string]string)
|
||||
for _, server := range servers {
|
||||
local_category, err := server.GetString("local_category")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
switch local_category {
|
||||
case "single":
|
||||
redisDeployType["single"] = "Standard"
|
||||
case "master":
|
||||
redisDeployType["master"] = "Standard"
|
||||
case "cluster":
|
||||
redisDeployType["cluster"] = "Sharding"
|
||||
case "rwsplit":
|
||||
redisDeployType["rwsplit"] = "Splitrw"
|
||||
}
|
||||
|
||||
}
|
||||
dataCnt := 0
|
||||
for metricName, influxDbSpecs := range aliRedisMetricSpecs {
|
||||
for _, pre := range redisDeployType {
|
||||
rtnArray, _, err := aliReg.DescribeMetricList(pre+metricName, "acs_kvstore", since, until, "", nil)
|
||||
if err != nil {
|
||||
log.Errorln(err)
|
||||
continue
|
||||
}
|
||||
dataCnt = len(dataList)
|
||||
if len(rtnArray) > 0 {
|
||||
for _, rtnMetric := range rtnArray {
|
||||
for _, server := range servers {
|
||||
external_id, _ := server.GetString("external_id")
|
||||
if instanceId, _ := rtnMetric.GetString("instanceId"); instanceId == external_id {
|
||||
serverMetric, err := self.collectMetricFromThisServer(server, rtnMetric, influxDbSpecs, "")
|
||||
node_id, _ := rtnMetric.GetString("nodeId")
|
||||
serverMetric.Tags = append(serverMetric.Tags, influxdb.SKeyValue{Key: "node_id", Value: node_id})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
dataList = append(dataList, serverMetric)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
log.Debugf("%s %s %s report %d metric", self.SProvider.Name, self.Operator, metricName, len(dataList)-dataCnt)
|
||||
}
|
||||
return common.SendMetrics(self.Session, dataList, self.Args.Debug, "")
|
||||
}
|
||||
|
||||
func (self *SAliCloudReport) collectMetricFromThisServer(server jsonutils.JSONObject, rtnMetric jsonutils.JSONObject, influxDbSpecs []string, valueKey string) (influxdb.SMetricData, error) {
|
||||
metric, err := self.NewMetricFromJson(server)
|
||||
//metric, err := common.JsonToMetric(server.(*jsonutils.JSONDict), "", common.ServerTags, make([]string, 0))
|
||||
if err != nil {
|
||||
return influxdb.SMetricData{}, err
|
||||
}
|
||||
timestamp, _ := rtnMetric.Get("timestamp")
|
||||
metric.Timestamp = time.Unix(timestamp.(*jsonutils.JSONInt).Value()/1000, 0)
|
||||
fieldValue, err := self.getDataPointValue(valueKey, influxDbSpecs, rtnMetric)
|
||||
if err != nil {
|
||||
return influxdb.SMetricData{}, err
|
||||
}
|
||||
//根据条件拼装metric的tag和metirc信息
|
||||
influxDbSpec := influxDbSpecs[2]
|
||||
measurement := common.SubstringBefore(influxDbSpec, ".")
|
||||
var pairsKey string
|
||||
if strings.Contains(influxDbSpec, ",") {
|
||||
pairsKey = common.SubstringBetween(influxDbSpec, ".", ",")
|
||||
} else {
|
||||
pairsKey = common.SubstringAfter(influxDbSpec, ".")
|
||||
}
|
||||
if influxDbSpecs[1] == common.UNIT_BYTEPS && strings.Contains(pairsKey, common.UNIT_BPS) {
|
||||
fieldValue = fieldValue * 8
|
||||
}
|
||||
tag := common.SubstringAfter(influxDbSpec, ",")
|
||||
if tag != "" && strings.Contains(influxDbSpec, "=") {
|
||||
metric.Tags = append(metric.Tags, influxdb.SKeyValue{
|
||||
Key: common.SubstringBefore(tag, "="),
|
||||
Value: common.SubstringAfter(tag, "="),
|
||||
})
|
||||
}
|
||||
cpu_cout, err := server.Get("vcpu_count")
|
||||
if err == nil {
|
||||
metric.Metrics = append(metric.Metrics, influxdb.SKeyValue{
|
||||
Key: "cpu_count",
|
||||
Value: strconv.FormatInt(cpu_cout.(*jsonutils.JSONInt).Value(), 10),
|
||||
})
|
||||
}
|
||||
metric.Metrics = append(metric.Metrics, influxdb.SKeyValue{
|
||||
Key: pairsKey,
|
||||
Value: strconv.FormatFloat(fieldValue, 'E', -1, 64),
|
||||
})
|
||||
metric.Name = measurement
|
||||
return metric, nil
|
||||
}
|
||||
|
||||
func (self *SAliCloudReport) getDataPointValue(valueKey string, influxDbSpecs []string, rtnMetric jsonutils.JSONObject) (float64, error) {
|
||||
key := common.UNIT_AVERAGE
|
||||
switch common.MonType(self.Operator) {
|
||||
case common.OSS:
|
||||
key = valueKey
|
||||
case common.K8S:
|
||||
key = "Value"
|
||||
}
|
||||
fieldValue, err := rtnMetric.Float(key)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return fieldValue, nil
|
||||
}
|
||||
|
||||
func (self *SAliCloudReport) getMetricSpecs(res []jsonutils.JSONObject) (string, map[string][]string) {
|
||||
switch common.MonType(self.Operator) {
|
||||
case common.SERVER:
|
||||
return SERVER_METRIC_NAMESPACE, aliMetricSpecs
|
||||
case common.REDIS:
|
||||
return REDIS_METRIC_NAMESPACE, aliRedisMetricSpecs
|
||||
case common.RDS:
|
||||
return RDS_METRIC_NAMESPACE, aliRdsMetricSpecs
|
||||
case common.OSS:
|
||||
return OSS_METRIC_NAMESPACE, aliOSSMetricSpecs
|
||||
case common.ELB:
|
||||
return ELB_METRIC_NAMESPACE, aliElbMetricSpecs
|
||||
case common.K8S:
|
||||
return K8S_METRIC_NAMESPACE, aliK8SClusterMetricSpecs
|
||||
default:
|
||||
return SERVER_METRIC_NAMESPACE, aliMetricSpecs
|
||||
}
|
||||
}
|
||||
|
||||
func (self *SAliCloudReport) getDimensionId() *common.DimensionId {
|
||||
switch common.MonType(self.Operator) {
|
||||
case common.SERVER:
|
||||
return &common.DimensionId{
|
||||
LocalId: "external_id",
|
||||
ExtId: "instanceId",
|
||||
}
|
||||
case common.REDIS:
|
||||
return &common.DimensionId{
|
||||
LocalId: "external_id",
|
||||
ExtId: "instanceId",
|
||||
}
|
||||
case common.RDS:
|
||||
return &common.DimensionId{
|
||||
LocalId: "external_id",
|
||||
ExtId: "instanceId",
|
||||
}
|
||||
case common.OSS:
|
||||
return &common.DimensionId{
|
||||
LocalId: "name",
|
||||
ExtId: "BucketName",
|
||||
}
|
||||
case common.ELB:
|
||||
return &common.DimensionId{
|
||||
LocalId: "external_id",
|
||||
ExtId: "InstanceId",
|
||||
}
|
||||
case common.K8S:
|
||||
return &common.DimensionId{
|
||||
LocalId: "external_cloud_cluster_id",
|
||||
ExtId: "cluster",
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *SAliCloudReport) CollectK8sModuleMetric(region cloudprovider.ICloudRegion, cluster jsonutils.JSONObject,
|
||||
helper common.IK8sClusterModuleHelper) error {
|
||||
aliReg := region.(*aliyun.SRegion)
|
||||
since, until, err := common.TimeRangeFromArgs(self.Args)
|
||||
id, _ := cluster.GetString("id")
|
||||
resources, err := common.ListK8sClusterModuleResources(helper.MyModuleType(), id, self.Session, nil)
|
||||
if err != nil {
|
||||
log.Errorf("ListK8sClusterModuleResources err: %v", err)
|
||||
return err
|
||||
}
|
||||
namespace, metricSpecs := helper.MyNamespaceAndMetrics()
|
||||
metricNames := make([]string, 0)
|
||||
for metricName := range metricSpecs {
|
||||
metricNames = append(metricNames, metricName)
|
||||
}
|
||||
dimensionId := helper.MyResDimensionId()
|
||||
dataList := make([]influxdb.SMetricData, 0)
|
||||
dataCnt := 0
|
||||
for metricName, influxDbSpecs := range metricSpecs {
|
||||
rtnArray, _, err := aliReg.DescribeMetricList(metricName, namespace, since, until, "", nil)
|
||||
if err != nil {
|
||||
log.Errorln(err)
|
||||
continue
|
||||
}
|
||||
dataCnt = len(dataList)
|
||||
if len(rtnArray) > 0 {
|
||||
for _, rtnMetric := range rtnArray {
|
||||
for _, resource := range resources {
|
||||
external_id, _ := resource.GetString(dimensionId.LocalId)
|
||||
if instanceId, _ := rtnMetric.GetString(dimensionId.ExtId); instanceId == external_id {
|
||||
serverMetric, err := self.collectMetricFromThisServer(resource, rtnMetric, influxDbSpecs, metricName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
dataList = append(dataList, serverMetric)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
log.Debugf("%s %s %s report %d metric", self.SProvider.Name, self.Operator, metricName, len(dataList)-dataCnt)
|
||||
}
|
||||
err = common.SendMetrics(self.Session, dataList, self.Args.Debug, "")
|
||||
if err != nil {
|
||||
log.Errorf("K8s metricName: %s SendMetrics err: %#v", "", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *SAliCloudReport) getK8sModuleDimensions(helper common.IK8sClusterModuleHelper, module jsonutils.JSONObject,
|
||||
clusterId string) []aliyun.SResourceLabel {
|
||||
dimensions := make([]aliyun.SResourceLabel, 0)
|
||||
dimensionId := helper.MyResDimensionId()
|
||||
|
||||
localIds := strings.Split(dimensionId.LocalId, ",")
|
||||
extIds := strings.Split(dimensionId.ExtId, ",")
|
||||
if len(localIds) != len(extIds) {
|
||||
return dimensions
|
||||
}
|
||||
for index, localId := range localIds {
|
||||
localIdKey := strings.Split(localId, ".")
|
||||
val, _ := module.GetString(localIdKey...)
|
||||
dimensions = append(dimensions, aliyun.SResourceLabel{
|
||||
Name: extIds[index],
|
||||
Value: val,
|
||||
})
|
||||
|
||||
}
|
||||
return dimensions
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package alimon // import "yunion.io/x/onecloud/pkg/cloudmon/collectors/alimon"
|
||||
@@ -1,86 +0,0 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package apsaramon
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis/compute"
|
||||
"yunion.io/x/onecloud/pkg/cloudmon/collectors/common"
|
||||
"yunion.io/x/onecloud/pkg/cloudmon/options"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
)
|
||||
|
||||
func init() {
|
||||
factory := SApsaraCloudReportFactory{}
|
||||
common.RegisterFactory(&factory)
|
||||
}
|
||||
|
||||
type SApsaraCloudReportFactory struct {
|
||||
common.CommonReportFactory
|
||||
}
|
||||
|
||||
func (self *SApsaraCloudReportFactory) NewCloudReport(provider *common.SProvider, session *mcclient.ClientSession,
|
||||
args *options.ReportOptions, operatorType string) common.ICloudReport {
|
||||
return &SApsaraCloudReport{
|
||||
common.CloudReportBase{
|
||||
SProvider: provider,
|
||||
Session: session,
|
||||
Args: args,
|
||||
Operator: operatorType,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (self *SApsaraCloudReportFactory) GetId() string {
|
||||
return compute.CLOUD_PROVIDER_APSARA
|
||||
}
|
||||
|
||||
type SApsaraCloudReport struct {
|
||||
common.CloudReportBase
|
||||
}
|
||||
|
||||
func (self *SApsaraCloudReport) Report() error {
|
||||
var servers []jsonutils.JSONObject
|
||||
var err error
|
||||
servers, err = self.GetResourceByOperator()
|
||||
providerInstance, err := self.InitProviderInstance()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
regionList, regionServerMap, err := self.GetAllRegionOfServers(servers, providerInstance)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, region := range regionList {
|
||||
servers := regionServerMap[region.GetGlobalId()]
|
||||
switch self.Operator {
|
||||
case "server":
|
||||
err = self.collectRegionMetricOfHost(region, servers)
|
||||
case "redis":
|
||||
err = self.collectRegionMetricOfRedis(region, servers)
|
||||
case "rds":
|
||||
err = self.collectRegionMetricOfRds(region, servers)
|
||||
case "oss":
|
||||
err = self.collectRegionMetricOfOss(region, servers)
|
||||
case "elb":
|
||||
err = self.collectRegionMetricOfElb(region, servers)
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,373 +0,0 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package apsaramon
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/errors"
|
||||
|
||||
api "yunion.io/x/onecloud/pkg/apis/compute"
|
||||
"yunion.io/x/onecloud/pkg/cloudmon/collectors/common"
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
iden_modules "yunion.io/x/onecloud/pkg/mcclient/modules/identity"
|
||||
"yunion.io/x/onecloud/pkg/multicloud/apsara"
|
||||
"yunion.io/x/onecloud/pkg/util/influxdb"
|
||||
)
|
||||
|
||||
type SApsaraMetric struct {
|
||||
Timestamp int64
|
||||
UserId string
|
||||
InstanceId string
|
||||
Maximum float64
|
||||
Minimum float64
|
||||
Average float64
|
||||
NodeId string
|
||||
}
|
||||
|
||||
func (self *SApsaraCloudReport) collectRegionMetricOfHost(region cloudprovider.ICloudRegion, servers []jsonutils.JSONObject) error {
|
||||
dataList := make([]influxdb.SMetricData, 0)
|
||||
aliReg := region.(*apsara.SRegion)
|
||||
since, until, err := common.TimeRangeFromArgs(self.Args)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "common.TimeRangeFromArgs")
|
||||
}
|
||||
|
||||
instances := []api.ServerDetails{}
|
||||
instanceMaps := map[string]api.ServerDetails{}
|
||||
jsonutils.Update(&instances, servers)
|
||||
for i := range instances {
|
||||
if len(instances[i].ExternalId) == 0 {
|
||||
continue
|
||||
}
|
||||
instanceMaps[instances[i].ExternalId] = instances[i]
|
||||
metric, err := common.FillVMCapacity(jsonutils.Marshal(instances[i]).(*jsonutils.JSONDict))
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "common.FillVMCapacity")
|
||||
}
|
||||
dataList = append(dataList, metric)
|
||||
}
|
||||
|
||||
err = common.SendMetrics(self.Session, dataList, self.Args.Debug, "")
|
||||
if err != nil {
|
||||
log.Errorf("send server base metric error: %v", err)
|
||||
}
|
||||
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(len(apsaraMetricSpecs))
|
||||
for _metricName, _influxDbSpecs := range apsaraMetricSpecs {
|
||||
go func(metricName string, influxDbSpecs []string) {
|
||||
defer wg.Done()
|
||||
dataList = []influxdb.SMetricData{}
|
||||
metricArray, err := aliReg.FetchMetricData(metricName, "acs_ecs_dashboard", since, until)
|
||||
if err != nil {
|
||||
log.Errorln(err)
|
||||
return
|
||||
}
|
||||
|
||||
metrics := []SApsaraMetric{}
|
||||
jsonutils.Update(&metrics, metricArray)
|
||||
|
||||
for _, rtnMetric := range metrics {
|
||||
server, ok := instanceMaps[rtnMetric.InstanceId]
|
||||
if ok {
|
||||
serverMetric, err := self.collectMetricFromThisServer(jsonutils.Marshal(server), rtnMetric, influxDbSpecs)
|
||||
if err != nil {
|
||||
log.Errorf("collect %s error: %v", metricName, err)
|
||||
continue
|
||||
}
|
||||
|
||||
project, err := self.GetResourceById(server.ProjectId, &iden_modules.Projects)
|
||||
if err != nil {
|
||||
log.Errorf("server: %s getProject: %s err: %v", server.Name, server.ProjectId, err)
|
||||
continue
|
||||
}
|
||||
metaMap, _ := project.GetMap("metadata")
|
||||
if len(metaMap) > 0 {
|
||||
for key, valObj := range metaMap {
|
||||
if strings.Contains(key, "user:") {
|
||||
val, _ := valObj.GetString()
|
||||
serverMetric.Tags = append(serverMetric.Tags, influxdb.SKeyValue{
|
||||
Key: key,
|
||||
Value: val,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
dataList = append(dataList, serverMetric)
|
||||
}
|
||||
}
|
||||
log.Infof("SendMetrics %s length: %d", metricName, len(dataList))
|
||||
err = common.SendMetrics(self.Session, dataList, self.Args.Debug, "")
|
||||
if err != nil {
|
||||
log.Errorf("SendMetrics %s length: %d error: %v", metricName, len(dataList), err)
|
||||
}
|
||||
|
||||
}(_metricName, _influxDbSpecs)
|
||||
}
|
||||
wg.Wait()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *SApsaraCloudReport) collectRegionMetricOfRedis(region cloudprovider.ICloudRegion,
|
||||
servers []jsonutils.JSONObject) error {
|
||||
dataList := make([]influxdb.SMetricData, 0)
|
||||
aliReg := region.(*apsara.SRegion)
|
||||
since, until, err := common.TimeRangeFromArgs(self.Args)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
redisDeployType := make(map[string]string)
|
||||
for _, server := range servers {
|
||||
local_category, err := server.GetString("local_category")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
switch local_category {
|
||||
case "single":
|
||||
redisDeployType["single"] = "Standard"
|
||||
case "master":
|
||||
redisDeployType["master"] = "Standard"
|
||||
case "cluster":
|
||||
redisDeployType["cluster"] = "Sharding"
|
||||
case "rwsplit":
|
||||
redisDeployType["rwsplit"] = "Splitrw"
|
||||
}
|
||||
|
||||
}
|
||||
for metricName, influxDbSpecs := range aliRedisMetricSpecs {
|
||||
for _, pre := range redisDeployType {
|
||||
rtnArray, err := aliReg.FetchMetricData(pre+metricName, "acs_kvstore", since, until)
|
||||
if err != nil {
|
||||
log.Errorln(err)
|
||||
continue
|
||||
}
|
||||
|
||||
metrics := []SApsaraMetric{}
|
||||
jsonutils.Update(&metrics, rtnArray)
|
||||
|
||||
for _, rtnMetric := range metrics {
|
||||
for _, server := range servers {
|
||||
external_id, _ := server.GetString("external_id")
|
||||
if rtnMetric.InstanceId == external_id {
|
||||
serverMetric, err := self.collectMetricFromThisServer(server, rtnMetric, influxDbSpecs)
|
||||
serverMetric.Tags = append(serverMetric.Tags, influxdb.SKeyValue{Key: "node_id", Value: rtnMetric.NodeId})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
dataList = append(dataList, serverMetric)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return common.SendMetrics(self.Session, dataList, self.Args.Debug, "")
|
||||
}
|
||||
|
||||
func (self *SApsaraCloudReport) collectRegionMetricOfRds(region cloudprovider.ICloudRegion, servers []jsonutils.JSONObject) error {
|
||||
dataList := make([]influxdb.SMetricData, 0)
|
||||
aliReg := region.(*apsara.SRegion)
|
||||
since, until, err := common.TimeRangeFromArgs(self.Args)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for metricName, influxDbSpecs := range aliRdsMetricSpecs {
|
||||
rtnArray, err := aliReg.FetchMetricData(metricName, "acs_rds_dashboard", since, until)
|
||||
if err != nil {
|
||||
log.Errorln(err)
|
||||
continue
|
||||
}
|
||||
metrics := []SApsaraMetric{}
|
||||
jsonutils.Update(&metrics, rtnArray)
|
||||
|
||||
for _, rtnMetric := range metrics {
|
||||
for _, server := range servers {
|
||||
external_id, _ := server.GetString("external_id")
|
||||
if rtnMetric.InstanceId == external_id {
|
||||
metric, err := common.FillVMCapacity(server.(*jsonutils.JSONDict))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
dataList = append(dataList, metric)
|
||||
serverMetric, err := self.collectMetricFromThisServer(server, rtnMetric, influxDbSpecs)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
dataList = append(dataList, serverMetric)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return common.SendMetrics(self.Session, dataList, self.Args.Debug, "")
|
||||
}
|
||||
|
||||
func (self *SApsaraCloudReport) collectRegionMetricOfOss(region cloudprovider.ICloudRegion, servers []jsonutils.JSONObject) error {
|
||||
dataList := make([]influxdb.SMetricData, 0)
|
||||
aliReg := region.(*apsara.SRegion)
|
||||
since, until, err := common.TimeRangeFromArgs(self.Args)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for metricName, influxDbSpecs := range aliOSSMetricSpecs {
|
||||
rtnArray, err := aliReg.FetchMetricData(metricName, "acs_oss", since, until)
|
||||
if err != nil {
|
||||
log.Errorln(err)
|
||||
continue
|
||||
}
|
||||
if len(rtnArray) > 0 {
|
||||
for _, rtnMetric := range rtnArray {
|
||||
for _, server := range servers {
|
||||
name, _ := server.GetString("name")
|
||||
if bucketName, _ := rtnMetric.GetString("BucketName"); bucketName == name {
|
||||
serverMetric, err := self.collectOssMetricFromThisServer(server, rtnMetric, metricName,
|
||||
influxDbSpecs)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
dataList = append(dataList, serverMetric)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return common.SendMetrics(self.Session, dataList, self.Args.Debug, "")
|
||||
}
|
||||
|
||||
func (self *SApsaraCloudReport) collectRegionMetricOfElb(region cloudprovider.ICloudRegion, servers []jsonutils.JSONObject) error {
|
||||
dataList := make([]influxdb.SMetricData, 0)
|
||||
aliReg := region.(*apsara.SRegion)
|
||||
since, until, err := common.TimeRangeFromArgs(self.Args)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for metricName, influxDbSpecs := range aliElbMetricSpecs {
|
||||
rtnArray, err := aliReg.FetchMetricData(metricName, "acs_slb_dashboard", since, until)
|
||||
if err != nil {
|
||||
log.Errorln(err)
|
||||
continue
|
||||
}
|
||||
|
||||
metrics := []SApsaraMetric{}
|
||||
jsonutils.Update(&metrics, rtnArray)
|
||||
|
||||
for _, rtnMetric := range metrics {
|
||||
for _, server := range servers {
|
||||
external_id, _ := server.GetString("external_id")
|
||||
if rtnMetric.InstanceId == external_id {
|
||||
serverMetric, err := self.collectMetricFromThisServer(server, rtnMetric, influxDbSpecs)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
dataList = append(dataList, serverMetric)
|
||||
}
|
||||
}
|
||||
}
|
||||
log.Infof("SendMetrics %s length: %d", metricName, len(dataList))
|
||||
}
|
||||
return common.SendMetrics(self.Session, dataList, self.Args.Debug, "")
|
||||
}
|
||||
|
||||
func (self *SApsaraCloudReport) collectMetricFromThisServer(server jsonutils.JSONObject, rtnMetric SApsaraMetric, influxDbSpecs []string) (influxdb.SMetricData, error) {
|
||||
metric, err := self.NewMetricFromJson(server)
|
||||
if err != nil {
|
||||
return influxdb.SMetricData{}, err
|
||||
}
|
||||
metric.Timestamp = time.Unix(rtnMetric.Timestamp/1000, 0)
|
||||
fieldValue := rtnMetric.Average
|
||||
//根据条件拼装metric的tag和metirc信息
|
||||
influxDbSpec := influxDbSpecs[2]
|
||||
measurement := common.SubstringBefore(influxDbSpec, ".")
|
||||
var pairsKey string
|
||||
if strings.Contains(influxDbSpec, ",") {
|
||||
pairsKey = common.SubstringBetween(influxDbSpec, ".", ",")
|
||||
} else {
|
||||
pairsKey = common.SubstringAfter(influxDbSpec, ".")
|
||||
}
|
||||
if influxDbSpecs[1] == UNIT_BYTEPS && strings.Contains(pairsKey, UNIT_BPS) {
|
||||
fieldValue = fieldValue * 8
|
||||
}
|
||||
tag := common.SubstringAfter(influxDbSpec, ",")
|
||||
if tag != "" && strings.Contains(influxDbSpec, "=") {
|
||||
metric.Tags = append(metric.Tags, influxdb.SKeyValue{
|
||||
Key: common.SubstringBefore(tag, "="),
|
||||
Value: common.SubstringAfter(tag, "="),
|
||||
})
|
||||
}
|
||||
cpu_cout, err := server.Get("vcpu_count")
|
||||
if err == nil {
|
||||
metric.Metrics = append(metric.Metrics, influxdb.SKeyValue{
|
||||
Key: "cpu_count",
|
||||
Value: strconv.FormatInt(cpu_cout.(*jsonutils.JSONInt).Value(), 10),
|
||||
})
|
||||
}
|
||||
metric.Metrics = append(metric.Metrics, influxdb.SKeyValue{
|
||||
Key: pairsKey,
|
||||
Value: strconv.FormatFloat(fieldValue, 'E', -1, 64),
|
||||
})
|
||||
metric.Name = measurement
|
||||
return metric, nil
|
||||
}
|
||||
|
||||
func (self *SApsaraCloudReport) collectOssMetricFromThisServer(server jsonutils.JSONObject, rtnMetric jsonutils.JSONObject,
|
||||
metricName string, influxDbSpecs []string) (influxdb.SMetricData, error) {
|
||||
metric, err := self.NewMetricFromJson(server)
|
||||
//metric, err := common.JsonToMetric(server.(*jsonutils.JSONDict), "", common.ServerTags, make([]string, 0))
|
||||
if err != nil {
|
||||
return influxdb.SMetricData{}, err
|
||||
}
|
||||
timestamp, _ := rtnMetric.Get("timestamp")
|
||||
metric.Timestamp = time.Unix(timestamp.(*jsonutils.JSONInt).Value()/1000, 0)
|
||||
fieldValue, err := rtnMetric.Float(metricName)
|
||||
if err != nil {
|
||||
return influxdb.SMetricData{}, err
|
||||
}
|
||||
//根据条件拼装metric的tag和metirc信息
|
||||
influxDbSpec := influxDbSpecs[2]
|
||||
measurement := common.SubstringBefore(influxDbSpec, ".")
|
||||
var pairsKey string
|
||||
if strings.Contains(influxDbSpec, ",") {
|
||||
pairsKey = common.SubstringBetween(influxDbSpec, ".", ",")
|
||||
} else {
|
||||
pairsKey = common.SubstringAfter(influxDbSpec, ".")
|
||||
}
|
||||
if influxDbSpecs[1] == UNIT_BYTEPS && strings.Contains(pairsKey, UNIT_BPS) {
|
||||
fieldValue = fieldValue * 8
|
||||
}
|
||||
tag := common.SubstringAfter(influxDbSpec, ",")
|
||||
if tag != "" && strings.Contains(influxDbSpec, "=") {
|
||||
metric.Tags = append(metric.Tags, influxdb.SKeyValue{
|
||||
Key: common.SubstringBefore(tag, "="),
|
||||
Value: common.SubstringAfter(tag, "="),
|
||||
})
|
||||
}
|
||||
cpu_cout, err := server.Get("vcpu_count")
|
||||
if err == nil {
|
||||
metric.Metrics = append(metric.Metrics, influxdb.SKeyValue{
|
||||
Key: "cpu_count",
|
||||
Value: strconv.FormatInt(cpu_cout.(*jsonutils.JSONInt).Value(), 10),
|
||||
})
|
||||
}
|
||||
metric.Metrics = append(metric.Metrics, influxdb.SKeyValue{
|
||||
Key: pairsKey,
|
||||
Value: strconv.FormatFloat(fieldValue, 'E', -1, 64),
|
||||
})
|
||||
metric.Name = measurement
|
||||
return metric, nil
|
||||
}
|
||||
@@ -1,190 +0,0 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package apsaramon
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/cloudmon/collectors/common"
|
||||
|
||||
const (
|
||||
PERIOD = 60
|
||||
UNIT_AVERAGE = "Average"
|
||||
DEFAULT_STATISTICS = "Average,Minimum,Maximum"
|
||||
UNIT_PERCENT = "Percent"
|
||||
UNIT_BPS = "bps"
|
||||
UNIT_MBPS = "Mbps"
|
||||
UNIT_BYTEPS = "Bps"
|
||||
UNIT_CPS = "cps"
|
||||
UNIT_COUNT = "count"
|
||||
UNIT_MEM = "byte"
|
||||
UNIT_MSEC = "ms"
|
||||
UNIT_COUNT_SEC = "count/s"
|
||||
|
||||
//ESC监控指标
|
||||
INFLUXDB_FIELD_CPU_USAGE = "vm_cpu.usage_active"
|
||||
INFLUXDB_FIELD_MEM_USAGE = "vm_mem.used_percent"
|
||||
INFLUXDB_FIELD_DISK_READ_BPS = "vm_diskio.read_bps"
|
||||
INFLUXDB_FIELD_DISK_WRITE_BPS = "vm_diskio.write_bps"
|
||||
INFLUXDB_FIELD_DISK_READ_IOPS = "vm_diskio.read_iops"
|
||||
INFLUXDB_FIELD_DISK_WRITE_IOPS = "vm_diskio.write_iops"
|
||||
INFLUXDB_FIELD_NET_BPS_RX = "vm_netio.bps_recv"
|
||||
INFLUXDB_FIELD_NET_BPS_RX_INTERNET = INFLUXDB_FIELD_NET_BPS_RX + ",net_type=internet"
|
||||
INFLUXDB_FIELD_NET_BPS_RX_INTRANET = INFLUXDB_FIELD_NET_BPS_RX + ",net_type=intranet"
|
||||
INFLUXDB_FIELD_NET_BPS_TX = "vm_netio.bps_sent"
|
||||
INFLUXDB_FIELD_NET_BPS_TX_INTERNET = INFLUXDB_FIELD_NET_BPS_TX + ",net_type=internet"
|
||||
INFLUXDB_FIELD_NET_BPS_TX_INTRANET = INFLUXDB_FIELD_NET_BPS_TX + ",net_type=intranet"
|
||||
INFLUXDB_FIELD_WANOUTTRAFFIC = "vm_eipio.bps_out"
|
||||
INFLUXDB_FIELD_WANINTRAFFIC = "vm_eipio.bps_in"
|
||||
INFLUXDB_FIELD_WANOUTPKG = "vm_eipio.pps_out"
|
||||
INFLUXDB_FIELD_WANINPKG = "vm_eipio.pps_in"
|
||||
|
||||
//RDS监控指标
|
||||
INFLUXDB_FIELD_RDS_CPU_USAGE = "rds_cpu.usage_active"
|
||||
INFLUXDB_FIELD_RDS_MEM_USAGE = "rds_mem.used_percent"
|
||||
INFLUXDB_FIELD_RDS_NET_BPS_RX = "rds_netio.bps_recv"
|
||||
INFLUXDB_FIELD_RDS_NET_BPS_RX_MYSQL = INFLUXDB_FIELD_RDS_NET_BPS_RX + ",server_type=mysql"
|
||||
INFLUXDB_FIELD_RDS_NET_BPS_RX_SQLSERVER = INFLUXDB_FIELD_RDS_NET_BPS_RX + ",server_type=sqlserver"
|
||||
INFLUXDB_FIELD_RDS_NET_BPS_TX = "rds_netio.bps_sent"
|
||||
INFLUXDB_FIELD_RDS_NET_BPS_TX_MYSQL = INFLUXDB_FIELD_RDS_NET_BPS_TX + ",server_type=mysql"
|
||||
INFLUXDB_FIELD_RDS_NET_BPS_TX_SQLSERVER = INFLUXDB_FIELD_RDS_NET_BPS_TX + ",server_type=sqlserver"
|
||||
INFLUXDB_FIELD_RDS_DISK_USAGE = "rds_disk.used_percent"
|
||||
INFLUXDB_FIELD_RDS_DISK_READ_BPS = "rds_diskio.read_bps"
|
||||
INFLUXDB_FIELD_RDS_DISK_WRITE_BPS = "rds_diskio.write_bps"
|
||||
INFLUXDB_FIELD_RDS_CONN_COUNT = "rds_conn.used_count"
|
||||
INFLUXDB_FIELD_RDS_CONN_USAGE = "rds_conn.used_percent"
|
||||
|
||||
INFLUXDB_FIELD_RDS_QPS = "rds_qps.query_qps"
|
||||
INFLUXDB_FIELD_RDS_TPS = "rds_tps.trans_qps"
|
||||
INFLUXDB_FIELD_RDS_INNODB_REDA_BPS = "rds_innodb.read_bps"
|
||||
INFLUXDB_FIELD_RDS_INNODB_WRITE_BPS = "rds_innodb.write_bps"
|
||||
|
||||
//REDIS监控指标
|
||||
INFLUXDB_FIELD_REDIS_CPU_USAGE = "dcs_cpu.usage_percent"
|
||||
INFLUXDB_FIELD_REDIS_MEM_USAGE = "dcs_mem.used_percent"
|
||||
INFLUXDB_FIELD_REDIS_NET_BPS_RX = "dcs_netio.bps_recv"
|
||||
INFLUXDB_FIELD_REDIS_NET_BPS_TX = "dcs_netio.bps_sent"
|
||||
INFLUXDB_FIFLD_REDIS_CONN_USAGE = "dcs_conn.used_conn"
|
||||
INFLUXDB_FIFLD_REDIS_OPT_SES = "dcs_instantopt.opt_sec"
|
||||
INFLUXDB_FIFLD_REDIS_CACHE_KEYS = "dcs_cachekeys.key_count"
|
||||
INFLUXDB_FIFLD_REDIS_CACHE_EXP_KEYS = INFLUXDB_FIFLD_REDIS_CACHE_KEYS + ",exp=expire"
|
||||
INFLUXDB_FIFLD_REDIS_DATA_MEM_USAGE = "dcs_datamem.used_byte"
|
||||
|
||||
//对象存储OSS监控指标
|
||||
INFLUXDB_FIELD_OSS_NET_BPS_RX = "oss_netio.bps_recv"
|
||||
INFLUXDB_FIELD_OSS_NET_BPS_RX_INTERNET = INFLUXDB_FIELD_OSS_NET_BPS_RX + ",net_type=internet"
|
||||
INFLUXDB_FIELD_OSS_NET_BPS_RX_INTRANET = INFLUXDB_FIELD_OSS_NET_BPS_RX + ",net_type=intranet"
|
||||
INFLUXDB_FIELD_OSS_NET_BPS_TX = "oss_netio.bps_sent"
|
||||
INFLUXDB_FIELD_OSS_NET_BPS_TX_INTERNET = INFLUXDB_FIELD_OSS_NET_BPS_TX + ",net_type=internet"
|
||||
INFLUXDB_FIELD_OSS_NET_BPS_TX_INTRANET = INFLUXDB_FIELD_OSS_NET_BPS_TX + ",net_type=intranet"
|
||||
INFLUXDB_FIELD_OSS_LATECY = "oss_latency.req_late"
|
||||
INFLUXDB_FIELD_OSS_LATECY_GET = INFLUXDB_FIELD_OSS_LATECY + ",request=get"
|
||||
INFLUXDB_FIELD_OSS_LATECY_POST = INFLUXDB_FIELD_OSS_LATECY + ",request=post"
|
||||
INFLUXDB_FIELD_OSS_REQ_COUNT = "oss_req.req_count"
|
||||
INFLUXDB_FIELD_OSS_REQ_COUNT_GET = INFLUXDB_FIELD_OSS_REQ_COUNT + ",request=get"
|
||||
INFLUXDB_FIELD_OSS_REQ_COUNT_POST = INFLUXDB_FIELD_OSS_REQ_COUNT + ",request=post"
|
||||
INFLUXDB_FIELD_OSS_REQ_COUNT_5XX = INFLUXDB_FIELD_OSS_REQ_COUNT + ",request=5xx"
|
||||
INFLUXDB_FIELD_OSS_REQ_COUNT_4XX = INFLUXDB_FIELD_OSS_REQ_COUNT + ",request=4xx"
|
||||
|
||||
//负载均衡监控指标
|
||||
INFLUXDB_FIELD_ELB_NET_BPS_RX = "haproxy.bin"
|
||||
INFLUXDB_FIELD_ELB_NET_BPS_TX = "haproxy.bout"
|
||||
INFLUXDB_FIELD_ELB_REQ_RATE = "haproxy.req_rate,request=http"
|
||||
INFLUXDB_FIELD_ELB_CONN_RATE = "haproxy.conn_rate,request=tcp"
|
||||
INFLUXDB_FIELD_ELB_DREQ_COUNT = "haproxy.dreq,request=http"
|
||||
INFLUXDB_FIELD_ELB_DCONN_COUNT = "haproxy.dcon,request=tcp"
|
||||
INFLUXDB_FIELD_ELB_HRSP_COUNT = "haproxy.hrsp_Nxx"
|
||||
INFLUXDB_FIELD_ELB_HRSP_COUNT_2XX = INFLUXDB_FIELD_ELB_HRSP_COUNT + ",request=2xx"
|
||||
INFLUXDB_FIELD_ELB_HRSP_COUNT_3XX = INFLUXDB_FIELD_ELB_HRSP_COUNT + ",request=3xx"
|
||||
INFLUXDB_FIELD_ELB_HRSP_COUNT_4XX = INFLUXDB_FIELD_ELB_HRSP_COUNT + ",request=4xx"
|
||||
INFLUXDB_FIELD_ELB_HRSP_COUNT_5XX = INFLUXDB_FIELD_ELB_HRSP_COUNT + ",request=5xx"
|
||||
INFLUXDB_FIELD_ELB_CHC_STATUS = "haproxy.check_status"
|
||||
INFLUXDB_FIELD_ELB_CHC_CODE = "haproxy.check_code"
|
||||
INFLUXDB_FIELD_ELB_LAST_CHC = "haproxy.last_chk"
|
||||
|
||||
KEY_VMS = "vms"
|
||||
KEY_CPUS = "cpus"
|
||||
KEY_MEMS = "mems"
|
||||
KEY_DISKS = "disks"
|
||||
|
||||
KEY_LIMIT = "limit"
|
||||
KEY_ADMIN = "admin"
|
||||
KEY_USABLE = "usable"
|
||||
)
|
||||
|
||||
//multiCloud查询指标列表组装
|
||||
var aliMetricSpecs = map[string][]string{
|
||||
"CPUUtilization": {DEFAULT_STATISTICS, UNIT_PERCENT, INFLUXDB_FIELD_CPU_USAGE},
|
||||
"InternetInRate": {DEFAULT_STATISTICS, UNIT_BPS, INFLUXDB_FIELD_NET_BPS_RX_INTERNET},
|
||||
"IntranetInRate": {DEFAULT_STATISTICS, UNIT_BPS, INFLUXDB_FIELD_NET_BPS_RX_INTRANET},
|
||||
"InternetOutRate": {DEFAULT_STATISTICS, UNIT_BPS, INFLUXDB_FIELD_NET_BPS_TX_INTERNET},
|
||||
"IntranetOutRate": {DEFAULT_STATISTICS, UNIT_BPS, INFLUXDB_FIELD_NET_BPS_TX_INTRANET},
|
||||
"DiskReadBPS": {DEFAULT_STATISTICS, UNIT_BYTEPS, INFLUXDB_FIELD_DISK_READ_BPS},
|
||||
"DiskWriteBPS": {DEFAULT_STATISTICS, UNIT_BYTEPS, INFLUXDB_FIELD_DISK_WRITE_BPS},
|
||||
"DiskReadIOPS": {DEFAULT_STATISTICS, UNIT_CPS, INFLUXDB_FIELD_DISK_READ_IOPS},
|
||||
"DiskWriteIOPS": {DEFAULT_STATISTICS, UNIT_CPS, INFLUXDB_FIELD_DISK_WRITE_IOPS},
|
||||
}
|
||||
var apsaraMetricSpecs = map[string][]string{
|
||||
"vm.MemoryUtilization": {DEFAULT_STATISTICS, UNIT_PERCENT, INFLUXDB_FIELD_MEM_USAGE},
|
||||
"vm.CPUUtilization": {DEFAULT_STATISTICS, UNIT_PERCENT, INFLUXDB_FIELD_CPU_USAGE},
|
||||
"diskusage_utilization": {DEFAULT_STATISTICS, UNIT_PERCENT, common.INFLUXDB_FIELD_DISK_USAGE},
|
||||
"InternetInRate": {DEFAULT_STATISTICS, UNIT_BPS, INFLUXDB_FIELD_NET_BPS_RX_INTERNET},
|
||||
"IntranetInRate": {DEFAULT_STATISTICS, UNIT_BPS, INFLUXDB_FIELD_NET_BPS_RX_INTRANET},
|
||||
"InternetOutRate": {DEFAULT_STATISTICS, UNIT_BPS, INFLUXDB_FIELD_NET_BPS_TX_INTERNET},
|
||||
"IntranetOutRate": {DEFAULT_STATISTICS, UNIT_BPS, INFLUXDB_FIELD_NET_BPS_TX_INTRANET},
|
||||
"DiskReadBPS": {DEFAULT_STATISTICS, UNIT_BYTEPS, INFLUXDB_FIELD_DISK_READ_BPS},
|
||||
"DiskWriteBPS": {DEFAULT_STATISTICS, UNIT_BYTEPS, INFLUXDB_FIELD_DISK_WRITE_BPS},
|
||||
"DiskReadIOPS": {DEFAULT_STATISTICS, UNIT_CPS, INFLUXDB_FIELD_DISK_READ_IOPS},
|
||||
"DiskWriteIOPS": {DEFAULT_STATISTICS, UNIT_CPS, INFLUXDB_FIELD_DISK_WRITE_IOPS},
|
||||
}
|
||||
var aliRdsMetricSpecs = map[string][]string{
|
||||
"CpuUsage": {DEFAULT_STATISTICS, UNIT_PERCENT, INFLUXDB_FIELD_RDS_CPU_USAGE},
|
||||
"MemoryUsage": {DEFAULT_STATISTICS, UNIT_PERCENT, INFLUXDB_FIELD_RDS_MEM_USAGE},
|
||||
"MySQL_NetworkInNew": {DEFAULT_STATISTICS, UNIT_BPS, INFLUXDB_FIELD_RDS_NET_BPS_RX_MYSQL},
|
||||
"MySQL_NetworkOutNew": {DEFAULT_STATISTICS, UNIT_BPS, INFLUXDB_FIELD_RDS_NET_BPS_TX_MYSQL},
|
||||
"DiskUsage": {DEFAULT_STATISTICS, UNIT_PERCENT, INFLUXDB_FIELD_RDS_DISK_USAGE},
|
||||
"SQLServer_NetworkInNew": {DEFAULT_STATISTICS, UNIT_BPS, INFLUXDB_FIELD_RDS_NET_BPS_RX_SQLSERVER},
|
||||
"SQLServer_NetworkOutNew": {DEFAULT_STATISTICS, UNIT_BPS, INFLUXDB_FIELD_RDS_NET_BPS_TX_SQLSERVER},
|
||||
"ConnectionUsage": {DEFAULT_STATISTICS, UNIT_PERCENT, INFLUXDB_FIELD_RDS_CONN_USAGE},
|
||||
}
|
||||
var aliRedisMetricSpecs = map[string][]string{
|
||||
"CpuUsage": {DEFAULT_STATISTICS, UNIT_PERCENT, INFLUXDB_FIELD_REDIS_CPU_USAGE},
|
||||
"MemoryUsage": {DEFAULT_STATISTICS, UNIT_PERCENT, INFLUXDB_FIELD_REDIS_MEM_USAGE},
|
||||
"IntranetIn": {DEFAULT_STATISTICS, UNIT_BPS, INFLUXDB_FIELD_REDIS_NET_BPS_RX},
|
||||
"IntranetOut": {DEFAULT_STATISTICS, UNIT_BPS, INFLUXDB_FIELD_REDIS_NET_BPS_TX},
|
||||
"UsedConnection": {DEFAULT_STATISTICS, UNIT_COUNT, INFLUXDB_FIFLD_REDIS_CONN_USAGE},
|
||||
"UsedQPS": {DEFAULT_STATISTICS, UNIT_COUNT, INFLUXDB_FIFLD_REDIS_OPT_SES},
|
||||
"Keys": {DEFAULT_STATISTICS, UNIT_COUNT, INFLUXDB_FIFLD_REDIS_CACHE_KEYS},
|
||||
"ExpiredKeys": {DEFAULT_STATISTICS, UNIT_COUNT, INFLUXDB_FIFLD_REDIS_CACHE_EXP_KEYS},
|
||||
"UsedMemory": {DEFAULT_STATISTICS, UNIT_MEM, INFLUXDB_FIFLD_REDIS_DATA_MEM_USAGE},
|
||||
}
|
||||
var aliOSSMetricSpecs = map[string][]string{
|
||||
"InternetSend": {DEFAULT_STATISTICS, UNIT_MEM, INFLUXDB_FIELD_OSS_NET_BPS_TX_INTERNET},
|
||||
"InternetRecv": {DEFAULT_STATISTICS, UNIT_MEM, INFLUXDB_FIELD_OSS_NET_BPS_RX_INTERNET},
|
||||
"IntranetSend": {DEFAULT_STATISTICS, UNIT_MEM, INFLUXDB_FIELD_OSS_NET_BPS_TX_INTRANET},
|
||||
"IntranetRecv": {DEFAULT_STATISTICS, UNIT_MEM, INFLUXDB_FIELD_OSS_NET_BPS_RX_INTRANET},
|
||||
"GetObjectE2eLatency": {DEFAULT_STATISTICS, UNIT_MSEC, INFLUXDB_FIELD_OSS_LATECY_GET},
|
||||
"PostObjectE2eLatency": {DEFAULT_STATISTICS, UNIT_MSEC, INFLUXDB_FIELD_OSS_LATECY_POST},
|
||||
"GetObjectCount": {DEFAULT_STATISTICS, UNIT_COUNT, INFLUXDB_FIELD_OSS_REQ_COUNT_GET},
|
||||
"PostObjectCount": {DEFAULT_STATISTICS, UNIT_COUNT, INFLUXDB_FIELD_OSS_REQ_COUNT_POST},
|
||||
"ServerErrorCount": {DEFAULT_STATISTICS, UNIT_COUNT, INFLUXDB_FIELD_OSS_REQ_COUNT_5XX},
|
||||
}
|
||||
var aliElbMetricSpecs = map[string][]string{
|
||||
"InstanceTrafficRX": {DEFAULT_STATISTICS, UNIT_BPS, INFLUXDB_FIELD_ELB_NET_BPS_RX},
|
||||
"TrafficRXNew": {DEFAULT_STATISTICS, UNIT_BPS, INFLUXDB_FIELD_ELB_NET_BPS_RX},
|
||||
"InstanceTrafficTX": {DEFAULT_STATISTICS, UNIT_BPS, INFLUXDB_FIELD_ELB_NET_BPS_TX},
|
||||
"TrafficTXNew": {DEFAULT_STATISTICS, UNIT_BPS, INFLUXDB_FIELD_ELB_NET_BPS_TX},
|
||||
"InstanceStatusCode2xx": {DEFAULT_STATISTICS, UNIT_COUNT_SEC, INFLUXDB_FIELD_ELB_HRSP_COUNT_2XX},
|
||||
"InstanceStatusCode3xx": {DEFAULT_STATISTICS, UNIT_COUNT_SEC, INFLUXDB_FIELD_ELB_HRSP_COUNT_3XX},
|
||||
"InstanceStatusCode4xx": {DEFAULT_STATISTICS, UNIT_COUNT_SEC, INFLUXDB_FIELD_ELB_HRSP_COUNT_4XX},
|
||||
"InstanceStatusCode5xx": {DEFAULT_STATISTICS, UNIT_COUNT_SEC, INFLUXDB_FIELD_ELB_HRSP_COUNT_5XX},
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package apsaramon // import "yunion.io/x/onecloud/pkg/cloudmon/collectors/apsaramon"
|
||||
@@ -1,87 +0,0 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package awsmon
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/pkg/apis/compute"
|
||||
"yunion.io/x/onecloud/pkg/cloudmon/collectors/common"
|
||||
"yunion.io/x/onecloud/pkg/cloudmon/options"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
)
|
||||
|
||||
func init() {
|
||||
factory := SAwsCloudReportFactory{}
|
||||
common.RegisterFactory(&factory)
|
||||
}
|
||||
|
||||
type SAwsCloudReportFactory struct {
|
||||
common.CommonReportFactory
|
||||
}
|
||||
|
||||
func (self *SAwsCloudReportFactory) NewCloudReport(provider *common.SProvider, session *mcclient.ClientSession,
|
||||
args *options.ReportOptions, operatorType string) common.ICloudReport {
|
||||
return &SAwsCloudReport{
|
||||
common.CloudReportBase{
|
||||
SProvider: provider,
|
||||
Session: session,
|
||||
Args: args,
|
||||
Operator: operatorType,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (self *SAwsCloudReportFactory) GetId() string {
|
||||
return compute.CLOUD_PROVIDER_AWS
|
||||
}
|
||||
|
||||
type SAwsCloudReport struct {
|
||||
common.CloudReportBase
|
||||
}
|
||||
|
||||
func (self *SAwsCloudReport) Report() error {
|
||||
servers, err := self.GetResourceByOperator()
|
||||
//servers, err := self.GetAllserverOfThisProvider(&modules.Servers)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
providerInstance, err := self.InitProviderInstance()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
regionList, regionServerMap, err := self.GetAllRegionOfServers(servers, providerInstance)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, region := range regionList {
|
||||
servers := regionServerMap[region.GetGlobalId()]
|
||||
switch self.Operator {
|
||||
default:
|
||||
err = common.CollectRegionMetricAsync(self.Args.Batch, region, servers, self)
|
||||
//err = self.collectRegionMetricOfHost(region, servers)
|
||||
//case "redis":
|
||||
// err = self.collectRegionMetricOfRedis(region, servers)
|
||||
//case "rds":
|
||||
// err = self.collectRegionMetricOfRds(region, servers)
|
||||
//case "oss":
|
||||
// err = self.collectRegionMetricOfOss(region, servers)
|
||||
//case "elb":
|
||||
// err = self.collectRegionMetricOfElb(region, servers)
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,160 +0,0 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package awsmon
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
aws_sdk "github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/service/cloudwatch"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/log"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/cloudmon/collectors/common"
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
"yunion.io/x/onecloud/pkg/multicloud/aws"
|
||||
"yunion.io/x/onecloud/pkg/util/influxdb"
|
||||
)
|
||||
|
||||
func (self *SAwsCloudReport) CollectRegionMetric(region cloudprovider.ICloudRegion,
|
||||
servers []jsonutils.JSONObject) error {
|
||||
var err error
|
||||
switch self.Operator {
|
||||
default:
|
||||
|
||||
err = self.collectRegionMetricOfHost(region, servers)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (self *SAwsCloudReport) collectRegionMetricOfHost(region cloudprovider.ICloudRegion,
|
||||
servers []jsonutils.JSONObject) error {
|
||||
dataList := make([]influxdb.SMetricData, 0)
|
||||
awsRegion := region.(*aws.SRegion)
|
||||
since, until, err := common.TimeRangeFromArgs(self.Args)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
namespace, specs := self.getMetricSpecs(nil)
|
||||
for metricName, influxDbSpecs := range specs {
|
||||
for i, server := range servers {
|
||||
//external_id, _ := servers[i].GetString("external_id")
|
||||
name, val := self.getDimensionNameAndVal(servers[i])
|
||||
rtnArray, err := awsRegion.GetMonitorDataByDimensionName(metricName, namespace, name, val,
|
||||
since, until)
|
||||
if err != nil {
|
||||
log.Errorln(err)
|
||||
continue
|
||||
}
|
||||
if len(rtnArray.Datapoints) > 0 {
|
||||
for _, dataPoint := range rtnArray.Datapoints {
|
||||
metric, err := common.FillVMCapacity(server.(*jsonutils.JSONDict))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
dataList = append(dataList, metric)
|
||||
serverMetric, err := self.collectMetricFromThisServerForAws(server, dataPoint, influxDbSpecs)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
dataList = append(dataList, serverMetric)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
err = common.SendMetrics(self.Session, dataList, self.Args.Debug, "")
|
||||
if err != nil {
|
||||
log.Errorln(err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *SAwsCloudReport) getMetricSpecs(res jsonutils.JSONObject) (string, map[string][]string) {
|
||||
switch common.MonType(self.Operator) {
|
||||
case common.SERVER:
|
||||
return SERVER_METRIC_NAMESPACE, awsMetricSpecs
|
||||
case common.REDIS:
|
||||
return REDIS_METRIC_NAMESPACE, awsRedisMetricsSpec
|
||||
case common.RDS:
|
||||
return RDS_METRIC_NAMESPACE, awsRdsMetricSpecs
|
||||
default:
|
||||
return SERVER_METRIC_NAMESPACE, awsMetricSpecs
|
||||
}
|
||||
}
|
||||
|
||||
func (self *SAwsCloudReport) getDimensionNameAndVal(res jsonutils.JSONObject) (string, string) {
|
||||
external_id, _ := res.GetString("external_id")
|
||||
switch common.MonType(self.Operator) {
|
||||
case common.SERVER:
|
||||
return "InstanceId", external_id
|
||||
case common.REDIS:
|
||||
external_id, _ = res.GetString("name")
|
||||
return "CacheClusterId", external_id
|
||||
case common.RDS:
|
||||
external_id, _ = res.GetString("name")
|
||||
return "DBInstanceIdentifier", external_id
|
||||
default:
|
||||
return "InstanceId", external_id
|
||||
}
|
||||
}
|
||||
|
||||
func (self *SAwsCloudReport) collectMetricFromThisServerForAws(server jsonutils.JSONObject, datapoint *cloudwatch.Datapoint,
|
||||
influxDbSpecs []string) (metric influxdb.SMetricData, err error) {
|
||||
metric, err = self.NewMetricFromJson(server)
|
||||
if err != nil {
|
||||
return metric, err
|
||||
}
|
||||
metric.Timestamp = aws_sdk.TimeValue(datapoint.Timestamp)
|
||||
fieldValue := aws_sdk.Float64Value(datapoint.Average)
|
||||
//根据条件拼装metric的tag和metirc信息
|
||||
influxDbSpec := influxDbSpecs[2]
|
||||
measurement := common.SubstringBefore(influxDbSpec, ".")
|
||||
var pairsKey string
|
||||
if strings.Contains(influxDbSpec, ",") {
|
||||
pairsKey = common.SubstringBetween(influxDbSpec, ".", ",")
|
||||
} else {
|
||||
pairsKey = common.SubstringAfter(influxDbSpec, ".")
|
||||
}
|
||||
// 300:AWS metric collection period is 5m
|
||||
if influxDbSpecs[1] == UNIT_COUNT {
|
||||
fieldValue = (fieldValue / float64(300))
|
||||
}
|
||||
if influxDbSpecs[1] == UNIT_MEM {
|
||||
fieldValue = (fieldValue / float64(300) * 8)
|
||||
}
|
||||
if influxDbSpecs[1] == UNIT_BYTEPS {
|
||||
fieldValue = (fieldValue * 8)
|
||||
}
|
||||
tag := common.SubstringAfter(influxDbSpec, ",")
|
||||
if tag != "" && strings.Contains(influxDbSpec, "=") {
|
||||
metric.Tags = append(metric.Tags, influxdb.SKeyValue{Key: common.SubstringBefore(tag, "="),
|
||||
Value: common.SubstringAfter(tag, "=")})
|
||||
}
|
||||
cpu_cout, err := server.Get("vcpu_count")
|
||||
if err != nil {
|
||||
metric.Metrics = append(metric.Metrics, influxdb.SKeyValue{Key: pairsKey,
|
||||
Value: strconv.FormatFloat(fieldValue, 'E', -1, 64)})
|
||||
} else {
|
||||
metric.Metrics = append(metric.Metrics, influxdb.SKeyValue{Key: "cpu_count",
|
||||
Value: strconv.FormatInt(cpu_cout.(*jsonutils.JSONInt).Value(), 10)},
|
||||
influxdb.SKeyValue{Key: pairsKey,
|
||||
Value: strconv.FormatFloat(fieldValue, 'E', -1, 64)})
|
||||
}
|
||||
metric.Name = measurement
|
||||
return metric, nil
|
||||
}
|
||||
@@ -1,158 +0,0 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package awsmon
|
||||
|
||||
const (
|
||||
PERIOD = 60
|
||||
UNIT_AVERAGE = "Average"
|
||||
DEFAULT_STATISTICS = "Average,Minimum,Maximum"
|
||||
UNIT_PERCENT = "Percent"
|
||||
UNIT_BPS = "bps"
|
||||
UNIT_MBPS = "Mbps"
|
||||
UNIT_BYTEPS = "Bps"
|
||||
UNIT_CPS = "cps"
|
||||
UNIT_COUNT = "count"
|
||||
UNIT_MEM = "byte"
|
||||
UNIT_MSEC = "ms"
|
||||
UNIT_COUNT_SEC = "count/s"
|
||||
|
||||
SERVER_METRIC_NAMESPACE = "AWS/EC2"
|
||||
REDIS_METRIC_NAMESPACE = "AWS/ElastiCache"
|
||||
RDS_METRIC_NAMESPACE = "AWS/RDS"
|
||||
|
||||
//ESC监控指标
|
||||
INFLUXDB_FIELD_CPU_USAGE = "vm_cpu.usage_active"
|
||||
INFLUXDB_FIELD_MEM_USAGE = "vm_mem.used_percent"
|
||||
INFLUXDB_FIELD_DISK_READ_BPS = "vm_diskio.read_bps"
|
||||
INFLUXDB_FIELD_DISK_WRITE_BPS = "vm_diskio.write_bps"
|
||||
INFLUXDB_FIELD_DISK_READ_BPS_EBS = INFLUXDB_FIELD_DISK_READ_BPS + ",disk_type=ebs"
|
||||
INFLUXDB_FIELD_DISK_WRITE_BPS_EBS = INFLUXDB_FIELD_DISK_WRITE_BPS + ",disk_type=ebs"
|
||||
INFLUXDB_FIELD_DISK_READ_IOPS = "vm_diskio.read_iops"
|
||||
INFLUXDB_FIELD_DISK_WRITE_IOPS = "vm_diskio.write_iops"
|
||||
INFLUXDB_FIELD_DISK_READ_IOPS_EBS = INFLUXDB_FIELD_DISK_READ_IOPS + ",disk_type=ebs"
|
||||
INFLUXDB_FIELD_DISK_WRITE_IOPS_EBS = INFLUXDB_FIELD_DISK_WRITE_IOPS + ",disk_type=ebs"
|
||||
INFLUXDB_FIELD_NET_BPS_RX = "vm_netio.bps_recv"
|
||||
INFLUXDB_FIELD_NET_BPS_RX_INTERNET = INFLUXDB_FIELD_NET_BPS_RX + ",net_type=internet"
|
||||
INFLUXDB_FIELD_NET_BPS_RX_INTRANET = INFLUXDB_FIELD_NET_BPS_RX + ",net_type=intranet"
|
||||
INFLUXDB_FIELD_NET_BPS_TX = "vm_netio.bps_sent"
|
||||
INFLUXDB_FIELD_NET_BPS_TX_INTERNET = INFLUXDB_FIELD_NET_BPS_TX + ",net_type=internet"
|
||||
INFLUXDB_FIELD_NET_BPS_TX_INTRANET = INFLUXDB_FIELD_NET_BPS_TX + ",net_type=intranet"
|
||||
INFLUXDB_FIELD_WANOUTTRAFFIC = "vm_eipio.bps_out"
|
||||
INFLUXDB_FIELD_WANINTRAFFIC = "vm_eipio.bps_in"
|
||||
INFLUXDB_FIELD_WANOUTPKG = "vm_eipio.pps_out"
|
||||
INFLUXDB_FIELD_WANINPKG = "vm_eipio.pps_in"
|
||||
|
||||
//RDS监控指标
|
||||
INFLUXDB_FIELD_RDS_CPU_USAGE = "rds_cpu.usage_active"
|
||||
INFLUXDB_FIELD_RDS_MEM_USAGE = "rds_mem.used_percent"
|
||||
INFLUXDB_FIELD_RDS_NET_BPS_RX = "rds_netio.bps_recv"
|
||||
INFLUXDB_FIELD_RDS_NET_BPS_RX_MYSQL = INFLUXDB_FIELD_RDS_NET_BPS_RX + ",server_type=mysql"
|
||||
INFLUXDB_FIELD_RDS_NET_BPS_RX_SQLSERVER = INFLUXDB_FIELD_RDS_NET_BPS_RX + ",server_type=sqlserver"
|
||||
INFLUXDB_FIELD_RDS_NET_BPS_TX = "rds_netio.bps_send"
|
||||
INFLUXDB_FIELD_RDS_NET_BPS_TX_MYSQL = INFLUXDB_FIELD_RDS_NET_BPS_TX + ",server_type=mysql"
|
||||
INFLUXDB_FIELD_RDS_NET_BPS_TX_SQLSERVER = INFLUXDB_FIELD_RDS_NET_BPS_TX + ",server_type=sqlserver"
|
||||
INFLUXDB_FIELD_RDS_DISK_USAGE = "rds_disk.used_percent"
|
||||
INFLUXDB_FIELD_RDS_DISK_READ_BPS = "rds_diskio.read_bps"
|
||||
INFLUXDB_FIELD_RDS_DISK_WRITE_BPS = "rds_diskio.write_bps"
|
||||
INFLUXDB_FIELD_RDS_CONN_COUNT = "rds_conn.used_count"
|
||||
INFLUXDB_FIELD_RDS_CONN_USAGE = "rds_conn.used_percent"
|
||||
|
||||
INFLUXDB_FIELD_RDS_QPS = "rds_qps.query_qps"
|
||||
INFLUXDB_FIELD_RDS_TPS = "rds_tps.trans_qps"
|
||||
INFLUXDB_FIELD_RDS_INNODB_REDA_BPS = "rds_innodb.read_bps"
|
||||
INFLUXDB_FIELD_RDS_INNODB_WRITE_BPS = "rds_innodb.write_bps"
|
||||
|
||||
//REDIS监控指标
|
||||
INFLUXDB_FIELD_REDIS_CPU_USAGE = "dcs_cpu.usage_percent"
|
||||
INFLUXDB_FIELD_REDIS_MEM_USAGE = "dcs_mem.used_percent"
|
||||
INFLUXDB_FIELD_REDIS_NET_BPS_RX = "dcs_netio.bps_recv"
|
||||
INFLUXDB_FIELD_REDIS_NET_BPS_TX = "dcs_netio.bps_sent"
|
||||
INFLUXDB_FIFLD_REDIS_CONN_USAGE = "dcs_conn.used_conn"
|
||||
INFLUXDB_FIFLD_REDIS_OPT_SES = "dcs_instantopt.opt_sec"
|
||||
INFLUXDB_FIFLD_REDIS_CACHE_KEYS = "dcs_cachekeys.key_count"
|
||||
INFLUXDB_FIFLD_REDIS_CACHE_KEYS_PERCENT = "dcs_cachekeys.used_percent"
|
||||
INFLUXDB_FIFLD_REDIS_CACHE_EXP_KEYS = INFLUXDB_FIFLD_REDIS_CACHE_KEYS + ",exp=expire"
|
||||
INFLUXDB_FIFLD_REDIS_DATA_MEM_USAGE = "dcs_datamem.used_byte"
|
||||
|
||||
//对象存储OSS监控指标
|
||||
INFLUXDB_FIELD_OSS_NET_BPS_RX = "oss_netio.bps_recv"
|
||||
INFLUXDB_FIELD_OSS_NET_BPS_RX_INTERNET = INFLUXDB_FIELD_OSS_NET_BPS_RX + ",net_type=internet"
|
||||
INFLUXDB_FIELD_OSS_NET_BPS_RX_INTRANET = INFLUXDB_FIELD_OSS_NET_BPS_RX + ",net_type=intranet"
|
||||
INFLUXDB_FIELD_OSS_NET_BPS_TX = "oss_netio.bps_sent"
|
||||
INFLUXDB_FIELD_OSS_NET_BPS_TX_INTERNET = INFLUXDB_FIELD_OSS_NET_BPS_TX + ",net_type=internet"
|
||||
INFLUXDB_FIELD_OSS_NET_BPS_TX_INTRANET = INFLUXDB_FIELD_OSS_NET_BPS_TX + ",net_type=intranet"
|
||||
INFLUXDB_FIELD_OSS_LATECY = "oss_latency.req_late"
|
||||
INFLUXDB_FIELD_OSS_LATECY_GET = INFLUXDB_FIELD_OSS_LATECY + ",request=get"
|
||||
INFLUXDB_FIELD_OSS_LATECY_POST = INFLUXDB_FIELD_OSS_LATECY + ",request=post"
|
||||
INFLUXDB_FIELD_OSS_REQ_COUNT = "oss_req.req_count"
|
||||
INFLUXDB_FIELD_OSS_REQ_COUNT_GET = INFLUXDB_FIELD_OSS_REQ_COUNT + ",request=get"
|
||||
INFLUXDB_FIELD_OSS_REQ_COUNT_POST = INFLUXDB_FIELD_OSS_REQ_COUNT + ",request=post"
|
||||
INFLUXDB_FIELD_OSS_REQ_COUNT_5XX = INFLUXDB_FIELD_OSS_REQ_COUNT + ",request=5xx"
|
||||
INFLUXDB_FIELD_OSS_REQ_COUNT_4XX = INFLUXDB_FIELD_OSS_REQ_COUNT + ",request=4xx"
|
||||
|
||||
//负载均衡监控指标
|
||||
INFLUXDB_FIELD_ELB_NET_BPS_RX = "haproxy.bin"
|
||||
INFLUXDB_FIELD_ELB_NET_BPS_TX = "haproxy.bout"
|
||||
INFLUXDB_FIELD_ELB_REQ_RATE = "haproxy.req_rate,request=http"
|
||||
INFLUXDB_FIELD_ELB_CONN_RATE = "haproxy.conn_rate,request=tcp"
|
||||
INFLUXDB_FIELD_ELB_DREQ_COUNT = "haproxy.dreq,request=http"
|
||||
INFLUXDB_FIELD_ELB_DCONN_COUNT = "haproxy.dcon,request=tcp"
|
||||
INFLUXDB_FIELD_ELB_HRSP_COUNT = "haproxy.hrsp_Nxx"
|
||||
INFLUXDB_FIELD_ELB_HRSP_COUNT_2XX = INFLUXDB_FIELD_ELB_HRSP_COUNT + ",request=2xx"
|
||||
INFLUXDB_FIELD_ELB_HRSP_COUNT_3XX = INFLUXDB_FIELD_ELB_HRSP_COUNT + ",request=3xx"
|
||||
INFLUXDB_FIELD_ELB_HRSP_COUNT_4XX = INFLUXDB_FIELD_ELB_HRSP_COUNT + ",request=4xx"
|
||||
INFLUXDB_FIELD_ELB_HRSP_COUNT_5XX = INFLUXDB_FIELD_ELB_HRSP_COUNT + ",request=5xx"
|
||||
INFLUXDB_FIELD_ELB_CHC_STATUS = "haproxy.check_status"
|
||||
INFLUXDB_FIELD_ELB_CHC_CODE = "haproxy.check_code"
|
||||
INFLUXDB_FIELD_ELB_LAST_CHC = "haproxy.last_chk"
|
||||
|
||||
KEY_VMS = "vms"
|
||||
KEY_CPUS = "cpus"
|
||||
KEY_MEMS = "mems"
|
||||
KEY_DISKS = "disks"
|
||||
|
||||
KEY_LIMIT = "limit"
|
||||
KEY_ADMIN = "admin"
|
||||
KEY_USABLE = "usable"
|
||||
)
|
||||
|
||||
//multiCloud查询指标列表组装
|
||||
var awsMetricSpecs = map[string][]string{
|
||||
"CPUUtilization": {DEFAULT_STATISTICS, UNIT_PERCENT, INFLUXDB_FIELD_CPU_USAGE},
|
||||
"DiskReadOps": {DEFAULT_STATISTICS, UNIT_COUNT, INFLUXDB_FIELD_DISK_READ_IOPS},
|
||||
"EBSReadOps": {DEFAULT_STATISTICS, UNIT_COUNT, INFLUXDB_FIELD_DISK_READ_IOPS_EBS},
|
||||
"DiskWriteOps": {DEFAULT_STATISTICS, UNIT_COUNT, INFLUXDB_FIELD_DISK_WRITE_IOPS},
|
||||
"EBSWriteOps": {DEFAULT_STATISTICS, UNIT_COUNT, INFLUXDB_FIELD_DISK_WRITE_IOPS_EBS},
|
||||
"DiskReadBytes": {DEFAULT_STATISTICS, UNIT_MEM, INFLUXDB_FIELD_DISK_READ_BPS},
|
||||
"EBSReadBytes": {DEFAULT_STATISTICS, UNIT_MEM, INFLUXDB_FIELD_DISK_READ_BPS_EBS},
|
||||
"DiskWriteBytes": {DEFAULT_STATISTICS, UNIT_MEM, INFLUXDB_FIELD_DISK_WRITE_BPS},
|
||||
"EBSWriteBytes": {DEFAULT_STATISTICS, UNIT_MEM, INFLUXDB_FIELD_DISK_WRITE_BPS_EBS},
|
||||
"NetworkIn": {DEFAULT_STATISTICS, UNIT_MEM, INFLUXDB_FIELD_NET_BPS_RX},
|
||||
"NetworkOut": {DEFAULT_STATISTICS, UNIT_MEM, INFLUXDB_FIELD_NET_BPS_TX},
|
||||
}
|
||||
|
||||
var awsRdsMetricSpecs = map[string][]string{
|
||||
"CPUUtilization": {DEFAULT_STATISTICS, UNIT_PERCENT, INFLUXDB_FIELD_RDS_CPU_USAGE},
|
||||
"NetworkReceiveThroughput": {DEFAULT_STATISTICS, UNIT_BYTEPS, INFLUXDB_FIELD_RDS_NET_BPS_RX},
|
||||
"NetworkTransmitThroughput": {DEFAULT_STATISTICS, UNIT_BYTEPS, INFLUXDB_FIELD_RDS_NET_BPS_TX},
|
||||
"DatabaseConnections": {DEFAULT_STATISTICS, UNIT_COUNT, INFLUXDB_FIELD_RDS_CONN_COUNT},
|
||||
}
|
||||
|
||||
var awsRedisMetricsSpec = map[string][]string{
|
||||
"CPUUtilization": {DEFAULT_STATISTICS, UNIT_PERCENT, INFLUXDB_FIELD_REDIS_CPU_USAGE},
|
||||
"CurrConnections": {DEFAULT_STATISTICS, UNIT_COUNT, INFLUXDB_FIFLD_REDIS_CONN_USAGE},
|
||||
"Reclaimed": {DEFAULT_STATISTICS, UNIT_COUNT, INFLUXDB_FIFLD_REDIS_CACHE_EXP_KEYS},
|
||||
"CacheHitRate": {DEFAULT_STATISTICS, UNIT_PERCENT, INFLUXDB_FIFLD_REDIS_CACHE_KEYS_PERCENT},
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package awsmon // import "yunion.io/x/onecloud/pkg/cloudmon/collectors/awsmon"
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user