monitor

package
v0.3.10-0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2022 License: Apache-2.0 Imports: 8 Imported by: 20

Documentation

Index

Constants

View Source
const (
	ALERT_RESOURCE_RECORD_SHIELD_KEY   = "send_state"
	ALERT_RESOURCE_RECORD_SHIELD_VALUE = "hide"
)
View Source
const (
	AlertNotificationUsedByMeterAlert     = "meter_alert"
	AlertNotificationUsedByNodeAlert      = "node_alert"
	AlertNotificationUsedByCommonAlert    = "common_alert"
	AlertNotificationUsedByMigrationAlert = "migration_alert"
)
View Source
const (
	SEND_STATE_OK     = "ok"
	SEND_STATE_SILENT = "silent"
	SEND_STATE_SHIELD = "shield"
)
View Source
const (
	ALERT_STATUS_READY       = "ready"
	ALERT_STATUS_DELETE      = "start_delete"
	ALERT_STATUS_DELETE_FAIL = "delete_fail"
	ALERT_STATUS_DELETING    = "deleting"
	ALERT_STATUS_DELETED     = "deleted"

	CommonAlertSystemAlertType  = "system"
	CommonAlertNomalAlertType   = "normal"
	CommonAlertServiceAlertType = "service"

	MonitorComponentType = "default-monitor"
	MonitorComponentPort = 30093
	SubscribAPI          = "subscriptions"
	MonitorDefaultRC     = "30day_only"
	MonitorSubName       = "commonalert"
	MonitorSubDataBase   = "telegraf"

	CommonAlertDefaultRecipient = "commonalert-default"

	//metirc fields 之间的运算
	CommonAlertFieldOpt_Division = "/"

	DEFAULT_SEND_NOTIFY_CHANNEL = "users"

	METRIC_QUERY_TYPE_NO_DATA     = "nodata_query"
	METRIC_QUERY_NO_DATA_THESHOLD = "nodata"

	CommonAlertLevelNormal    = "normal"
	CommonAlertLevelImportant = "important"
	CommonAlertLevelFatal     = "fatal"
)
View Source
const (
	MeterAlertTypeBalance     = "balance"
	MeterAlertTypeDailyResFee = "resFee"
	MeterAlertTypeMonthResFee = "monthFee"
)
View Source
const (
	METRIC_RES_TYPE_GUEST        = "guest"
	METRIC_RES_TYPE_HOST         = "host"
	METRIC_RES_TYPE_REDIS        = "redis"
	METRIC_RES_TYPE_OSS          = "oss"
	METRIC_RES_TYPE_RDS          = "rds"
	METRIC_RES_TYPE_CLOUDACCOUNT = "cloudaccount"
	METRIC_RES_TYPE_AGENT        = "agent"
	METRIC_RES_TYPE_TENANT       = "tenant"
	METRIC_RES_TYPE_DOMAIN       = "domain"
	METRIC_RES_TYPE_STORAGE      = "storage"
	METRIC_RES_TYPE_ELB          = "elb"
	METRIC_RES_TYPE_K8S          = "k8s"

	//ext is prefix!
	METRIC_RES_TYPE_JENKINS      = "ext_jenkins"
	METRIC_RES_TYPE_EXT_MYSQL    = "ext_mysql"
	METRIC_RES_TYPE_EXT_REDIS    = "ext_redis"
	METRIC_RES_TYPE_EXT_RABBITMQ = "ext_rabbitmq"

	METRIC_UNIT_PERCENT = "%"
	METRIC_UNIT_BPS     = "bps"
	METRIC_UNIT_MBPS    = "Mbps"
	METRIC_UNIT_BYTEPS  = "Bps"
	METRIC_UNIT_CPS     = "cps"
	METRIC_UNIT_COUNT   = "count"
	METRIC_UNIT_MS      = "ms"
	METRIC_UNIT_SEC     = "s"
	METRIC_UNIT_BYTE    = "byte"
	METRIC_UNIT_RMB     = "RMB"
	METRIC_UNIT_MB      = "Mb"

	METRIC_DATABASE_TELE  = "telegraf"
	METRIC_DATABASE_METER = "meter_db"
)
View Source
const (
	MigrationAlertMetricTypeCPUUsageActive = "cpu.usage_active"
	MigrationAlertMetricTypeMemAvailable   = "mem.available"
)
View Source
const (
	MONITOR_RESOURCE_ALERT_STATUS_INIT     = "init"
	MONITOR_RESOURCE_ALERT_STATUS_ATTACH   = "attach"
	MONITOR_RESOURCE_ALERT_STATUS_ALERTING = "alerting"
)
View Source
const (
	NodeAlertTypeGuest = "guest"
	NodeAlertTypeHost  = "host"
)
View Source
const (
	ConditionGreaterThan = "gt"
	ConditionLessThan    = "lt"
)
View Source
const (
	AlertNotificationTypeOneCloud      = "onecloud"
	AlertNotificationTypeDingding      = "dingding"
	AlertNotificationTypeFeishu        = "feishu"
	AlertNotificationTypeAutoScaling   = "autoscaling"
	AlertNotificationTypeAutoMigration = "automigration"
)
View Source
const (
	SUGGEST_ALERT_READY        = "ready"
	SUGGEST_ALERT_START_DELETE = "start_delete"
	SUGGEST_ALERT_DELETE_FAIL  = "delete_fail"
	SUGGEST_ALERT_DELETING     = "deleting"
)
View Source
const (
	EIP_UNUSED                 SuggestDriverType = "EIP_UNUSED"
	DISK_UNUSED                SuggestDriverType = "DISK_UNUSED"
	LB_UNUSED                  SuggestDriverType = "LB_UNUSED"
	SNAPSHOT_UNUSED            SuggestDriverType = "SNAPSHOT_UNUSED"
	INSTANCE_SNAPSHOT_UNUSED   SuggestDriverType = "INSTANCE_SNAPSHOT_UNUSED"
	SCALE_DOWN                 SuggestDriverType = "SCALE_DOWN"
	SCALE_UP                   SuggestDriverType = "SCALE_UP"
	SECGROUPRULEINSERVER_ALLIN SuggestDriverType = "SECGROUPRULEINSERVER_ALLIN"
	REDIS_UNREASONABLE         SuggestDriverType = "REDIS_UNREASONABLE"
	RDS_UNREASONABLE           SuggestDriverType = "RDS_UNREASONABLE"
	OSS_UNREASONABLE           SuggestDriverType = "OSS_UNREASONABLE"
	OSS_SEC_ACL                SuggestDriverType = "OSS_SEC_ACL"

	DELETE_DRIVER_ACTION               SuggestDriverAction = "DELETE"
	SCALE_DOWN_DRIVER_ACTION           SuggestDriverAction = "SCALE_DOWN"
	SECGROUPRULEINSERVER_DRIVER_ACTION SuggestDriverAction = "MODIFY_RULE"
	REDIS_UNREASONABLE_DRIVER_ACTION   SuggestDriverAction = "REASONABLE"
	OSS_SEC_ACL_DRIVER_ACTION          SuggestDriverAction = "MODIFY_ACL"
)
View Source
const (
	EIP_MONITOR_RES_TYPE                  = MonitorResourceType("eip")
	DISK_MONITOR_RES_TYPE                 = MonitorResourceType("disk")
	LB_MONITOR_RES_TYPE                   = MonitorResourceType("loadbalancer")
	SCALE_MONTITOR_RES_TYPE               = MonitorResourceType("server")
	SNAPSHOT_MONITOR_RES_TYPE             = MonitorResourceType("snapshot")
	INSTANCE_SNAPSHOT_MONITOR_RES_TYPE    = MonitorResourceType("instance_snapshot")
	SECGROUPRULEINSERVER_MONITOR_RES_TYPE = MonitorResourceType("server")
	REDIS_UNREASONABLE_MONITOR_RES_TYPE   = MonitorResourceType("redis")
	RDS_UNREASONABLE_MONITOR_RES_TYPE     = MonitorResourceType("rds")
	OSS_UNREASONABLE_MONITOR_RES_TYPE     = MonitorResourceType("oss")
	OSS_SEC_ACL_MONITOR_RES_TYPE          = MonitorResourceType("oss")
)
View Source
const (
	EIP_MONITOR_SUGGEST                  = MonitorSuggest("release unused EIP")
	DISK_MONITOR_SUGGEST                 = MonitorSuggest("release unused Disk")
	LB_MONITOR_SUGGEST                   = MonitorSuggest("release unused LB")
	SCALE_DOWN_MONITOR_SUGGEST           = MonitorSuggest("adjust machine configuration")
	SECGROUPRULEINSERVER_MONITOR_SUGGEST = MonitorSuggest("adjust secgroup rule")
	OSS_SEC_ACL_MONITOR_SUGGEST          = MonitorSuggest("adjust oss acl")
)
View Source
const (
	LB_UNUSED_NLISTENER = "no listener"
	LB_UNUSED_NBCGROUP  = "no backend servergroup"
	LB_UNUSED_NBC       = "no backend server"
)
View Source
const (
	SECGROUPRULEINSERVER_CIDR            = "0.0.0.0/0"
	SECGROUPRULEINSERVER_FILTER_PROTOCOL = "icmp"
)
View Source
const (
	METRIC_TAG   = "TAG"
	METRIC_FIELD = "FIELD"

	METRIC_VM_ID    = "vm_id"
	METRIC_OSS_ID   = "oss_id"
	METRIC_RDS_ID   = "rds_id"
	METRIC_REDIS_ID = "redis_id"
)
View Source
const (
	DataSourceTypeInfluxdb = "influxdb"
)
View Source
const EXT_PREFIX = "ext"
View Source
const (
	MigrationAlertResourceTypeHost = "host"
)

Variables

View Source
var (
	ErrCannotChangeStateOnPausedAlert = errors.Error("Cannot change state on pause alert")
	ErrRequiresNewState               = errors.Error("update alert state requires a new state")
)
View Source
var (
	UnionTags = []string{
		"host",
		"host_id",
		"id",
		"ips",
		"name",
		"zone",
		"zone_id",
		"zone_ext_id",
		"os_type",
		"status",
		"cloudregion",
		"cloudregion_id",
		"region_ext_id",
		"tenant",
		"tenant_id",
		"brand",
		"vm_scaling_group_id",
		"domain_id",
		"project_domain",
	}

	ServerTags = map[string]string{
		"host":             "host",
		"host_id":          "host_id",
		"vm_id":            "id",
		"vm_ip":            "ips",
		"vm_name":          "name",
		"zone":             "zone",
		"zone_id":          "zone_id",
		"zone_ext_id":      "zone_ext_id",
		"os_type":          "os_type",
		"status":           "status",
		"cloudregion":      "cloudregion",
		"cloudregion_id":   "cloudregion_id",
		"region_ext_id":    "region_ext_id",
		"tenant":           "tenant",
		"tenant_id":        "tenant_id",
		"brand":            "brand",
		"scaling_group_id": "vm_scaling_group_id",
		"domain_id":        "domain_id",
		"project_domain":   "project_domain",
		"account":          "account",
		"account_id":       "account_id",
	}

	HostTags = map[string]string{
		"host_id":        "id",
		"host_ip":        "ips",
		"host":           "name",
		"zone":           "zone",
		"zone_id":        "zone_id",
		"zone_ext_id":    "zone_ext_id",
		"os_type":        "os_type",
		"status":         "status",
		"cloudregion":    "cloudregion",
		"cloudregion_id": "cloudregion_id",
		"region_ext_id":  "region_ext_id",
		"tenant":         "tenant",
		"tenant_id":      "tenant_id",
		"brand":          "brand",
		"domain_id":      "domain_id",
		"project_domain": "project_domain",
		"access_ip":      "access_ip",
		"account":        "account",
		"account_id":     "account_id",
	}

	RdsTags = map[string]string{
		"host":           "host",
		"host_id":        "host_id",
		"rds_id":         "id",
		"rds_ip":         "ips",
		"rds_name":       "name",
		"zone":           "zone",
		"zone_id":        "zone_id",
		"zone_ext_id":    "zone_ext_id",
		"os_type":        "os_type",
		"status":         "status",
		"cloudregion":    "cloudregion",
		"cloudregion_id": "cloudregion_id",
		"region_ext_id":  "region_ext_id",
		"tenant":         "tenant",
		"tenant_id":      "tenant_id",
		"brand":          "brand",
		"domain_id":      "domain_id",
		"project_domain": "project_domain",
	}

	RedisTags = map[string]string{
		"host":           "host",
		"host_id":        "host_id",
		"redis_id":       "id",
		"redis_ip":       "ips",
		"redis_name":     "name",
		"zone":           "zone",
		"zone_id":        "zone_id",
		"zone_ext_id":    "zone_ext_id",
		"os_type":        "os_type",
		"status":         "status",
		"cloudregion":    "cloudregion",
		"cloudregion_id": "cloudregion_id",
		"region_ext_id":  "region_ext_id",
		"tenant":         "tenant",
		"tenant_id":      "tenant_id",
		"brand":          "brand",
		"domain_id":      "domain_id",
		"project_domain": "project_domain",
	}

	OssTags = map[string]string{
		"host":           "host",
		"host_id":        "host_id",
		"oss_id":         "id",
		"oss_ip":         "ips",
		"oss_name":       "name",
		"zone":           "zone",
		"zone_id":        "zone_id",
		"zone_ext_id":    "zone_ext_id",
		"os_type":        "os_type",
		"status":         "status",
		"cloudregion":    "cloudregion",
		"cloudregion_id": "cloudregion_id",
		"region_ext_id":  "region_ext_id",
		"tenant":         "tenant",
		"tenant_id":      "tenant_id",
		"brand":          "brand",
		"domain_id":      "domain_id",
		"project_domain": "project_domain",
	}

	ElbTags = map[string]string{
		"host":           "host",
		"host_id":        "host_id",
		"elb_id":         "id",
		"elb_ip":         "ips",
		"elb_name":       "name",
		"zone":           "zone",
		"zone_id":        "zone_id",
		"zone_ext_id":    "zone_ext_id",
		"os_type":        "os_type",
		"status":         "status",
		"region":         "region",
		"cloudregion":    "cloudregion",
		"cloudregion_id": "cloudregion_id",
		"tenant":         "tenant",
		"tenant_id":      "tenant_id",
		"brand":          "brand",
		"domain_id":      "domain_id",
		"project_domain": "project_domain",
	}

	CloudAccountTags = map[string]string{
		"cloudaccount_id":   "id",
		"cloudaccount_name": "name",
		"brand":             "brand",
		"domain_id":         "domain_id",
		"project_domain":    "project_domain",
	}

	TenantTags = map[string]string{
		"tenant_id":      "id",
		"tenant":         "name",
		"domain_id":      "domain_id",
		"project_domain": "project_domain",
	}
	DomainTags = map[string]string{
		"domain_id":      "id",
		"project_domain": "name",
	}

	StorageTags = map[string]string{
		"storage_id":     "id",
		"storage_name":   "name",
		"zone":           "zone",
		"zone_id":        "zone_id",
		"zone_ext_id":    "zone_ext_id",
		"status":         "status",
		"cloudregion":    "cloudregion",
		"cloudregion_id": "cloudregion_id",
		"region_ext_id":  "region_ext_id",
		"brand":          "brand",
		"domain_id":      "domain_id",
		"project_domain": "project_domain",
	}
)
View Source
var (
	AlertNotificationStatePending   = AlertNotificationStateType("pending")
	AlertNotificationStateCompleted = AlertNotificationStateType("completed")
	AlertNotificationStateUnknown   = AlertNotificationStateType("unknown")
)
View Source
var (
	UNIFIED_MONITOR_FIELD_OPT_TYPE   = []string{"Aggregations", "Selectors"}
	UNIFIED_MONITOR_GROUPBY_OPT_TYPE = []string{"time", "tag", "fill"}
	UNIFIED_MONITOR_FIELD_OPT_VALUE  = map[string][]string{
		"Aggregations": {"COUNT", "DISTINCT", "INTEGRAL",
			"MEAN", "MEDIAN", "MODE", "STDDEV", "SUM"},
		"Selectors": {"BOTTOM", "FIRST", "LAST", "MAX", "MIN", "TOP"},
	}
	UNIFIED_MONITOR_GROUPBY_OPT_VALUE = map[string][]string{
		"fill": {"linear", "none", "previous", "0"},
	}

	MEASUREMENT_TAG_KEYWORD = map[string]string{
		METRIC_RES_TYPE_HOST:         "host",
		METRIC_RES_TYPE_GUEST:        "vm_name",
		METRIC_RES_TYPE_REDIS:        "redis_name",
		METRIC_RES_TYPE_RDS:          "rds_name",
		METRIC_RES_TYPE_OSS:          "oss_name",
		METRIC_RES_TYPE_CLOUDACCOUNT: "cloudaccount_name",
		METRIC_RES_TYPE_STORAGE:      "storage_name",
		METRIC_RES_TYPE_AGENT:        "vm_name",
	}
	MEASUREMENT_TAG_ID = map[string]string{
		METRIC_RES_TYPE_HOST:         "host_id",
		METRIC_RES_TYPE_GUEST:        "vm_id",
		METRIC_RES_TYPE_AGENT:        "vm_id",
		METRIC_RES_TYPE_REDIS:        "redis_id",
		METRIC_RES_TYPE_RDS:          "rds_id",
		METRIC_RES_TYPE_OSS:          "oss_id",
		METRIC_RES_TYPE_CLOUDACCOUNT: "cloudaccount_id",
		METRIC_RES_TYPE_TENANT:       "tenant_id",
		METRIC_RES_TYPE_DOMAIN:       "domain_id",
		METRIC_RES_TYPE_STORAGE:      "storage_id",
	}
	AlertReduceFunc = map[string]string{
		"avg":          "average value",
		"sum":          "Summation",
		"min":          "minimum value",
		"max":          "Maximum",
		"count":        "count value",
		"last":         "Latest value",
		"median":       "median",
		"diff":         "The difference between the latest value and the oldest value. The judgment basis value must be legal",
		"percent_diff": "The difference between the new value and the old value,based on the percentage of the old value",
	}
)
View Source
var FilterSuggestRuleMeasureMentMap = map[SuggestDriverType]string{
	SCALE_DOWN:         "vm",
	REDIS_UNREASONABLE: "dcs",
	RDS_UNREASONABLE:   "rds",
	OSS_UNREASONABLE:   "oss",
}
View Source
var METRIC_ATTRI = []string{METRIC_TAG, METRIC_FIELD}
View Source
var PROPERTY_TYPE = []string{"databases", "measurements", "metric-measurement"}

Functions

func IsValidMigrationAlertMetricType

func IsValidMigrationAlertMetricType(t MigrationAlertMetricType) error

Types

type AlertCloneDashboardInput

type AlertCloneDashboardInput struct {
	CloneName string `json:"clone_name"`
}

type AlertClonePanelInput

type AlertClonePanelInput struct {
	PanelId        string `json:"panel_id"`
	ClonePanelName string `json:"clone_panel_name"`
}

type AlertCondition

type AlertCondition struct {
	Type      string     `json:"type"`
	Query     AlertQuery `json:"query"`
	Reducer   Condition  `json:"reducer"`
	Evaluator Condition  `json:"evaluator"`
	Operator  string     `json:"operator"`
}

type AlertConditionCombiner

type AlertConditionCombiner string

type AlertCreateInput

type AlertCreateInput struct {
	apis.Meta

	// 报警名称
	Name string `json:"name"`
	// 报警执行频率
	Frequency int64 `json:"frequency"`
	// 报警持续时间
	For int64 `json:"for"`
	// 报警设置
	Settings AlertSetting `json:"settings"`
	// 启用报警
	Enabled *bool `json:"enabled"`
	// 报警级别
	Level string `json:"level"`
	// 没有收到监控指标时将当前报警状态设置为对应的状态
	NoDataState string `json:"no_data_state"`
	// 报警执行错误将当前报警状态设置为对应的状态
	ExecutionErrorState string `json:"execution_error_state"`
	UsedBy              string `json:"used_by"`
	// customize info
	CustomizeConfig jsonutils.JSONObject `json:"customize_config"`
}

type AlertDashBoardCreateInput

type AlertDashBoardCreateInput struct {
	apis.Meta
	apis.ScopedResourceCreateInput
	apis.StandaloneResourceCreateInput

	Refresh string `json:"refresh"`
}

type AlertDashBoardDetails

type AlertDashBoardDetails struct {
	AlertDetails
	AlertPanelDetails []AlertPanelDetail `json:"alert_panel_details"`
}

type AlertDashBoardListInput

type AlertDashBoardListInput struct {
	AlertListInput
}

type AlertJointCreateInput

type AlertJointCreateInput struct {
	apis.Meta

	AlertId string `json:"alert_id"`
}

type AlertJointResourceBaseDetails

type AlertJointResourceBaseDetails struct {
	apis.JointResourceBaseDetails
	SAlertJointsBase
	Alert string `json:"alert"`
}

type AlertNotificationStateType

type AlertNotificationStateType string

type AlertPanelCreateInput

type AlertPanelCreateInput struct {
	apis.ScopedResourceInput
	apis.ProjectizedResourceListInput

	CommonMetricInputQuery
	AlertCreateInput

	Refresh     string `json:"refresh"`
	DashboardId string `json:"dashboard_id"`
}

type AlertPanelDetail

type AlertPanelDetail struct {
	PanelName string `json:"panel_name"`
	PanelId   string `json:"panel_id"`
	Refresh   string `json:"refresh"`
	Setting   jsonutils.JSONObject
	PanelDetails
}

type AlertPanelListInput

type AlertPanelListInput struct {
	AlertListInput
	DashboardId string `json:"dashboard_id"`
}

type AlertPanelUpdateInput

type AlertPanelUpdateInput struct {
	apis.ScopedResourceBaseInfo
	CommonMetricInputQuery
	V1AlertUpdateInput

	Refresh string `json:"refresh"`
}

type AlertPauseInput

type AlertPauseInput struct {
	apis.Meta

	Paused bool `json:"paused"`
}

type AlertQuery

type AlertQuery struct {
	Model        MetricQuery `json:"model"`
	DataSourceId string      `json:"data_source_id"`
	From         string      `json:"from"`
	To           string      `json:"to"`
}

type AlertRecordCreateInput

type AlertRecordCreateInput struct {
	apis.StandaloneResourceCreateInput

	AlertId string `json:"alert_id"`
	// 报警级别
	Level     string       `json:"level"`
	State     string       `json:"state"`
	SendState string       `json:"send_state"`
	ResType   string       `json:"res_type"`
	EvalData  []*EvalMatch `json:"eval_data"`
	AlertRule AlertRecordRule
}

type AlertRecordDetails

type AlertRecordDetails struct {
	SAlertRecord

	apis.StatusStandaloneResourceDetails
	apis.ScopedResourceBaseInfo

	ResNum      int64  `json:"res_num"`
	AlertName   string `json:"alert_name"`
	TriggerTime time.Time
}

func (AlertRecordDetails) GetMetricTags

func (self AlertRecordDetails) GetMetricTags() map[string]string

type AlertRecordListInput

type AlertRecordListInput struct {
	apis.Meta

	apis.ScopedResourceBaseListInput
	apis.EnabledResourceBaseListInput
	apis.StatusStandaloneResourceListInput

	AlertId  string `json:"alert_id"`
	Level    string `json:"level"`
	State    string `json:"state"`
	ResType  string `json:"res_type"`
	Alerting bool   `json:"alerting"`
	ResName  string `json:"res_name"`
}

type AlertRecordRule

type AlertRecordRule struct {
	Metric          string `json:"metric"`
	Database        string `json:"database"`
	Measurement     string `json:"measurement"`
	MeasurementDesc string `json:"measurement_desc"`
	ResType         string `json:"res_type"`
	Field           string `json:"field"`
	FieldDesc       string `json:"field_desc"`
	// 比较运算符, 比如: >, <, >=, <=
	Comparator string `json:"comparator"`
	// 报警阀值
	Threshold     string `json:"threshold"`
	Period        string `json:"period"`
	AlertDuration int64  `json:"alert_duration"`
	ConditionType string `json:"condition_type"`
	// 静默期
	SilentPeriod string `json:"silent_period"`
}

type AlertRecordShieldCreateInput

type AlertRecordShieldCreateInput struct {
	apis.StandaloneResourceCreateInput

	AlertId string `json:"alert_id"`
	ResType string `json:"res_type"`
	ResName string `json:"res_name"`
	ResId   string `json:"res_id"`

	StartTime string `json:"start_time"`
	EndTime   string `json:"end_time"`
}

type AlertRecordShieldDetails

type AlertRecordShieldDetails struct {
	apis.StatusStandaloneResourceDetails
	apis.ScopedResourceBaseInfo

	CommonAlertDetails
	AlertName string `json:"alert_name"`
	ResName   string `json:"res_name"`
	Expired   bool   `json:"expired"`
}

type AlertRecordShieldListInput

type AlertRecordShieldListInput struct {
	apis.Meta

	apis.ScopedResourceBaseListInput
	apis.EnabledResourceBaseListInput
	apis.StatusStandaloneResourceListInput

	AlertName string     `json:"alert_name"`
	ResType   string     `json:"res_type"`
	ResName   string     `json:"res_name"`
	ResId     string     `json:"res_id"`
	AlertId   string     `json:"alert_id"`
	StartTime *time.Time `json:"start_time"`
	EndTime   *time.Time `json:"end_time"`
}

type AlertResourceAlertDetails

type AlertResourceAlertDetails struct {
	AlertResourceJointBaseDetails
	Alert                    string                      `json:"alert"`
	AlertType                string                      `json:"alert_type"`
	Level                    string                      `json:"level"`
	CommonAlertMetricDetails []*CommonAlertMetricDetails `json:"common_alert_metric_details"`
}

type AlertResourceAlertListInput

type AlertResourceAlertListInput struct {
	apis.JointResourceBaseListInput
	AlertResourceId string `json:"alert_resource_id"`
	AlertId         string `json:"alert_id"`
}

type AlertResourceAttachInput

type AlertResourceAttachInput struct {
	apis.Meta

	AlertResourceId string    `json:"alert_resource_id"`
	AlertId         string    `json:"alert_id"`
	AlertRecordId   string    `json:"alert_record_id"`
	Data            EvalMatch `json:"data"`
}

type AlertResourceCreateInput

type AlertResourceCreateInput struct {
	apis.StandaloneResourceCreateInput

	Type AlertResourceType `json:"type"`
}

type AlertResourceDetails

type AlertResourceDetails struct {
	apis.StandaloneResourceDetails
	Count int               `json:"count"`
	Tags  map[string]string `json:"tags"`
}

type AlertResourceJointBaseDetails

type AlertResourceJointBaseDetails struct {
	apis.JointResourceBaseDetails

	AlertResource string            `json:"alert_resource"`
	Type          AlertResourceType `json:"type"`
}

type AlertResourceListInput

type AlertResourceListInput struct {
	apis.StandaloneResourceListInput
	Type string `json:"type"`
}

type AlertResourceRecordCreateInput

type AlertResourceRecordCreateInput struct {
	apis.Meta
	apis.SStandaloneResourceBase

	EvalData      EvalMatch
	AlertTime     time.Time
	ResName       string
	ResType       string
	Brand         string
	TriggerVal    string
	AlertRecordId string
	AlertId       string
	SendState     string
}

type AlertResourceRecordDetails

type AlertResourceRecordDetails struct {
	apis.StatusStandaloneResourceDetails
	apis.ScopedResourceBaseInfo

	AlertName string `json:"alert_name"`
	AlertRule jsonutils.JSONObject
	ResType   string
	Level     string
	State     string
}

type AlertResourceType

type AlertResourceType string
const (
	// AlertResourceTypeNode means onecloud system infrastructure controller or host node
	AlertResourceTypeNode AlertResourceType = "host"
	// AlertResourceTypeCloudaccount means cloudaccount resource
	AlertResourceTypeCloudaccount AlertResourceType = "cloudaccount"
)

type AlertSetting

type AlertSetting struct {
	Conditions []AlertCondition `json:"conditions"`
}

AlertSettings contains alert conditions

type AlertSeverityType

type AlertSeverityType string

type AlertStateType

type AlertStateType string
const (
	AlertStateNoData   AlertStateType = "no_data"
	AlertStatePaused   AlertStateType = "paused"
	AlertStateAlerting AlertStateType = "alerting"
	AlertStateOK       AlertStateType = "ok"
	AlertStatePending  AlertStateType = "pending"
	AlertStateUnknown  AlertStateType = "unknown"
)

func (AlertStateType) IsValid

func (s AlertStateType) IsValid() bool

type AlertTestRunInput

type AlertTestRunInput struct {
	apis.Meta

	IsDebug bool `json:"is_debug"`
}

type AlertTestRunOutput

type AlertTestRunOutput struct {
	apis.Meta

	Firing         bool              `json:"firing"`
	EvalMatches    []*EvalMatch      `json:"eval_matches"`
	Logs           []*ResultLogEntry `json:"logs"`
	Error          error             `json:"error"`
	ConditionEvals string            `json:"condition_evals"`
	StartTime      time.Time         `json:"start_time"`
	EndTime        time.Time         `json:"end_time"`
}

type AlertUpdateInput

type AlertUpdateInput struct {
	apis.StandaloneResourceBaseUpdateInput

	Message *string `json:"message"`

	// 报警执行频率
	Frequency *int64 `json:"frequency"`
	// 报警持续时间
	For int64 `json:"for"`
	// 报警设置
	Settings *AlertSetting `json:"settings"`
	// 启用报警
	Enabled *bool `json:"enabled"`
	// 报警级别
	Level *string `json:"level"`
	// 没有收到监控指标时将当前报警状态设置为对应的状态
	NoDataState string `json:"no_data_state"`
	// 报警执行错误将当前报警状态设置为对应的状态
	ExecutionErrorState string `json:"execution_error_state"`
}

type AlertV1Details

type AlertV1Details struct {
	AlertDetails

	Name        string  `json:"name"`
	Period      string  `json:"period"`
	Window      string  `json:"window"`
	Comparator  string  `json:"comparator"`
	Threshold   float64 `json:"threshold"`
	Recipients  string  `json:"recipients"`
	Level       string  `json:"level"`
	Channel     string  `json:"channel"`
	DB          string  `json:"db"`
	Measurement string  `json:"measurement"`
	Field       string  `json:"field"`
	NotifierId  string  `json:"notifier_id"`
	Status      string  `json:"status"`
}

type AlertnotificationCreateInput

type AlertnotificationCreateInput struct {
	AlertJointCreateInput

	NotificationId string               `json:"notification_id"`
	UsedBy         string               `json:"used_by"`
	Params         jsonutils.JSONObject `json:"params"`
}

type AlertnotificationDetails

type AlertnotificationDetails struct {
	AlertJointResourceBaseDetails
	Notification string `json:"notification"`
}

type CommonAlertCreateBaseInput

type CommonAlertCreateBaseInput struct {
	// 报警连续持续周期数
	AlertDuration int64 `json:"alert_duration"`
	// 通知方式, 比如: email, mobile
	Channel []string `json:"channel"`
	// 通知接受者
	Recipients []string `json:"recipients"`

	RobotIds []string `json:"robot_ids"`

	// 角色 id 或者 name
	Roles []string `json:"roles"`

	// 静默期
	SilentPeriod string `json:"silent_period"`
	// 报警类型
	AlertType string `json:"alert_type"`

	// Scope Resource
	Scope       string `json:"scope"`
	DomainId    string `json:"domain_id"`
	ProjectId   string `json:"project_id"`
	GetPointStr bool   `json:"get_point_str"`
	MetaName    string `json:"meta_name"`
	Description string `json:"description"`
}

type CommonAlertCreateInput

type CommonAlertCreateInput struct {
	CommonMetricInputQuery
	AlertCreateInput
	CommonAlertCreateBaseInput

	// 查询指标周期
	Period string `json:"period"`
}

type CommonAlertDetails

type CommonAlertDetails struct {
	AlertDetails
	Period string `json:"period"`
	// 报警连续持续周期数
	AlertDuration int64    `json:"alert_duration"`
	Level         string   `json:"level"`
	NotifierId    string   `json:"notifier_id"`
	Channel       []string `json:"channel"`
	Recipients    []string `json:"recipients"`
	RobotIds      []string `json:"robot_ids"`
	RoleIds       []string `json:"role_ids"`
	// 静默期
	SilentPeriod string `json:"silent_period"`
	Status       string `json:"status"`
	// 报警类型
	AlertType                string                      `json:"alert_type"`
	CommonAlertMetricDetails []*CommonAlertMetricDetails `json:"common_alert_metric_details"`
}

type CommonAlertListInput

type CommonAlertListInput struct {
	AlertListInput
	//V1AlertListInput
	// 报警类型
	AlertType string `json:"alert_type"`
	// 监控指标名称
	Metric string `json:"metric"`

	Level   string   `json:"level"`
	ResType []string `json:"res_type"`
	UsedBy  string   `json:"used_by"`
	Name    string   `json:"name"`
}

type CommonAlertMetricDetails

type CommonAlertMetricDetails struct {
	Comparator    string    `json:"comparator"`
	Threshold     float64   `json:"threshold"`
	WithinRange   []float64 `json:"within_range"`
	ConditionType string    `json:"condition_type"`
	ThresholdStr  string    `json:"threshold_str"`
	// metric points'value的运算方式
	Reduce                 string           `json:"reduce"`
	DB                     string           `json:"db"`
	Measurement            string           `json:"measurement"`
	MeasurementDisplayName string           `json:"measurement_display_name"`
	ResType                string           `json:"res_type"`
	Field                  string           `json:"field"`
	Groupby                string           `json:"groupby"`
	Filters                []MetricQueryTag `json:"filters"`
	FieldDescription       MetricFieldDetail
	FieldOpt               string `json:"field_opt"`
	GetPointStr            bool   `json:"get_point_str"`
}

type CommonAlertQuery

type CommonAlertQuery struct {
	*AlertQuery
	// metric points'value的运算方式
	Reduce string `json:"reduce"`
	// 比较运算符, 比如: >, <, >=, <=
	Comparator string `json:"comparator"`
	// 报警阀值
	Threshold float64 `json:"threshold"`
	//field yunsuan
	FieldOpt      string `json:"field_opt"`
	ConditionType string `json:"condition_type"`
}

type CommonAlertUpdateInput

type CommonAlertUpdateInput struct {
	CommonMetricInputQuery
	V1AlertUpdateInput

	// 查询指标周期
	Period string `json:"period"`
	// 报警连续持续周期数
	AlertDuration int64 `json:"alert_duration"`
	// 通知方式, 比如: email, mobile
	Channel []string `json:"channel"`
	// 通知接受者
	Recipients []string `json:"recipients"`
	// 静默期
	SilentPeriod string `json:"silent_period"`
	// systemalert policy may need update through operator
	ForceUpdate bool   `json:"force_update"`
	GetPointStr bool   `json:"get_point_str"`
	MetaName    string `json:"meta_name"`
}

type CommonMetricInputQuery

type CommonMetricInputQuery struct {
	From        string              `json:"from"`
	To          string              `json:"to"`
	Interval    string              `json:"interval"`
	MetricQuery []*CommonAlertQuery `json:"metric_query"`
}

type Condition

type Condition struct {
	Type      string    `json:"type"`
	Params    []float64 `json:"params"`
	Operators []string  `json:"operators"`
}

func GetNodeAlertEvaluator

func GetNodeAlertEvaluator(comparator string, threshold float64) Condition

type DataSourceConfig

type DataSourceConfig struct {
	Id     string
	Name   string
	Driver string
	Config interface{}
}

type DiskUnused

type DiskUnused struct {
}

type EIPUnused

type EIPUnused struct {
}

type EvalMatch

type EvalMatch struct {
	Condition string            `json:"condition"`
	Value     *float64          `json:"value"`
	ValueStr  string            `json:"value_str"`
	Metric    string            `json:"metric"`
	Tags      map[string]string `json:"tags"`
	Unit      string            `json:"unit"`
}

EvalMatch represents the series violating the threshold.

type ExecutionErrorOption

type ExecutionErrorOption string
const (
	ExecutionErrorSetAlerting ExecutionErrorOption = "alerting"
	ExecutionErrorKeepState   ExecutionErrorOption = "keep_state"
)

func (ExecutionErrorOption) IsValid

func (s ExecutionErrorOption) IsValid() bool

func (ExecutionErrorOption) ToAlertState

func (s ExecutionErrorOption) ToAlertState() AlertStateType

type IMigrationAlertMetric

type IMigrationAlertMetric interface {
	GetType() MigrationAlertMetricType
	GetQueryFields() *MetricQueryFields
}

type InfluxMeasurement

type InfluxMeasurement struct {
	apis.Meta
	Database               string
	Measurement            string
	MeasurementDisplayName string
	ResType                string
	Score                  int
	TagKey                 []string
	TagValue               map[string][]string
	FieldKey               []string
	FieldDescriptions      map[string]MetricFieldDetail
	Unit                   []string
}

type LBUnused

type LBUnused struct {
}

type MeterAlertCreateInput

type MeterAlertCreateInput struct {
	ResourceAlertV1CreateInput

	// 监控资源类型, 比如: balance, resFree, monthFee
	Type string `json:"type"`
	// 云平台类型
	Provider string `json:"provider"`
	// 云账号 Id
	AccountId string `json:"account_id"`
	// 项目 Id string
	ProjectId string `json:"project_id"`
}

type MeterAlertDetails

type MeterAlertDetails struct {
	AlertV1Details

	Type      string `json:"type"`
	ProjectId string `json:"project_id"`
	AccountId string `json:"account_id"`
	Provider  string `json:"provider"`
}

type MeterAlertListInput

type MeterAlertListInput struct {
	V1AlertListInput

	// 监控资源类型, 比如: balance, resFree, monthFee
	Type string `json:"type"`
	// 云平台类型
	Provider string `json:"provider"`
	// 云账号 Id
	AccountId string `json:"account_id"`
	// 项目 Id
	ProjectId string `json:"project_id"`
}

type MeterAlertUpdateInput

type MeterAlertUpdateInput struct {
	V1AlertUpdateInput

	// 比较运算符, 比如: >, <, >=, <=
	Comparator *string `json:"comparator"`
	// 报警阀值
	Threshold *float64 `json:"threshold"`
	// 通知接受者
	Recipients *string `json:"recipients"`
	// 项目 Id
	ProjectId *string `json:"project_id"`
	// 通知方式, 比如: email, mobile
	Channel *string `json:"channel"`
	Status  *string `json:"status"`
}

type MeterCustomizeConfig

type MeterCustomizeConfig struct {
	UnitDesc string
	Name     string
	Currency string
}

type Metric

type Metric struct {
	Resource    MetricResource `json:"resource"`
	Measurement string         `json:"measurement"`
	Field       string         `json:"field"`
	DisplayName string         `json:"displayname"`
}

type MetricCreateInput

type MetricCreateInput struct {
	Measurement  MetricMeasurementCreateInput `json:"measurement"`
	MetricFields []MetricFieldCreateInput     `json:"metric_fields"`
	Scope        string                       `json:"scope"`
}

type MetricDetails

type MetricDetails struct {
	apis.StatusStandaloneResourceDetails
	apis.ScopedResourceBaseInfo

	MetricFields []MetricFieldDetail `json:"metric_fields"`
}

type MetricFieldCreateInput

type MetricFieldCreateInput struct {
	apis.StandaloneResourceCreateInput

	DisplayName string `json:"display_name"`
	Unit        string `json:"unit"`
	ValueType   string `json:"value_type"`
	Score       int    `json:"score"`
}

type MetricFieldDetail

type MetricFieldDetail struct {
	Name        string `json:"name"`
	DisplayName string `json:"display_name"`
	Unit        string `json:"unit"`
	Id          string `json:"id"`
}

type MetricFieldListInput

type MetricFieldListInput struct {
	apis.StatusStandaloneResourceListInput
	apis.EnabledResourceBaseListInput
	apis.ScopedResourceBaseListInput

	DisplayName string `json:"display_name"`
	Unit        string `json:"unit"`
	Scope       string `json:"scope"`
}

type MetricFieldUpdateInput

type MetricFieldUpdateInput struct {
	apis.StandaloneResourceBaseUpdateInput

	Id          string
	DisplayName string `json:"display_name"`
	Unit        string `json:"unit"`
	ValueType   string `json:"value_type"`
	Score       int    `json:"score"`
}

type MetricFunc

type MetricFunc struct {
	FieldOptType  []string            `json:"field_opt_type"`
	FieldOptValue map[string][]string `json:"field_opt_value"`
	GroupOptType  []string            `json:"group_opt_type"`
	GroupOptValue map[string][]string `json:"group_opt_value"`
}

type MetricInputQuery

type MetricInputQuery struct {
	From    string `json:"from"`
	To      string `json:"to"`
	Scope   string `json:"scope"`
	Slimit  string `json:"slimit"`
	Soffset string `json:"soffset"`
	//default group by
	Unit        bool          `json:"unit"`
	Interval    string        `json:"interval"`
	DomainId    string        `json:"domain_id"`
	ProjectId   string        `json:"project_id"`
	MetricQuery []*AlertQuery `json:"metric_query"`
	Signature   string        `json:"signature"`
	ShowMeta    bool          `json:"show_meta"`
}

type MetricListInput

type MetricListInput struct {
	apis.Meta

	Measurement  MetricMeasurementListInput `json:"measurement"`
	MetricFields MetricFieldListInput       `json:"metric_fields"`
	Scope        string                     `json:"scope"`
}

type MetricMeasurementCreateInput

type MetricMeasurementCreateInput struct {
	apis.StandaloneResourceCreateInput
	apis.EnabledBaseResourceCreateInput

	ResType     string `json:"res_type"`
	DisplayName string `json:"display_name"`
	Database    string `json:"database"`
	Score       int    `json:"score"`
}

type MetricMeasurementListInput

type MetricMeasurementListInput struct {
	apis.StatusStandaloneResourceListInput
	apis.EnabledResourceBaseListInput
	apis.ScopedResourceBaseListInput

	ResType     string `json:"res_type"`
	DisplayName string `json:"display_name"`
}

type MetricMeasurementUpdateInput

type MetricMeasurementUpdateInput struct {
	apis.StandaloneResourceBaseUpdateInput

	ResType     string `json:"res_type"`
	DisplayName string `json:"display_name"`
}

type MetricQuery

type MetricQuery struct {
	Alias        string              `json:"alias"`
	Tz           string              `json:"tz"`
	Database     string              `json:"database"`
	Measurement  string              `json:"measurement"`
	Tags         []MetricQueryTag    `json:"tags"`
	GroupBy      []MetricQueryPart   `json:"group_by"`
	Selects      []MetricQuerySelect `json:"select"`
	Interval     string              `json:"interval"`
	Policy       string              `json:"policy"`
	ResultFormat string              `json:"result_format"`
}

func GetNodeAlertQuery

func GetNodeAlertQuery(typ, field, measurement, db, nodeId string) MetricQuery

type MetricQueryFields

type MetricQueryFields struct {
	ResourceType MigrationAlertResourceType
	Database     string
	Measurement  string
	Field        string
	Comparator   string
}

type MetricQueryPart

type MetricQueryPart struct {
	Type   string   `json:"type"`
	Params []string `json:"params"`
}

type MetricQuerySelect

type MetricQuerySelect []MetricQueryPart

func NewMetricQuerySelect

func NewMetricQuerySelect(parts ...MetricQueryPart) MetricQuerySelect

type MetricQueryTag

type MetricQueryTag struct {
	Key       string `json:"key"`
	Operator  string `json:"operator"`
	Value     string `json:"value"`
	Condition string `json:"condition"`
}

type MetricRequest

type MetricRequest struct {
	// The start time for the query
	From string `json:"from"`
	// An end time for the query
	To      string         `json:"to"`
	Queries []*MetricQuery `json:"queries"`
	Debug   bool           `json:"debug"`
}

type MetricResource

type MetricResource struct {
	// Type is the metric resource type. e.g: host, vm, lbinstance
	Type string `json:"type"`
	// ConfigId is the data source config id
	ConfigId string `json:"config_id"`
}

type MetricUpdateInput

type MetricUpdateInput struct {
	apis.Meta

	Measurement  MetricMeasurementUpdateInput `json:"measurement"`
	MetricFields []MetricFieldUpdateInput     `json:"metric_fields"`
	Scope        string                       `json:"scope"`
}

type MigrationAlertCreateInput

type MigrationAlertCreateInput struct {
	AlertCreateInput
	// Threshold is the value to trigger migration
	Threshold float64 `json:"threshold"`
	// Period of querying metrics
	Period string `json:"period"`
	// MetricType is supported metric type by auto migration
	MetricType MigrationAlertMetricType `json:"metric_type"`
	// MigrationAlertSettings contain migration configuration
	MigrationSettings *MigrationAlertSettings `json:"migration_settings"`
}

func (MigrationAlertCreateInput) GetEvaluator

func (MigrationAlertCreateInput) GetMetricDriver

func (MigrationAlertCreateInput) ToAlertCreateInput

func (m MigrationAlertCreateInput) ToAlertCreateInput() *AlertCreateInput

type MigrationAlertListInput

type MigrationAlertListInput struct {
	AlertListInput

	MetricType string `json:"metric_type"`
}

type MigrationAlertMetricType

type MigrationAlertMetricType string

type MigrationAlertResourceType

type MigrationAlertResourceType string

type MigrationAlertSettings

type MigrationAlertSettings struct {
	Source *MigrationAlertSettingsSource `json:"source"`
	Target *MigrationAlertSettingsTarget `json:"target"`
}

type MigrationAlertSettingsSource

type MigrationAlertSettingsSource struct {
	GuestIds []string `json:"guest_ids"`
	HostIds  []string `json:"host_ids"`
}

type MigrationAlertSettingsTarget

type MigrationAlertSettingsTarget struct {
	HostIds []string `json:"host_ids"`
}

type MigrationMetricDrivers

type MigrationMetricDrivers struct {
	*sync.Map
}

func GetMigrationAlertMetricDrivers

func GetMigrationAlertMetricDrivers() *MigrationMetricDrivers

func (*MigrationMetricDrivers) Get

type MonitorResourceCreateInput

type MonitorResourceCreateInput struct {
	apis.VirtualResourceCreateInput
	apis.EnabledBaseResourceCreateInput

	ResId       string `json:"res_id"`
	ResType     string `json:"res_type"`
	AlertStatus string `json:"alert_status"`
}

type MonitorResourceDetails

type MonitorResourceDetails struct {
	apis.VirtualResourceDetails
	compute.CloudregionResourceInfo
	compute.CloudaccountResourceInfo
	Ips      string `json:"ips"`
	AccessIp string `json:"access_ip"`

	AttachAlertCount int64  `json:"attach_alert_count"`
	Hypervisor       string `json:"hypervisor"`
}

type MonitorResourceJointCreateInput

type MonitorResourceJointCreateInput struct {
	apis.Meta
	MonitorResourceId string `json:"monitor_resource_id"`
	AlertId           string `json:"alert_id"`

	AlertRecordId string    `width:"36" charset:"ascii" list:"user"  update:"user"`
	AlertState    string    `width:"18" charset:"ascii" list:"user"  update:"user"`
	TriggerTime   time.Time `list:"user"  update:"user" json:"trigger_time"`
	Data          EvalMatch `json:"data"`
}

type MonitorResourceJointDetails

type MonitorResourceJointDetails struct {
	ResName     string               `json:"res_name"`
	ResId       string               `json:"res_id"`
	ResType     string               `json:"res_type"`
	AlertName   string               `json:"alert_name"`
	AlertRule   jsonutils.JSONObject `json:"alert_rule"`
	Level       string               `json:"level"`
	SendState   string               `json:"send_state"`
	State       string               `json:"state"`
	IsSetShield bool                 `json:"is_set_shield"`
}

type MonitorResourceJointListInput

type MonitorResourceJointListInput struct {
	apis.JointResourceBaseListInput
	apis.VirtualResourceListInput
	MonitorResourceId string  `json:"monitor_resource_id"`
	AlertId           string  `json:"alert_id"`
	JointId           []int64 `json:"joint_id"`
	Alerting          bool    `json:"alertinng"`
	SendState         string  `json:"send_state"`
	ResType           string  `json:"res_type"`
	ResName           string  `json:"res_name"`
	AlertName         string  `json:"alert_name"`
	Level             string  `json:"level"`
}

type MonitorResourceListInput

type MonitorResourceListInput struct {
	apis.VirtualResourceListInput
	apis.EnabledResourceBaseListInput
	compute.ManagedResourceListInput

	ResId     []string `json:"res_id"`
	ResType   string   `json:"res_type"`
	OnlyResId bool     `json:"only_res_id"`

	ResName string `json:"res_name"`
}

type MonitorResourceType

type MonitorResourceType string

type MonitorSuggest

type MonitorSuggest string

type NoDataOption

type NoDataOption string
const (
	NoDataSetOK       NoDataOption = "ok"
	NoDataSetNoData   NoDataOption = "no_data"
	NoDataKeepState   NoDataOption = "keep_state"
	NoDataSetAlerting NoDataOption = "alerting"
)

func (NoDataOption) IsValid

func (s NoDataOption) IsValid() bool

func (NoDataOption) ToAlertState

func (s NoDataOption) ToAlertState() AlertStateType

type NodeAlertCreateInput

type NodeAlertCreateInput struct {
	ResourceAlertV1CreateInput

	// 监控指标名称
	Metric string `json:"metric"`
	// 监控资源类型, 比如: guest, host
	Type string `json:"type"`
	// 监控资源名称
	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 (NodeAlertCreateInput) GetEvaluator

func (input NodeAlertCreateInput) GetEvaluator() Condition

func (NodeAlertCreateInput) GetQuery

func (input NodeAlertCreateInput) GetQuery(field, measurement, db string) MetricQuery

func (NodeAlertCreateInput) ToCommonAlertCreateInput

func (input NodeAlertCreateInput) ToCommonAlertCreateInput(
	name string,
	field string,
	measurement string,
	db string) CommonAlertCreateInput

type NodeAlertDetails

type NodeAlertDetails struct {
	AlertV1Details

	Type     string `json:"type"`
	Metric   string `json:"metric"`
	NodeId   string `json:"node_id"`
	NodeName string `json:"node_name"`
}

type NodeAlertListInput

type NodeAlertListInput struct {
	AlertListInput

	// 监控指标名称
	Metric string `json:"metric"`
	// 监控资源类型, 比如: guest, host
	Type string `json:"type"`
	// 监控资源名称
	NodeName string `json:"node_name"`
	// 监控资源 Id
	NodeId string `json:"node_id"`
}

func (NodeAlertListInput) ToCommonAlertListInput

func (o NodeAlertListInput) ToCommonAlertListInput() CommonAlertListInput

type NodeAlertUpdateInput

type NodeAlertUpdateInput struct {
	AlertUpdateInput

	// 监控指标名称
	Metric *string `json:"metric"`
	// 监控资源类型, 比如: guest, host
	Type *string `json:"type"`
	// 监控资源名称
	NodeName *string `json:"node_name"`
	// 监控资源 Id
	NodeId *string `json:"node_id"`
	// 查询指标周期
	Period *string `json:"period"`
	// 每隔多久查询一次
	Window *string `json:"window"`
	// 比较运算符, 比如: >, <, >=, <=
	Comparator *string `json:"comparator"`
	// 报警阀值
	Threshold *float64 `json:"threshold"`
	// 报警级别
	Level *string `json:"level"`
	// 通知方式, 比如: email, mobile
	Channel *string `json:"channel"`
	// 通知接受者
	Recipients *string `json:"recipients"`
}

type NotificationCreateInput

type NotificationCreateInput struct {
	apis.Meta

	// 报警通知名称
	Name string `json:"name"`
	// 类型
	Type string `json:"type"`
	// 是否为默认通知配置
	IsDefault bool `json:"is_default"`
	// 是否一直提醒
	SendReminder *bool `json:"send_reminder"`
	// 是否禁用报警恢复提醒
	DisableResolveMessage *bool `json:"disable_resolve_message"`
	// 发送频率 单位:s
	Frequency time.Duration `json:"frequency"`
	// 通知配置
	Settings jsonutils.JSONObject `json:"settings"`
}

type NotificationListInput

type NotificationListInput struct {
	apis.VirtualResourceListInput
	// 类型
	Type string `json:"type"`
}

type NotificationSettingAutoMigration

type NotificationSettingAutoMigration struct {
	AlertId string `json:"alert_id"`
}

type NotificationSettingDingding

type NotificationSettingDingding struct {
	Url         string `json:"url"`
	MessageType string `json:"message_type"`
}

type NotificationSettingFeishu

type NotificationSettingFeishu struct {
	// Url         string `json:"url"`
	AppId     string `json:"app_id"`
	AppSecret string `json:"app_secret"`
}

type NotificationSettingOneCloud

type NotificationSettingOneCloud struct {
	Channel  string   `json:"channel"`
	UserIds  []string `json:"user_ids"`
	RobotIds []string `json:"robot_ids"`
	RoleIds  []string `json:"role_ids"`
}

type NotificationTemplateConfig

type NotificationTemplateConfig struct {
	Title        string      `json:"title"`
	Name         string      `json:"name"`
	ResourceName string      `json:"resource_name"`
	Matches      []EvalMatch `json:"matches"`
	// PrevAlertState AlertStateType `json:"prev_alert_state"`
	// State AlertStateType `json:"state"`
	NoDataFound bool   `json:"no_data"`
	StartTime   string `json:"start_time"`
	EndTime     string `json:"end_time"`
	Description string `json:"description"`
	Priority    string `json:"priority"`
	Level       string `json:"level"`
	IsRecovery  bool   `json:"is_recovery"`
	WebUrl      string `json:"web_url"`
}

type NotificationTemplateCreateInput

type NotificationTemplateCreateInput struct {
	Content string `json:"content"`
}

type NotificationUpdateInput

type NotificationUpdateInput struct {
	apis.Meta

	// 报警通知名称
	Name string `json:"name"`
	// 是否为默认通知配置
	IsDefault *bool `json:"is_default"`
	// 是否一直提醒
	SendReminder *bool `json:"send_reminder"`
	// 是否禁用报警恢复提醒
	DisableResolveMessage *bool `json:"disable_resolve_message"`
	// 发送频率
	Frequency *time.Duration `json:"frequency"`
}

type PanelDetails

type PanelDetails struct {
	AlertDetails
	CommonAlertMetricDetails []*CommonAlertMetricDetails `json:"common_alert_metric_details"`
}

type ResourceAlertV1CreateInput

type ResourceAlertV1CreateInput struct {
	AlertCreateInput

	// 查询指标周期
	Period string `json:"period"`
	// 每隔多久查询一次
	Window string `json:"window"`
	// 比较运算符, 比如: >, <, >=, <=
	Comparator string `json:"comparator"`
	// 报警阀值
	Threshold float64 `json:"threshold"`
	// 通知方式, 比如: email, mobile
	Channel string `json:"channel"`
	// 通知接受者
	Recipients string `json:"recipients"`
}

type ResultLogEntry

type ResultLogEntry struct {
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
}

ResultLogEntry represents log data for the alert evaluation.

type SAlert

type SAlert struct {
	// db.SVirtualResourceBase
	apis.SEnabledResourceBase
	apis.SStatusStandaloneResourceBase
	SMonitorScopedResource
	// Frequency is evaluate period
	Frequency int64                `json:"frequency"`
	Settings  jsonutils.JSONObject `json:"settings"`
	Level     string               `json:"level"`
	Message   string               `json:"message"`
	UsedBy    string               `json:"used_by"`
	// Silenced       bool
	ExecutionError string `json:"execution_error"`
	// If an alert rule has a configured `For` and the query violates the configured threshold
	// it will first go from `OK` to `Pending`. Going from `OK` to `Pending` will not send any
	// notifications. Once the alert rule has been firing for more than `For` duration, it will
	// change to `Alerting` and send alert notifications.
	For                 int64                `json:"for"`
	EvalData            jsonutils.JSONObject `json:"eval_data"`
	State               string               `json:"state"`
	NoDataState         string               `json:"no_data_state"`
	ExecutionErrorState string               `json:"execution_error_state"`
	LastStateChange     time.Time            `json:"last_state_change"`
	StateChanges        int                  `json:"state_changes"`
	CustomizeConfig     jsonutils.JSONObject `json:"customize_config"`
	ResType             string               `json:"res_type"`
}

SAlert is an autogenerated struct via yunion.io/x/onecloud/pkg/monitor/models.SAlert.

type SAlertDashBoard

type SAlertDashBoard struct {
	// db.SVirtualResourceBase
	apis.SEnabledResourceBase
	apis.SStatusStandaloneResourceBase
	apis.SScopedResourceBase
	Refresh string `json:"refresh"`
}

SAlertDashBoard is an autogenerated struct via yunion.io/x/onecloud/pkg/monitor/models.SAlertDashBoard.

type SAlertDashboardPanel

type SAlertDashboardPanel struct {
	apis.SVirtualJointResourceBase
	DashboardId string `json:"dashboard_id"`
	PanelId     string `json:"panel_id"`
}

SAlertDashboardPanel is an autogenerated struct via yunion.io/x/onecloud/pkg/monitor/models.SAlertDashboardPanel.

type SAlertJointsBase

type SAlertJointsBase struct {
	apis.SVirtualJointResourceBase
	AlertId string `json:"alert_id"`
}

SAlertJointsBase is an autogenerated struct via yunion.io/x/onecloud/pkg/monitor/models.SAlertJointsBase.

type SAlertPanel

type SAlertPanel struct {
	apis.SStatusStandaloneResourceBase
	apis.SScopedResourceBase
	Settings jsonutils.JSONObject `json:"settings"`
	Message  string               `json:"message"`
}

SAlertPanel is an autogenerated struct via yunion.io/x/onecloud/pkg/monitor/models.SAlertPanel.

type SAlertRecord

type SAlertRecord struct {
	// db.SVirtualResourceBase
	apis.SEnabledResourceBase
	apis.SStatusStandaloneResourceBase
	SMonitorScopedResource
	AlertId   string               `json:"alert_id"`
	Level     string               `json:"level"`
	State     string               `json:"state"`
	SendState string               `json:"send_state"`
	EvalData  jsonutils.JSONObject `json:"eval_data"`
	AlertRule jsonutils.JSONObject `json:"alert_rule"`
	ResType   string               `json:"res_type"`
}

SAlertRecord is an autogenerated struct via yunion.io/x/onecloud/pkg/monitor/models.SAlertRecord.

type SAlertRecordShield

type SAlertRecordShield struct {
	// db.SVirtualResourceBase
	apis.SEnabledResourceBase
	apis.SStatusStandaloneResourceBase
	SMonitorScopedResource
	AlertId   string    `json:"alert_id"`
	ResId     string    `json:"res_id"`
	ResType   string    `json:"res_type"`
	StartTime time.Time `json:"start_time"`
	EndTime   time.Time `json:"end_time"`
}

SAlertRecordShield is an autogenerated struct via yunion.io/x/onecloud/pkg/monitor/models.SAlertRecordShield.

type SAlertResource

type SAlertResource struct {
	apis.SStandaloneResourceBase
	Type string `json:"type"`
}

SAlertResource is an autogenerated struct via yunion.io/x/onecloud/pkg/monitor/models.SAlertResource.

type SAlertResourceAlert

type SAlertResourceAlert struct {
	SAlertResourceJointsBase
	AlertId       string               `json:"alert_id"`
	AlertRecordId string               `json:"alert_record_id"`
	TriggerTime   time.Time            `json:"trigger_time"`
	Data          jsonutils.JSONObject `json:"data"`
}

SAlertResourceAlert is an autogenerated struct via yunion.io/x/onecloud/pkg/monitor/models.SAlertResourceAlert.

type SAlertResourceJointsBase

type SAlertResourceJointsBase struct {
	apis.SJointResourceBase
	AlertResourceId string `json:"alert_resource_id"`
}

SAlertResourceJointsBase is an autogenerated struct via yunion.io/x/onecloud/pkg/monitor/models.SAlertResourceJointsBase.

type SAlertnotification

type SAlertnotification struct {
	SAlertJointsBase
	NotificationId string               `json:"notification_id"`
	State          string               `json:"state"`
	Index          byte                 `json:"index"`
	UsedBy         string               `json:"used_by"`
	Params         jsonutils.JSONObject `json:"params"`
}

SAlertnotification is an autogenerated struct via yunion.io/x/onecloud/pkg/monitor/models.SAlertnotification.

type SCommonAlert

type SCommonAlert struct {
	SAlert
}

SCommonAlert is an autogenerated struct via yunion.io/x/onecloud/pkg/monitor/models.SCommonAlert.

type SDataSource

type SDataSource struct {
	apis.SStandaloneResourceBase
	Type      string `json:"type"`
	Url       string `json:"url"`
	User      string `json:"user"`
	Password  string `json:"password"`
	Database  string `json:"database"`
	IsDefault *bool  `json:"is_default,omitempty"`
}

SDataSource is an autogenerated struct via yunion.io/x/onecloud/pkg/monitor/models.SDataSource.

type SMeterAlert

type SMeterAlert struct {
	SV1Alert
}

SMeterAlert is an autogenerated struct via yunion.io/x/onecloud/pkg/monitor/models.SMeterAlert.

type SMetric

type SMetric struct {
	apis.SVirtualJointResourceBase
	MeasurementId string `json:"measurement_id"`
	FieldId       string `json:"field_id"`
}

SMetric is an autogenerated struct via yunion.io/x/onecloud/pkg/monitor/models.SMetric.

type SMetricField

type SMetricField struct {
	// db.SVirtualResourceBase
	apis.SEnabledResourceBase
	apis.SStatusStandaloneResourceBase
	apis.SScopedResourceBase
	DisplayName string `json:"display_name"`
	Unit        string `json:"unit"`
	ValueType   string `json:"value_type"`
	Score       int    `json:"score"`
}

SMetricField is an autogenerated struct via yunion.io/x/onecloud/pkg/monitor/models.SMetricField.

type SMetricMeasurement

type SMetricMeasurement struct {
	// db.SVirtualResourceBase
	apis.SEnabledResourceBase
	apis.SStatusStandaloneResourceBase
	apis.SScopedResourceBase
	ResType     string `json:"res_type"`
	Database    string `json:"database"`
	DisplayName string `json:"display_name"`
	Score       int    `json:"score"`
}

SMetricMeasurement is an autogenerated struct via yunion.io/x/onecloud/pkg/monitor/models.SMetricMeasurement.

type SMigrationAlert

type SMigrationAlert struct {
	SAlert
	MetricType   string               `json:"metric_type"`
	MigrateNotes jsonutils.JSONObject `json:"migrate_notes"`
}

SMigrationAlert is an autogenerated struct via yunion.io/x/onecloud/pkg/monitor/models.SMigrationAlert.

type SMonitorResource

type SMonitorResource struct {
	apis.SVirtualResourceBase
	apis.SEnabledResourceBase
	AlertState string `json:"alert_state"`
	ResId      string `json:"res_id"`
	ResType    string `json:"res_type"`
}

SMonitorResource is an autogenerated struct via yunion.io/x/onecloud/pkg/monitor/models.SMonitorResource.

type SMonitorResourceAlert

type SMonitorResourceAlert struct {
	apis.SJointResourceBase
	MonitorResourceId string               `json:"monitor_resource_id"`
	AlertId           string               `json:"alert_id"`
	AlertRecordId     string               `json:"alert_record_id"`
	ResType           string               `json:"res_type"`
	AlertState        string               `json:"alert_state"`
	SendState         string               `json:"send_state"`
	TriggerTime       time.Time            `json:"trigger_time"`
	Data              jsonutils.JSONObject `json:"data"`
}

SMonitorResourceAlert is an autogenerated struct via yunion.io/x/onecloud/pkg/monitor/models.SMonitorResourceAlert.

type SMonitorScopedResource

type SMonitorScopedResource struct {
	apis.SScopedResourceBase
}

SMonitorScopedResource is an autogenerated struct via yunion.io/x/onecloud/pkg/monitor/models.SMonitorScopedResource.

type SNodeAlert

type SNodeAlert struct {
	SCommonAlert
}

SNodeAlert is an autogenerated struct via yunion.io/x/onecloud/pkg/monitor/models.SNodeAlert.

type SNotification

type SNotification struct {
	apis.SVirtualResourceBase
	Type                  string `json:"type"`
	IsDefault             bool   `json:"is_default"`
	SendReminder          bool   `json:"send_reminder"`
	DisableResolveMessage bool   `json:"disable_resolve_message"`
	// unit is second
	Frequency            int64                `json:"frequency"`
	Settings             jsonutils.JSONObject `json:"settings"`
	LastSendNotification time.Time            `json:"last_send_notification"`
}

SNotification is an autogenerated struct via yunion.io/x/onecloud/pkg/monitor/models.SNotification.

type SSuggestSysAlertSetting

type SSuggestSysAlertSetting struct {
	EIPUnused  *EIPUnused  `json:"eip_unused"`
	DiskUnused *DiskUnused `json:"disk_unused"`
	LBUnused   *LBUnused   `json:"lb_unused"`
	ScaleRule  *ScaleRule  `json:"scale_rule"`
}

type SV1Alert

type SV1Alert struct {
	SAlert
}

SV1Alert is an autogenerated struct via yunion.io/x/onecloud/pkg/monitor/models.SV1Alert.

type Scale

type Scale struct {
	Database    string `json:"database"`
	Measurement string `json:"measurement"`
	//rule operator rule [and|or]
	Operator  string  `json:"operator"`
	Field     string  `json:"field"`
	EvalType  string  `json:"eval_type"`
	Threshold float64 `json:"threshold"`
	Tag       string  `json:"tag"`
	TagVal    string  `json:"tag_val"`
}

type ScaleEvalMatch

type ScaleEvalMatch struct {
	EvalMatch
	ResourceId map[string]string `json:"resource_id"`
}

type ScaleRule

type ScaleRule []Scale

type SendWebhookSync

type SendWebhookSync struct {
	Url         string
	User        string
	Password    string
	Body        string
	HttpMethod  string
	HttpHeader  map[string]string
	ContentType string
}

type SimpleQueryInput

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

type SimpleQueryOutput struct {
	Id    string    `json:"id"`
	Time  time.Time `json:"time"`
	Value float64   `json:"value"`
}

type SuggestAlertIngoreInput

type SuggestAlertIngoreInput struct {
	apis.ScopedResourceCreateInput
	BatchIgnore bool `json:"batch_ignore"`
}

type SuggestAlertProblem

type SuggestAlertProblem struct {
	Type        string `json:"type"`
	Description string `json:"description"`
}

type SuggestDriverAction

type SuggestDriverAction string

type SuggestDriverType

type SuggestDriverType string

type SuggestSysAlertCreateInput

type SuggestSysAlertCreateInput struct {
	apis.VirtualResourceCreateInput

	Enabled       *bool                    `json:"enabled"`
	MonitorConfig *SSuggestSysAlertSetting `json:"monitor_config"`

	//转换成ResId
	ResID string `json:"res_id"`
	Type  string `json:"type"`
	//Problem jsonutils.JSONObject `json:"problem"`
	Suggest string `json:"suggest"`
	Action  string `json:"action"`

	RuleAt time.Time `json:"rule_at"`
}

type SuggestSysAlertDetails

type SuggestSysAlertDetails struct {
	apis.VirtualResourceDetails
	compute.CloudregionResourceInfo
	RuleName                 string                      `json:"rule_name"`
	ShowName                 string                      `json:"show_name"`
	ResType                  string                      `json:"res_type"`
	Suggest                  string                      `json:"suggest"`
	Brand                    string                      `json:"brand"`
	Account                  string                      `json:"account"`
	ResName                  string                      `json:"res_name"`
	CommonAlertMetricDetails []*CommonAlertMetricDetails `json:"common_alert_metric_details"`
}

type SuggestSysAlertListInput

type SuggestSysAlertListInput struct {
	apis.VirtualResourceListInput
	apis.EnabledResourceBaseListInput
	compute.ManagedResourceListInput

	//监控规则type:Rule Type
	Type  string `json:"type"`
	ResId string `json:"res_id"`
}

type SuggestSysAlertUpdateInput

type SuggestSysAlertUpdateInput struct {
	apis.VirtualResourceBaseUpdateInput

	Enabled       *bool                    `json:"enabled"`
	MonitorConfig *SSuggestSysAlertSetting `json:"monitor_config"`

	//转换成ResId
	ResID string `json:"res_id"`
	Type  string `json:"type"`
	//Problem jsonutils.JSONObject `json:"problem"`
	Suggest string `json:"suggest"`
	Action  string `json:"action"`

	RuleAt time.Time `json:"rule_at"`
}

type SuggestSysRuleConfigCreateInput

type SuggestSysRuleConfigCreateInput struct {
	apis.StandaloneResourceCreateInput
	apis.ScopedResourceCreateInput

	// Type is suggestsysrule driver type
	Type *SuggestDriverType `json:"type"`
	// RuleId is SSuggestSysRule model object id
	// RuleId *string `json:"rule_id"`
	// ResourceType is suggestsysrule driver resource type
	ResourceType *MonitorResourceType `json:"resource_type"`
	// ResourceId is suggest alert result resource id
	ResourceId *string `json:"resource_id"`
	// IgnoreAlert means whether or not show SSuggestSysAlert results for current scope
	IgnoreAlert bool `json:"ignore_alert"`
}

type SuggestSysRuleConfigDetails

type SuggestSysRuleConfigDetails struct {
	apis.StandaloneResourceDetails
	apis.ScopedResourceBaseInfo

	RuleId      string `json:"rule_id"`
	Rule        string `json:"rule"`
	RuleEnabled bool   `json:"rule_enabled"`
	ResName     string `json:"res_name"`
}

type SuggestSysRuleConfigListInput

type SuggestSysRuleConfigListInput struct {
	apis.StandaloneResourceListInput
	apis.ScopedResourceBaseListInput
	Type         *SuggestDriverType   `json:"type"`
	ResourceType *MonitorResourceType `json:"resource_type"`
	IgnoreAlert  *bool                `json:"ignore_alert"`
}

type SuggestSysRuleConfigSupportTypes

type SuggestSysRuleConfigSupportTypes struct {
	Types         []SuggestDriverType `json:"types"`
	ResourceTypes []string            `json:"resource_types"`
}

type SuggestSysRuleConfigTypeInfo

type SuggestSysRuleConfigTypeInfo struct {
	Name string `json:"name"`
}

type SuggestSysRuleConfigUpdateInput

type SuggestSysRuleConfigUpdateInput struct {
	apis.Meta

	// IgnoreAlert means whether or not show SSuggestSysAlert results for current scope
	IgnoreAlert *bool `json:"ignore_alert"`
}

type SuggestSysRuleCreateInput

type SuggestSysRuleCreateInput struct {
	apis.StandaloneResourceCreateInput

	// 查询指标周期
	Period         string                   `json:"period"`
	TimeFrom       string                   `json:"time_from"`
	Type           string                   `json:"type"`
	Enabled        *bool                    `json:"enabled"`
	Setting        *SSuggestSysAlertSetting `json:"setting"`
	IgnoreTimeFrom *bool                    `json:"ignore_time_from"`
}

type SuggestSysRuleDetails

type SuggestSysRuleDetails struct {
	apis.StandaloneResourceDetails
	CommonAlertMetricDetails []*CommonAlertMetricDetails `json:"common_alert_metric_details"`

	ID      string                   `json:"id"`
	Name    string                   `json:"name"`
	Setting *SSuggestSysAlertSetting `json:"setting"`
	Enabled bool                     `json:"enabled"`
}

type SuggestSysRuleUpdateInput

type SuggestSysRuleUpdateInput struct {
	apis.Meta

	// 查询指标周期
	Period       string                   `json:"period"`
	Name         string                   `json:"name"`
	Type         string                   `json:"type"`
	Setting      *SSuggestSysAlertSetting `json:"setting"`
	Enabled      *bool                    `json:"enabled"`
	ExecTime     time.Time                `json:"exec_time"`
	IgnorePeriod *bool                    `json:"ignore_period"`
}

type TimeSeries

type TimeSeries struct {
	Results []TimeSeriesResult `json:"results"`
}

type TimeSeriesResult

type TimeSeriesResult struct {
	Series []TimeSeriesRow `json:"series"`
}

type TimeSeriesRow

type TimeSeriesRow struct {
	Metric  Metric            `json:"metric"`
	Tags    map[string]string `json:"tags,omitempty"`
	Columns []string          `json:"columns,omitempty"`
	// Value item is a point with timestamp and value
	Values [][]interface{} `json:"values,omitempty"`
}

type V1AlertListInput

type V1AlertListInput struct {
	AlertListInput
}

type V1AlertUpdateInput

type V1AlertUpdateInput struct {
	AlertUpdateInput
}

Jump to

Keyboard shortcuts

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