Documentation
¶
Index ¶
- Constants
- Variables
- func ActionToPb(action *Action) *pb.Action
- func AlertDetailToPb(alertDetail *AlertDetail) *pb.AlertDetail
- func AlertStatusToPb(alertStatus AlertStatus) *pb.AlertStatus
- func AlertToPb(alert *Alert) *pb.Alert
- func CommentToPb(comment *Comment) *pb.Comment
- func HistoryDetailToPb(historyDetail *HistoryDetail) *pb.HistoryDetail
- func HistoryToPb(history *History) *pb.History
- func MetricToPb(metric *Metric) *pb.Metric
- func NewActionId() string
- func NewAlertId() string
- func NewCommentId() string
- func NewHistoryId(salt string) string
- func NewMetricId() string
- func NewPolicyId() string
- func NewResourceTypeId() string
- func NewRsFilterId() string
- func NewRuleId() string
- func ParseAcSet2PbSet(inAcs []*Action) []*pb.Action
- func ParseAlSet2PbSet(inAls []*Alert) []*pb.Alert
- func ParseAldSet2PbSet(inAlds []*AlertDetail) []*pb.AlertDetail
- func ParseAlsSet2PbSet(inAlss []AlertStatus) []*pb.AlertStatus
- func ParseCmtSet2PbSet(inCmts []*Comment) []*pb.Comment
- func ParseHsSet2PbSet(inHss []*History) []*pb.History
- func ParseHsdSet2PbSet(inHsds []*HistoryDetail) []*pb.HistoryDetail
- func ParseMtSet2PbSet(inMts []*Metric) []*pb.Metric
- func ParsePlSet2PbSet(inPls []*Policy) []*pb.Policy
- func ParseRfSet2PbSet(inRfs []*ResourceFilter) []*pb.ResourceFilter
- func ParseRlSet2PbSet(inRls []*Rule) []*pb.Rule
- func ParseRtSet2PbSet(inRts []*ResourceType) []*pb.ResourceType
- func PolicyToPb(policy *Policy) *pb.Policy
- func ResourceFilterToPb(rsFilter *ResourceFilter) *pb.ResourceFilter
- func ResourceTypeToPb(resourceType *ResourceType) *pb.ResourceType
- func RuleToPb(rule *Rule) *pb.Rule
- type Action
- type Alert
- type AlertDetail
- type AlertInfo
- type AlertStatus
- type Comment
- type History
- type HistoryDetail
- type Metric
- type Policy
- type PolicyByAlert
- type ResourceFilter
- type ResourceStatus
- type ResourceType
- type Rule
- type RuleDetail
Constants ¶
View Source
const ( AcColId = "action_id" AcColName = "action_name" AcColTriggerStatus = "trigger_status" AcColTriggerAction = "trigger_action" AcColCreateTime = "create_time" AcColUpdateTime = "update_time" AcColPolicyId = "policy_id" AcColNfAddressListId = "nf_address_list_id" )
field name Ac is short for action.
View Source
const ( AlColId = "alert_id" AlColName = "alert_name" AlColDisabled = "disabled" AlColRunningStatus = "running_status" AlColAlertStatus = "alert_status" AlColCreateTime = "create_time" AlColUpdateTime = "update_time" AlColPolicyId = "policy_id" AlColRsFilterId = "rs_filter_id" AlColExecutorId = "executor_id" )
field name Al is short for alert.
View Source
const ( CmColId = "comment_id" CmColAddresser = "addresser" CmColContent = "content" CmColCreateTime = "create_time" CmColUpdateTime = "update_time" CmColHistoryId = "history_id" )
field name Cm is short for comment.
View Source
const ( HsColId = "history_id" HsColName = "history_name" HsColEvent = "event" HsColContent = "content" HsColNotificationId = "notification_id" HsColCreateTime = "create_time" HsColUpdateTime = "update_time" HsColAlertId = "alert_id" HsColRuleId = "rule_id" HsColResourceName = "resource_name" )
field name Hs is short for history.
View Source
const ( MtColId = "metric_id" MtColName = "metric_name" MtColParam = "metric_param" MtColStatus = "status" MtColCreateTime = "create_time" MtColUpdateTime = "update_time" MtColTypeId = "rs_type_id" )
field name Mt is short for metric.
View Source
const ( PlColId = "policy_id" PlColName = "policy_name" PlColDescription = "policy_description" PlColConfig = "policy_config" PlColCreator = "creator" PlColAvailableStartTime = "available_start_time" PlColAvailableEndTime = "available_end_time" PlColCreateTime = "create_time" PlColUpdateTime = "update_time" PlColTypeId = "rs_type_id" PlColLanguage = "language" )
field name Pl is short for policy.
View Source
const ( RfColId = "rs_filter_id" RfColName = "rs_filter_name" RfColParam = "rs_filter_param" RfColStatus = "status" RfColCreateTime = "create_time" RfColUpdateTime = "update_time" RfColTypeId = "rs_type_id" )
field name Rf is short for resource filter.
View Source
const ( RtColId = "rs_type_id" RtColName = "rs_type_name" RtColParam = "rs_type_param" RtColCreateTime = "create_time" RtColUpdateTime = "update_time" )
field name Rt is short for resource_type.
View Source
const ( RlColId = "rule_id" RlColName = "rule_name" RlColDisabled = "disabled" RlColMonitorPeriods = "monitor_periods" RlColSeverity = "severity" RlColMetricsType = "metrics_type" RlColConditionType = "condition_type" RlColThresholds = "thresholds" RlColUnit = "unit" RlColConsecutiveCount = "consecutive_count" RlColInhibit = "inhibit" RlColCreateTime = "create_time" RlColUpdateTime = "update_time" RlColPolicyId = "policy_id" RlColMetricId = "metric_id" )
field name Rl is short for rule.
View Source
const (
ActionIdPrefix = "ac-"
)
View Source
const (
AlertIdPrefix = "al-"
)
View Source
const (
CommentIdPrefix = "cm-"
)
View Source
const (
HistoryIdPrefix = "hs-"
)
View Source
const (
MetricIdPrefix = "mt-"
)
View Source
const (
PolicyIdPrefix = "pl-"
)
View Source
const (
ResourceTypeIdPrefix = "rst-"
)
View Source
const (
RsFilterIdPrefix = "rf-"
)
View Source
const (
RuleIdPrefix = "rl-"
)
View Source
const (
TableAction = "action"
)
table name
View Source
const (
TableAlert = "alert"
)
table name
View Source
const (
TableComment = "comment"
)
table name
View Source
const (
TableHistory = "history"
)
table name
View Source
const (
TableMetric = "metric"
)
table name
View Source
const (
TablePolicy = "policy"
)
table name
View Source
const (
TableResourceFilter = "resource_filter"
)
table name
View Source
const (
TableResourceType = "resource_type"
)
table name
View Source
const (
TableRule = "rule"
)
table name
Variables ¶
View Source
var IndexedColumns = map[string][]string{ TableResourceType: { RtColId, RtColName, }, TableResourceFilter: { RfColId, RfColName, RfColStatus, RfColTypeId, }, TableMetric: { MtColId, MtColName, MtColStatus, MtColTypeId, }, TablePolicy: { PlColId, PlColName, PlColDescription, PlColCreator, PlColTypeId, }, TableRule: { RlColId, RlColName, RlColDisabled, RlColMonitorPeriods, RlColSeverity, RlColMetricsType, RlColConditionType, RlColThresholds, RlColUnit, RlColConsecutiveCount, RlColInhibit, RlColPolicyId, RlColMetricId, }, TableAlert: { AlColId, AlColName, AlColDisabled, AlColRunningStatus, AlColPolicyId, AlColRsFilterId, AlColExecutorId, }, TableHistory: { HsColId, HsColName, HsColEvent, HsColContent, HsColNotificationId, HsColAlertId, HsColRuleId, HsColResourceName, }, TableComment: { CmColId, CmColAddresser, CmColContent, CmColHistoryId, }, TableAction: { AcColId, AcColName, AcColTriggerStatus, AcColTriggerAction, AcColPolicyId, AcColNfAddressListId, }, }
columns that can be search through sql '=' operator
View Source
var SearchColumns = map[string][]string{ TableResourceType: { RtColId, RtColName, }, TableResourceFilter: { RfColId, RfColName, RfColStatus, RfColTypeId, }, TableMetric: { MtColId, MtColName, MtColStatus, MtColTypeId, }, TablePolicy: { PlColId, PlColName, PlColDescription, PlColCreator, PlColTypeId, }, TableRule: { RlColId, RlColName, RlColDisabled, RlColMonitorPeriods, RlColSeverity, RlColMetricsType, RlColConditionType, RlColThresholds, RlColUnit, RlColConsecutiveCount, RlColInhibit, RlColPolicyId, RlColMetricId, }, TableAlert: { AlColId, AlColName, AlColDisabled, AlColRunningStatus, AlColPolicyId, AlColRsFilterId, AlColExecutorId, }, TableHistory: { HsColId, HsColName, HsColEvent, HsColContent, HsColNotificationId, HsColAlertId, HsColRuleId, HsColResourceName, }, TableComment: { CmColId, CmColAddresser, CmColContent, CmColHistoryId, }, TableAction: { AcColId, AcColName, AcColTriggerStatus, AcColTriggerAction, AcColPolicyId, AcColNfAddressListId, }, }
columns that can be search through sql 'like' operator
View Source
var SearchWordColumnTable = []string{ TableResourceType, TableResourceFilter, TableMetric, TablePolicy, TableRule, TableAlert, TableHistory, TableComment, }
Functions ¶
func ActionToPb ¶
func AlertDetailToPb ¶
func AlertDetailToPb(alertDetail *AlertDetail) *pb.AlertDetail
func AlertStatusToPb ¶
func AlertStatusToPb(alertStatus AlertStatus) *pb.AlertStatus
func CommentToPb ¶
func HistoryDetailToPb ¶
func HistoryDetailToPb(historyDetail *HistoryDetail) *pb.HistoryDetail
func HistoryToPb ¶
func MetricToPb ¶
func NewActionId ¶
func NewActionId() string
func NewAlertId ¶
func NewAlertId() string
func NewCommentId ¶
func NewCommentId() string
func NewHistoryId ¶
func NewMetricId ¶
func NewMetricId() string
func NewPolicyId ¶
func NewPolicyId() string
func NewResourceTypeId ¶
func NewResourceTypeId() string
func NewRsFilterId ¶
func NewRsFilterId() string
func ParseAcSet2PbSet ¶
func ParseAlSet2PbSet ¶
func ParseAldSet2PbSet ¶
func ParseAldSet2PbSet(inAlds []*AlertDetail) []*pb.AlertDetail
func ParseAlsSet2PbSet ¶
func ParseAlsSet2PbSet(inAlss []AlertStatus) []*pb.AlertStatus
func ParseCmtSet2PbSet ¶
func ParseHsSet2PbSet ¶
func ParseHsdSet2PbSet ¶
func ParseHsdSet2PbSet(inHsds []*HistoryDetail) []*pb.HistoryDetail
func ParseMtSet2PbSet ¶
func ParsePlSet2PbSet ¶
func ParseRfSet2PbSet ¶
func ParseRfSet2PbSet(inRfs []*ResourceFilter) []*pb.ResourceFilter
func ParseRlSet2PbSet ¶
func ParseRtSet2PbSet ¶
func ParseRtSet2PbSet(inRts []*ResourceType) []*pb.ResourceType
func PolicyToPb ¶
func ResourceFilterToPb ¶
func ResourceFilterToPb(rsFilter *ResourceFilter) *pb.ResourceFilter
func ResourceTypeToPb ¶
func ResourceTypeToPb(resourceType *ResourceType) *pb.ResourceType
Types ¶
type Action ¶
type Action struct { ActionId string `gorm:"column:action_id" json:"action_id"` ActionName string `gorm:"column:action_name" json:"action_name"` TriggerStatus string `gorm:"column:trigger_status" json:"trigger_status"` TriggerAction string `gorm:"column:trigger_action" json:"trigger_action"` CreateTime time.Time `gorm:"column:create_time" json:"create_time"` UpdateTime time.Time `gorm:"column:update_time" json:"update_time"` PolicyId string `gorm:"column:policy_id" json:"policy_id"` NfAddressListId string `gorm:"column:nf_address_list_id" json:"nf_address_list_id"` }
type Alert ¶
type Alert struct { AlertId string `gorm:"column:alert_id" json:"alert_id"` AlertName string `gorm:"column:alert_name" json:"alert_name"` Disabled bool `gorm:"column:disabled" json:"disabled"` RunningStatus string `gorm:"column:running_status" json:"running_status"` AlertStatus string `gorm:"column:alert_status" json:"alert_status"` CreateTime time.Time `gorm:"column:create_time" json:"create_time"` UpdateTime time.Time `gorm:"column:update_time" json:"update_time"` PolicyId string `gorm:"column:policy_id" json:"policy_id"` RsFilterId string `gorm:"column:rs_filter_id" json:"rs_filter_id"` ExecutorId string `gorm:"column:executor_id" json:"executor_id"` }
type AlertDetail ¶
type AlertDetail struct { AlertId string `gorm:"column:alert_id" json:"alert_id"` AlertName string `gorm:"column:alert_name" json:"alert_name"` Disabled bool `gorm:"column:disabled" json:"disabled"` CreateTime time.Time `gorm:"column:create_time" json:"create_time"` RunningStatus string `gorm:"column:running_status" json:"running_status"` AlertStatus string `gorm:"column:alert_status" json:"alert_status"` PolicyId string `gorm:"column:policy_id" json:"policy_id"` RsFilterName string `gorm:"column:rs_filter_name" json:"rs_filter_name"` RsFilterParam string `gorm:"column:rs_filter_param" json:"rs_filter_param"` RsTypeName string `gorm:"column:rs_type_name" json:"rs_type_name"` ExecutorId string `gorm:"column:executor_id" json:"executor_id"` PolicyName string `gorm:"column:policy_name" json:"policy_name"` PolicyDescription string `gorm:"column:policy_description" json:"policy_description"` PolicyConfig string `gorm:"column:policy_config" json:"policy_config"` Creator string `gorm:"column:creator" json:"creator"` AvailableStartTime string `gorm:"column:available_start_time" json:"available_start_time"` AvailableEndTime string `gorm:"column:available_end_time" json:"available_end_time"` Language string `gorm:"column:language" json:"language"` Metrics []string `gorm:"column:metrics" json:"metrics"` RulesCount uint32 `json:"rules_count"` PositivesCount uint32 `json:"positives_count"` MostRecentAlertTime string `json:"most_recent_alert_time"` NfAddressListId string `gorm:"column:nf_address_list_id" json:"nf_address_list_id"` }
type AlertInfo ¶
type AlertInfo struct { RsFilter ResourceFilter `json:"resource_filter"` Policy Policy `json:"policy"` Rules []Rule `json:"rules"` Action Action `json:"action"` Alert Alert `json:"alert"` }
type AlertStatus ¶
type AlertStatus struct { RuleId string `gorm:"column:rule_id" json:"rule_id"` RuleName string `gorm:"column:rule_name" json:"rule_name"` Disabled bool `gorm:"column:disabled" json:"disabled"` MonitorPeriods uint32 `gorm:"column:monitor_periods" json:"monitor_periods"` Severity string `gorm:"column:severity" json:"severity"` MetricsType string `gorm:"column:metrics_type" json:"metrics_type"` ConditionType string `gorm:"column:condition_type" json:"condition_type"` Thresholds string `gorm:"column:thresholds" json:"thresholds"` Unit string `gorm:"column:unit" json:"unit"` ConsecutiveCount uint32 `gorm:"column:consecutive_count" json:"consecutive_count"` Inhibit bool `gorm:"column:inhibit" json:"inhibit"` MetricName string `gorm:"column:metric_name" json:"metric_name"` Resources []ResourceStatus `gorm:"column:resources" json:"resources"` CreateTime time.Time `gorm:"column:create_time" json:"create_time"` UpdateTime time.Time `gorm:"column:update_time" json:"update_time"` AlertStatus string `gorm:"column:alert_status"` }
type Comment ¶
type Comment struct { CommentId string `gorm:"column:comment_id" json:"comment_id"` Addresser string `gorm:"column:addresser" json:"addresser"` Content string `gorm:"column:content" json:"content"` CreateTime time.Time `gorm:"column:create_time" json:"create_time"` UpdateTime time.Time `gorm:"column:update_time" json:"update_time"` HistoryId string `gorm:"column:history_id" json:"history_id"` }
type History ¶
type History struct { HistoryId string `gorm:"column:history_id" json:"history_id"` HistoryName string `gorm:"column:history_name" json:"history_name"` Event string `gorm:"column:event" json:"event"` Content string `gorm:"column:content" json:"content"` NotificationId string `gorm:"column:notification_id" json:"notification_id"` CreateTime time.Time `gorm:"column:create_time" json:"create_time"` UpdateTime time.Time `gorm:"column:update_time" json:"update_time"` AlertId string `gorm:"column:alert_id" json:"alert_id"` RuleId string `gorm:"column:rule_id" json:"rule_id"` ResourceName string `gorm:"column:resource_name" json:"resource_name"` }
type HistoryDetail ¶
type HistoryDetail struct { HistoryId string `gorm:"column:history_id" json:"history_id"` HistoryName string `gorm:"column:history_name" json:"history_name"` RuleId string `gorm:"column:rule_id" json:"rule_id"` RuleName string `gorm:"column:rule_name" json:"rule_name"` Event string `gorm:"column:event" json:"event"` NotificationId string `gorm:"column:notification_id" json:"notification_id"` NotificationStatus string `gorm:"column:notification_status" json:"notification_status"` Severity string `gorm:"column:severity" json:"severity"` RsTypeName string `gorm:"column:rs_type_name" json:"rs_type_name"` RsFilterName string `gorm:"column:rs_filter_name" json:"rs_filter_name"` MetricName string `gorm:"column:metric_name" json:"metric_name"` ConditionType string `gorm:"column:condition_type" json:"condition_type"` Thresholds string `gorm:"column:thresholds" json:"thresholds"` Unit string `gorm:"column:unit" json:"unit"` AlertName string `gorm:"column:alert_name" json:"alert_name"` RsFilterParam string `gorm:"column:rs_filter_param" json:"rs_filter_param"` ResourceName string `gorm:"column:resource_name" json:"resource_name"` CreateTime time.Time `gorm:"column:create_time" json:"create_time"` UpdateTime time.Time `gorm:"column:update_time" json:"update_time"` }
type Metric ¶
type Metric struct { MetricId string `gorm:"column:metric_id" json:"metric_id"` MetricName string `gorm:"column:metric_name" json:"metric_name"` MetricParam string `gorm:"column:metric_param" json:"metric_param"` Status string `gorm:"column:status" json:"status"` RsTypeId string `gorm:"column:rs_type_id" json:"rs_type_id"` CreateTime time.Time `gorm:"column:create_time" json:"create_time"` UpdateTime time.Time `gorm:"column:update_time" json:"update_time"` }
type Policy ¶
type Policy struct { PolicyId string `gorm:"column:policy_id" json:"policy_id"` PolicyName string `gorm:"column:policy_name" json:"policy_name"` PolicyDescription string `gorm:"column:policy_description" json:"policy_description"` PolicyConfig string `gorm:"column:policy_config" json:"policy_config"` Creator string `gorm:"column:creator" json:"creator"` AvailableStartTime string `gorm:"column:available_start_time" json:"available_start_time"` AvailableEndTime string `gorm:"column:available_end_time" json:"available_end_time"` CreateTime time.Time `gorm:"column:create_time" json:"create_time"` UpdateTime time.Time `gorm:"column:update_time" json:"update_time"` RsTypeId string `gorm:"column:rs_type_id" json:"rs_type_id"` Language string `gorm:"column:language" json:"language"` }
type PolicyByAlert ¶
type PolicyByAlert struct { AlertName string `gorm:"column:alert_name" json:"alert_name"` PolicyName string `gorm:"column:policy_name" json:"policy_name"` PolicyDescription string `gorm:"column:policy_description" json:"policy_description"` PolicyConfig string `gorm:"column:policy_config" json:"policy_config"` Creator string `gorm:"column:creator" json:"creator"` AvailableStartTime string `gorm:"column:available_start_time" json:"available_start_time"` AvailableEndTime string `gorm:"column:available_end_time" json:"available_end_time"` CreateTime time.Time `gorm:"column:create_time" json:"create_time"` UpdateTime time.Time `gorm:"column:update_time" json:"update_time"` RsTypeId string `gorm:"column:rs_type_id" json:"rs_type_id"` Language string `gorm:"column:language" json:"language"` }
type ResourceFilter ¶
type ResourceFilter struct { RsFilterId string `gorm:"column:rs_filter_id" json:"rs_filter_id"` RsFilterName string `gorm:"column:rs_filter_name" json:"rs_filter_name"` RsFilterParam string `gorm:"column:rs_filter_param" json:"rs_filter_param"` Status string `gorm:"column:status" json:"status"` CreateTime time.Time `gorm:"column:create_time" json:"create_time"` UpdateTime time.Time `gorm:"column:update_time" json:"update_time"` RsTypeId string `gorm:"column:rs_type_id" json:"rs_type_id"` }
func NewResourceFilter ¶
func NewResourceFilter(rsFilterName string, rsFilterUri string, rsTypeId string) *ResourceFilter
type ResourceStatus ¶
type ResourceStatus struct { ResourceName string `gorm:"column:resource_name" json:"resource_name"` CurrentLevel string `json:"current_level"` PositiveCount uint32 `json:"positive_count"` CumulatedSendCount uint32 `json:"cumulated_send_count"` NextResendInterval uint32 `json:"next_resend_interval"` NextSendableTime string `json:"next_sendable_time"` AggregatedAlerts string `json:"aggregated_alerts"` }
type ResourceType ¶
type ResourceType struct { RsTypeId string `gorm:"column:rs_type_id" json:"rs_type_id"` RsTypeName string `gorm:"column:rs_type_name" json:"rs_type_name"` RsTypeParam string `gorm:"column:rs_type_param" json:"rs_type_param"` CreateTime time.Time `gorm:"column:create_time" json:"create_time"` UpdateTime time.Time `gorm:"column:update_time" json:"update_time"` }
func NewResourceType ¶
func NewResourceType(rsTypeName string, rsUriTmpl string) *ResourceType
type Rule ¶
type Rule struct { RuleId string `gorm:"column:rule_id" json:"rule_id"` RuleName string `gorm:"column:rule_name" json:"rule_name"` Disabled bool `gorm:"column:disabled" json:"disabled"` MonitorPeriods uint32 `gorm:"column:monitor_periods" json:"monitor_periods"` Severity string `gorm:"column:severity" json:"severity"` MetricsType string `gorm:"column:metrics_type" json:"metrics_type"` ConditionType string `gorm:"column:condition_type" json:"condition_type"` Thresholds string `gorm:"column:thresholds" json:"thresholds"` Unit string `gorm:"column:unit" json:"unit"` ConsecutiveCount uint32 `gorm:"column:consecutive_count" json:"consecutive_count"` Inhibit bool `gorm:"column:inhibit" json:"inhibit"` CreateTime time.Time `gorm:"column:create_time" json:"create_time"` UpdateTime time.Time `gorm:"column:update_time" json:"update_time"` PolicyId string `gorm:"column:policy_id" json:"policy_id"` MetricId string `gorm:"column:metric_id" json:"metric_id"` }
type RuleDetail ¶
type RuleDetail struct { RuleId string `gorm:"column:rule_id" json:"rule_id"` RuleName string `gorm:"column:rule_name" json:"rule_name"` Disabled bool `gorm:"column:disabled" json:"disabled"` MonitorPeriods uint32 `gorm:"column:monitor_periods" json:"monitor_periods"` Severity string `gorm:"column:severity" json:"severity"` MetricsType string `gorm:"column:metrics_type" json:"metrics_type"` ConditionType string `gorm:"column:condition_type" json:"condition_type"` Thresholds string `gorm:"column:thresholds" json:"thresholds"` MetricParam string `gorm:"column:metric_param" json:"metric_param"` Unit string `gorm:"column:unit" json:"unit"` ConsecutiveCount uint32 `gorm:"column:consecutive_count" json:"consecutive_count"` Inhibit bool `gorm:"column:inhibit" json:"inhibit"` CreateTime time.Time `gorm:"column:create_time" json:"create_time"` UpdateTime time.Time `gorm:"column:update_time" json:"update_time"` PolicyId string `gorm:"column:policy_id" json:"policy_id"` MetricId string `gorm:"column:metric_id" json:"metric_id"` }
Click to show internal directories.
Click to hide internal directories.