cmdb

package
v1.1.0-rc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 8, 2021 License: AGPL-3.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CMDB_ABNORMAL_HOSTS_LIST = apis.ApiSpec{
	Path:         "/api/hosts/actions/statistics-abnormal",
	BackendPath:  "/api/hosts/actions/statistics-abnormal",
	Host:         "cmdb.marathon.l4lb.thisdcos.directory:9093",
	Scheme:       "http",
	Method:       "GET",
	CheckLogin:   true,
	RequestType:  apistructs.AbnormalHostUsageListRequest{},
	ResponseType: apistructs.AbnormalHostUsageListResponse{},
	Doc:          "异常主机资源使用列表详情",
}
View Source
var CMDB_CLUSTER_CREATE = apis.ApiSpec{
	Path:         "/api/clusters",
	BackendPath:  "/api/clusters",
	Host:         "cmdb.marathon.l4lb.thisdcos.directory:9093",
	Scheme:       "http",
	Method:       "POST",
	CheckLogin:   true,
	CheckToken:   true,
	IsOpenAPI:    true,
	RequestType:  apistructs.ClusterCreateRequest{},
	ResponseType: apistructs.ClusterCreateResponse{},
	Doc:          "summary: 创建集群",
	Audit: func(ctx *spec.AuditContext) error {
		var request apistructs.ClusterCreateRequest
		if err := ctx.BindRequestData(&request); err != nil {
			return err
		}

		return ctx.CreateAudit(&apistructs.Audit{
			ScopeType:    apistructs.OrgScope,
			ScopeID:      uint64(ctx.OrgID),
			TemplateName: apistructs.ImportClusterTemplate,
			Context: map[string]interface{}{
				"clusterName": request.Name,
			},
		})
	},
}
View Source
var CMDB_CLUSTER_FETCH = apis.ApiSpec{
	Path:         "/api/clusters/<idOrName>",
	BackendPath:  "/api/clusters/<idOrName>",
	Method:       "GET",
	Host:         "cmdb.marathon.l4lb.thisdcos.directory:9093",
	Scheme:       "http",
	CheckLogin:   true,
	ResponseType: apistructs.ClusterFetchResponse{},
	Doc:          "summary: 根据集群ID或名称获取集群详细信息",
}
View Source
var CMDB_CLUSTER_INSTANCES = apis.ApiSpec{
	Path:        "/api/cmdb/clusters/<cluster>/instances",
	BackendPath: "/api/clusters/<cluster>/instances",
	Host:        "cmdb.marathon.l4lb.thisdcos.directory:9093",
	Scheme:      "http",
	Method:      "GET",
	CheckLogin:  true,
	Doc: `
summary: 获取某集群下的批量实例信息
parameters:
  - in: path
    name: cluster
    type: string
    required: true
    description: 集群名或者ID
  - in: query
    name: type
    type: string
    required: true
    enum: [cluster, host, project, application, runtime, service, component, addon]
    description: 指定请求实例的类型
    example: project
  - in: query
    name: host
    type: string
    description: type 等于 host时,若输入 host,则获取指定 host 信息;如果没有输入,则获取整个集群所有的 hosts 信息
  - in: query
    name: project
    type: string
    description: type 等于 project时,若输入 project,则获取指定 project 实例信息;如果没有输入,则获取整个集群所有的 projects 实例信息
  - in: query
    name: application
    type: string
    description: type 等于 application时,若输入 application,则获取指定 application 实例信息;如果没有输入,则获取整个集群所有的 applications 实例信息
  - in: query
    name: runtime
    type: string
    description: type 等于 runtime时,若输入 runtime,则获取指定 runtime 实例信息;如果没有输入,则获取整个集群所有的 runtimes 实例信息
  - in: query
    name: service
    type: string
    description: type 等于 service时,输入 runtime 必要参数。若输入 service,则获取指定 service 实例信息;如果没有输入,则获取指定runtime下所有的 services 实例信息
  - in: query
    name: component
    type: string
    description: type 等于 component时。若输入 component,则获取指定 component 实例信息;如果没有输入,则获取指定集群所有的 component 实例信息
  - in: query
    name: addon
    type: string
    description: type 等于 addon时。若输入 addon,则获取指定 addon 实例信息;如果没有输入,则获取指定集群所有的 addon 实例信息
produces:
  - application/json
responses:
  '200':
    description: OK
    schema:
      type: array
      items:
        type: object
        properties:
          id:
            type: string
            description: 容器ID
          deleted:
            type: boolean
            description: 资源是否被删除
          started_at:
            type: string
            description: 容器启动时间
          cluster_full_name:
            type: string
            description: 集群ID
          host_private_addr:
            type: string
            description: 宿主机内网地址
          ip_addr:
            type: string
            description: 容器IP地址
          image_name:
            type: string
            description: 容器镜像名
          cpu:
            type: number
            format: double
            description: 分配的cpu
          memory:
            type: integer
            format: int64
            description: 分配的内存(字节)
          disk:
            type: integer
            format: int64
            description: 分配的cpu
          dice_org:
            type: string
            description: 所在的组织
          dice_project:
            type: string
            description: 所在的项目
          dice_application:
            type: string
            description: 所在的应用
          dice_runtime:
            type: string
            description: 所在的runtime
          dice_service:
            type: string
            description: 所在的service
          dice_project_name:
            type: string
            description: 所在的项目名称
          dice_application_name:
            type: string
            description: 所在的应用名称
          dice_runtime_name:
            type: string
            description: 所在的runtime名称
          dice_component:
            type: string
            description: 组件名
          dice_addon:
            type: string
            description: 中间件名
          status:
            type: string
            description: 实例状态
          timestamp:
            type: integer
            format: int64
            description: 消息本身的时间戳
`,
}
View Source
var CMDB_CLUSTER_INSTANCES_USAGE = apis.ApiSpec{
	Path:        "/api/cmdb/clusters/<cluster>/instances-usage",
	BackendPath: "/api/clusters/<cluster>/instances-usage",
	Host:        "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:      "http",
	Method:      "GET",
	CheckLogin:  true,
	Doc: `
summary: 获取某类实例集合的资源使用情况
parameters:
  - in: path
    name: cluster
    type: string
    required: true
    description: 集群名或者ID
  - in: query
    name: type
    type: string
    required: true
    enum: [cluster, host, project, application, runtime, service, component, addon]
    description: 指定请求实例的类型
    example: project
  - in: query
    name: host
    type: string
    description: type 等于 host时,若输入 host,则获取指定 host 信息;如果没有输入,则获取整个集群所有的 hosts 信息
  - in: query
    name: project
    type: string
    description: type 等于 project时,若输入 project,则获取指定 project 实例信息;如果没有输入,则获取整个集群所有的 projects 实例信息
  - in: query
    name: application
    type: string
    description: type 等于 application时,若输入 application,则获取指定 application 实例信息;如果没有输入,则获取整个集群所有的 applications 实例信息
  - in: query
    name: runtime
    type: string
    description: type 等于 runtime时,若输入 runtime,则获取指定 runtime 实例信息;如果没有输入,则获取整个集群所有的 runtimes 实例信息
  - in: query
    name: service
    type: string
    description: type 等于 service时,输入 runtime 必要参数。若输入 service,则获取指定 service 实例信息;如果没有输入,则获取指定runtime下所有的 services 实例信息
  - in: query
    name: component
    type: string
    description: type 等于 component时。若输入 component,则获取指定 component 实例信息;如果没有输入,则获取指定集群所有的 component 实例信息
  - in: query
    name: addon
    type: string
    description: type 等于 addon时。若输入 addon,则获取指定 addon 实例信息;如果没有输入,则获取指定集群所有的 addon 实例信息
produces:
  - application/json

responses:
  '200':
    description: OK
    schema:
      type: string
      example: 参考 https://yuque.antfin-inc.com/terminus_paas_dev/paas/gosn9b#va3psl
components:
  schemas:
    ComponentUsage:
      type: object
      properties:
        name:
            type: string
            description: 组件名
        instance:
            type: integer
            description: 实例数
        memory:
            type: number
            format: double
            description: 分配的内存(MB)
        cpu:
            type: number
            format: double
            description: 分配的cpu数
        disk:
            type: number
            format: double
            description: 分配的磁盘空间(MB)
    AddonUsage:
      type: object
      properties:
        name:
            type: string
            description: 组件名
        instance:
            type: integer
            description: 实例数
        memory:
            type: number
            format: double
            description: 分配的内存(MB)
        cpu:
            type: number
            format: double
            description: 分配的cpu数
        disk:
            type: number
            format: double
            description: 分配的磁盘空间(MB)
    ProjectUsage:
      type: object
      properties:
        id:
            type: string
            description: 项目ID
        name:
            type: string
            description: 项目名
        instance:
            type: integer
            description: 实例数
        memory:
            type: number
            format: double
            description: 分配的内存(MB)
        cpu:
            type: number
            format: double
            description: 分配的cpu数
        disk:
            type: number
            format: double
            description: 分配的磁盘空间(MB)
    ApplicationUsage:
      type: object
      properties:
        id:
            type: string
            description: 应用ID
        name:
            type: string
            description: 应用名
        instance:
            type: integer
            description: 实例数
        memory:
            type: number
            format: double
            description: 分配的内存(MB)
        cpu:
            type: number
            format: double
            description: 分配的cpu数
        disk:
            type: number
            format: double
            description: 分配的磁盘空间(MB)
    RuntimeUsage:
      type: object
      properties:
        id:
            type: string
            description: runtime ID
        name:
            type: string
            description: runtime名
        application:
            type: string
            description: 应用名
        instance:
            type: integer
            description: 实例数
        memory:
            type: number
            format: double
            description: 分配的内存(MB)
        cpu:
            type: number
            format: double
            description: 分配的cpu数
        disk:
            type: number
            format: double
            description: 分配的磁盘空间(MB)
    ServiceUsage:
      type: object
      properties:
        name:
            type: string
            description: service名
        runtime:
            type: string
            description: runtime名
        instance:
            type: integer
            description: 实例数
        memory:
            type: number
            format: double
            description: 分配的内存(MB)
        cpu:
            type: number
            format: double
            description: 分配的cpu数
        disk:
            type: number
            format: double
            description: 分配的磁盘空间(MB)
`,
}
View Source
var CMDB_CLUSTER_LABELS = apis.ApiSpec{
	Path:         "/api/clusters/actions/statistics-labels",
	BackendPath:  "/api/clusters/actions/statistics-labels",
	Method:       "GET",
	Host:         "cmdb.marathon.l4lb.thisdcos.directory:9093",
	Scheme:       "http",
	CheckLogin:   true,
	RequestType:  apistructs.ClusterLabelsRequest{},
	ResponseType: apistructs.ClusterLabelsResponse{},
	Doc:          "summary: 集群标签占用机器数, 所在机器CPU,MEM总体使用情况, 可调度的CPU,MEM统计等",
}
View Source
var CMDB_CLUSTER_RESOURCE = apis.ApiSpec{
	Path:         "/api/clusters/actions/accumulate-resource",
	BackendPath:  "/api/clusters/actions/accumulate-resource",
	Method:       "GET",
	Host:         "cmdb.marathon.l4lb.thisdcos.directory:9093",
	Scheme:       "http",
	CheckLogin:   true,
	RequestType:  apistructs.ClusterQueryRequest{},
	ResponseType: apistructs.ClusterResourceResponse{},
	Doc:          "summary: 根据给定集群统计项目,应用,主机,异常主机和runtime的数量",
}
View Source
var CMDB_CLUSTER_SEARCH = apis.ApiSpec{
	Path:        "/api/cmdb/clusters/<cluster>/search",
	BackendPath: "/api/clusters/<cluster>/search",
	Host:        "cmdb.marathon.l4lb.thisdcos.directory:9093",
	Scheme:      "http",
	Method:      "POST",
	CheckLogin:  true,
	Doc: `
summary: 提供指定集群下的关键字搜索功能
parameters:
  - in: path
    name: cluster
    type: string
    required: true
    description: 集群名或者ID
  - in: body
    name: keyword
    description: search key
    schema:
      type: object
      required:
        - keyword
      properties:
        keyword:
          type: string
          description: keyword 使用冒号进行分割,左key右value
produces:
  - application/json
responses:
  '200':
    description: OK
    schema:
      type: string
      example: 参考 https://yuque.antfin-inc.com/terminus_paas_dev/paas/gosn9b#zngglt
`,
}
View Source
var CMDB_CLUSTER_SERVICES_LIST = apis.ApiSpec{
	Path:         "/api/clusters/actions/list-services",
	BackendPath:  "/api/clusters/actions/list-services",
	Method:       "GET",
	Host:         "cmdb.marathon.l4lb.thisdcos.directory:9093",
	Scheme:       "http",
	CheckLogin:   true,
	RequestType:  apistructs.ServicesUsageListRequest{},
	ResponseType: apistructs.ServicesUsageListResponse{},
	Doc:          "summary: 指定集群下服务资源(包括应用服务和addon)分配列表",
}
View Source
var CMDB_CLUSTER_USAGES = apis.ApiSpec{
	Path:         "/api/clusters-usage",
	BackendPath:  "/api/cluster-usages",
	Host:         "cmdb.marathon.l4lb.thisdcos.directory:9093",
	Scheme:       "http",
	Method:       "GET",
	CheckLogin:   true,
	RequestType:  apistructs.ClusterUsageListRequest{},
	ResponseType: apistructs.ClusterUsageListResponse{},
	Doc:          "summary: 集群资源使用列表",
}
View Source
var CMDB_HOST_FETCH = apis.ApiSpec{
	Path:         "/api/hosts/<host>",
	BackendPath:  "/api/hosts/<host>",
	Host:         "cmdb.marathon.l4lb.thisdcos.directory:9093",
	Scheme:       "http",
	Method:       "GET",
	CheckLogin:   true,
	RequestType:  apistructs.HostFetchRequest{},
	ResponseType: apistructs.HostFetchResponse{},
	IsOpenAPI:    true,
}
View Source
var CMDB_HOST_STATUS = apis.ApiSpec{
	Path:         "/api/host-status",
	BackendPath:  "/api/resources/host-status",
	Host:         "monitor.marathon.l4lb.thisdcos.directory:7096",
	Scheme:       "http",
	Method:       "POST",
	CheckLogin:   true,
	RequestType:  apistructs.HostStatusListRequest{},
	ResponseType: apistructs.HostStatusListResponse{},
	Doc:          "集群主机状态",
}

TODO 临时添加,3.8 版本机器详情新增状态字段,监控负责维护,不再走告警工单查询

View Source
var CMDB_HOST_USAGE = apis.ApiSpec{
	Path:         "/api/host-usages/<host>",
	BackendPath:  "/api/host-usages/<host>",
	Host:         "cmdb.marathon.l4lb.thisdcos.directory:9093",
	Scheme:       "http",
	Method:       "GET",
	CheckLogin:   true,
	RequestType:  apistructs.HostStaticUsageFetchRequest{},
	ResponseType: apistructs.HostStaticUsageFetchResponse{},
	Doc:          "主机的资源使用详情",
}
View Source
var CMDB_INSTANCES_USAGE = apis.ApiSpec{
	Path:        "/api/instances-usage",
	BackendPath: "/api/instances-usage",
	Host:        "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:      "http",
	Method:      "GET",
	CheckLogin:  true,
	Doc: `
summary: 获取某类实例集合的资源使用情况
parameters:
  - in: path
    name: cluster
    type: string
    required: true
    description: 集群名或者ID
  - in: query
    name: type
    type: string
    required: true
    enum: [cluster, host, project, application, runtime, service, component, addon]
    description: 指定请求实例的类型
    example: project
  - in: query
    name: host
    type: string
    description: type 等于 host时,若输入 host,则获取指定 host 信息;如果没有输入,则获取整个集群所有的 hosts 信息
  - in: query
    name: project
    type: string
    description: type 等于 project时,若输入 project,则获取指定 project 实例信息;如果没有输入,则获取整个集群所有的 projects 实例信息
  - in: query
    name: application
    type: string
    description: type 等于 application时,若输入 application,则获取指定 application 实例信息;如果没有输入,则获取整个集群所有的 applications 实例信息
  - in: query
    name: runtime
    type: string
    description: type 等于 runtime时,若输入 runtime,则获取指定 runtime 实例信息;如果没有输入,则获取整个集群所有的 runtimes 实例信息
  - in: query
    name: service
    type: string
    description: type 等于 service时,输入 runtime 必要参数。若输入 service,则获取指定 service 实例信息;如果没有输入,则获取指定runtime下所有的 services 实例信息
  - in: query
    name: component
    type: string
    description: type 等于 component时。若输入 component,则获取指定 component 实例信息;如果没有输入,则获取指定集群所有的 component 实例信息
  - in: query
    name: addon
    type: string
    description: type 等于 addon时。若输入 addon,则获取指定 addon 实例信息;如果没有输入,则获取指定集群所有的 addon 实例信息
produces:
  - application/json

responses:
  '200':
    description: OK
    schema:
      type: string
      example: 参考 https://yuque.antfin-inc.com/terminus_paas_dev/paas/gosn9b#va3psl
components:
  schemas:
    ComponentUsage:
      type: object
      properties:
        name:
            type: string
            description: 组件名
        instance:
            type: integer
            description: 实例数
        memory:
            type: number
            format: double
            description: 分配的内存(MB)
        cpu:
            type: number
            format: double
            description: 分配的cpu数
        disk:
            type: number
            format: double
            description: 分配的磁盘空间(MB)
    AddonUsage:
      type: object
      properties:
        name:
            type: string
            description: 组件名
        instance:
            type: integer
            description: 实例数
        memory:
            type: number
            format: double
            description: 分配的内存(MB)
        cpu:
            type: number
            format: double
            description: 分配的cpu数
        disk:
            type: number
            format: double
            description: 分配的磁盘空间(MB)
    ProjectUsage:
      type: object
      properties:
        id:
            type: string
            description: 项目ID
        name:
            type: string
            description: 项目名
        instance:
            type: integer
            description: 实例数
        memory:
            type: number
            format: double
            description: 分配的内存(MB)
        cpu:
            type: number
            format: double
            description: 分配的cpu数
        disk:
            type: number
            format: double
            description: 分配的磁盘空间(MB)
    ApplicationUsage:
      type: object
      properties:
        id:
            type: string
            description: 应用ID
        name:
            type: string
            description: 应用名
        instance:
            type: integer
            description: 实例数
        memory:
            type: number
            format: double
            description: 分配的内存(MB)
        cpu:
            type: number
            format: double
            description: 分配的cpu数
        disk:
            type: number
            format: double
            description: 分配的磁盘空间(MB)
    RuntimeUsage:
      type: object
      properties:
        id:
            type: string
            description: runtime ID
        name:
            type: string
            description: runtime名
        application:
            type: string
            description: 应用名
        instance:
            type: integer
            description: 实例数
        memory:
            type: number
            format: double
            description: 分配的内存(MB)
        cpu:
            type: number
            format: double
            description: 分配的cpu数
        disk:
            type: number
            format: double
            description: 分配的磁盘空间(MB)
    ServiceUsage:
      type: object
      properties:
        name:
            type: string
            description: service名
        runtime:
            type: string
            description: runtime名
        instance:
            type: integer
            description: 实例数
        memory:
            type: number
            format: double
            description: 分配的内存(MB)
        cpu:
            type: number
            format: double
            description: 分配的cpu数
        disk:
            type: number
            format: double
            description: 分配的磁盘空间(MB)
`,
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL