Documentation ¶
Index ¶
- Constants
- func DoBalance(ctx context.Context, s *mcclient.ClientSession, rules *Rules, ...) error
- func GetAlertSettingThreshold(s *api.AlertSetting) (float64, error)
- func NewMigrateNote(pair *resultPair, err error) (*models.MigrateNote, error)
- func RecoverInProcessAlerts(ctx context.Context, s *mcclient.ClientSession) error
- type EventAction
- type HostMetric
- type HostMetrics
- type HostResource
- type ICandidate
- type ICondition
- type IHost
- type IMetricDriver
- type IRecorder
- type IResource
- type ITarget
- type ItemType
- type MetricDrivers
- type Rules
- type SourceRule
- type TargetRule
- type TsdbQuery
Constants ¶
View Source
const ( ItemTypeHost = "host" ItemTypeGuest = "guest" )
View Source
const ( EventActionFindResultFail = "find_result_fail" EventActionMigrating = "migrating" EventActionMigrateSuccess = "migrate_success" EventActionMigrateFail = "migrate_fail" EventActionMigrateError = "migrate_error" )
Variables ¶
This section is empty.
Functions ¶
func GetAlertSettingThreshold ¶
func GetAlertSettingThreshold(s *api.AlertSetting) (float64, error)
func NewMigrateNote ¶
func NewMigrateNote(pair *resultPair, err error) (*models.MigrateNote, error)
func RecoverInProcessAlerts ¶
func RecoverInProcessAlerts(ctx context.Context, s *mcclient.ClientSession) error
Types ¶
type EventAction ¶
type EventAction string
type HostMetric ¶
type HostMetrics ¶
type HostMetrics struct {
// contains filtered or unexported fields
}
func InfluxdbQuery ¶
func InfluxdbQuery( ds *tsdb.DataSource, idKey string, hosts []IResource, query *TsdbQuery) (*HostMetrics, error)
func NewHostMetrics ¶
func NewHostMetrics(ms []*HostMetric) *HostMetrics
func (HostMetrics) Get ¶
func (hs HostMetrics) Get(id string) *HostMetric
func (HostMetrics) JSONString ¶
func (hs HostMetrics) JSONString() string
type HostResource ¶
type HostResource struct { IResource // contains filtered or unexported fields }
func (*HostResource) GetHostResource ¶
func (h *HostResource) GetHostResource() *HostResource
type ICandidate ¶
type ICondition ¶
type ICondition interface { GetThreshold() float64 // GetSourceThresholdDelta must > 0 GetSourceThresholdDelta(threshold float64, srcHost IHost) float64 IsFitTarget(settings *monitor.MigrationAlertSettings, t ITarget, c ICandidate) error }
type IMetricDriver ¶
type IMetricDriver interface { GetType() monitor.MigrationAlertMetricType GetTsdbQuery() *TsdbQuery GetCandidate(gst jsonutils.JSONObject, host IHost, ds *tsdb.DataSource) (ICandidate, error) SetHostCurrent(h IHost, values map[string]float64) error GetTarget(host jsonutils.JSONObject) (ITarget, error) GetCondition(s *monitor.AlertSetting) (ICondition, error) }
type IRecorder ¶
type IRecorder interface { Record(userCred mcclient.TokenCredential, alert *models.SMigrationAlert, notes interface{}, act EventAction) RecordError(userCred mcclient.TokenCredential, alert *models.SMigrationAlert, err error, act EventAction) RecordMigrate(ctx context.Context, s *mcclient.ClientSession, alert *models.SMigrationAlert, note *models.MigrateNote) error RecordMigrateError(userCred mcclient.TokenCredential, alert *models.SMigrationAlert, note *models.MigrateNote, err error) error StartWatchMigratingProcess(ctx context.Context, s *mcclient.ClientSession, alert *models.SMigrationAlert, note *models.MigrateNote) }
func NewRecorder ¶
func NewRecorder() IRecorder
type IResource ¶
type IResource interface { GetId() string GetName() string GetObject() jsonutils.JSONObject }
type ITarget ¶
type ITarget interface { IHost Selected(c ICandidate) ITarget }
type MetricDrivers ¶
func GetMetricDrivers ¶
func GetMetricDrivers() *MetricDrivers
func NewMetricDrivers ¶
func NewMetricDrivers() *MetricDrivers
func (*MetricDrivers) Get ¶
func (d *MetricDrivers) Get(mT monitor.MigrationAlertMetricType) (IMetricDriver, error)
type Rules ¶
type Rules struct { Alert *models.SMigrationAlert Condtion ICondition Source *SourceRule Target *TargetRule ResultMustPair bool }
func NewRules ¶
func NewRules(_ *alerting.EvalContext, m *monitor.EvalMatch, alert *models.SMigrationAlert, drv IMetricDriver, resultMustPair bool) (*Rules, error)
func (*Rules) GetAlert ¶
func (r *Rules) GetAlert() *models.SMigrationAlert
type SourceRule ¶
type SourceRule struct { Host IHost Candidates []ICandidate }
SourceRule 定义触发了报警的宿主机和上面可以迁移的虚拟机
func NewSourceRule ¶
func NewSourceRule(host IHost, cds []ICandidate) *SourceRule
type TargetRule ¶
type TargetRule struct {
Items []ITarget
}
TargetRule 定义可以选择迁移的宿主机
func NewTargetRule ¶
func NewTargetRule(hosts []ITarget) *TargetRule
Click to show internal directories.
Click to hide internal directories.