Documentation ¶
Index ¶
- Constants
- Variables
- func AsInteger(value interface{}) (int64, bool)
- func GenDisplayName(tpl *template.Template) string
- func GetAlarmStepTypes() []string
- func InterfaceToString(v interface{}) (string, error)
- func InterfaceToStringSlice(v interface{}) ([]string, error)
- func IsInfoValueValid(value interface{}) bool
- func NeedEntityLookup(collectionName string) bool
- func TransformEventTag(k, v string) string
- func TransformEventTags(eventTags map[string]string) []string
- type Alarm
- func (a *Alarm) AddChild(childEID string)
- func (a *Alarm) AddParent(parentEID string) bool
- func (a *Alarm) CanActivate() bool
- func (a *Alarm) Closable(d time.Duration) bool
- func (a *Alarm) CropSteps(cropNum int) bool
- func (a *Alarm) CurrentState() CpsNumber
- func (a *Alarm) GetAppliedActions() (steps AlarmSteps)
- func (a *Alarm) GetDurationField(f string) (int64, bool)
- func (a *Alarm) GetInfoVal(f string) (interface{}, bool)
- func (a *Alarm) GetIntField(f string) (int64, bool)
- func (a *Alarm) GetMetaAlarmInactiveExpiration(ruleId string) (datetime.CpsTime, bool)
- func (a *Alarm) GetRefField(f string) (interface{}, bool)
- func (a *Alarm) GetStringArrayField(f string) ([]string, bool)
- func (a *Alarm) GetStringField(f string) (string, bool)
- func (a *Alarm) GetTimeField(f string) (time.Time, bool)
- func (a *Alarm) HasChildByEID(childEID string) bool
- func (a *Alarm) HasParentByEID(parentEID string) bool
- func (a *Alarm) HasSingleAck() bool
- func (a *Alarm) HasUnlinkedParentByEID(parentEID string) bool
- func (a *Alarm) IsAck() bool
- func (a *Alarm) IsActivated() bool
- func (a *Alarm) IsCanceled() bool
- func (a *Alarm) IsInActivePeriod() bool
- func (a *Alarm) IsMalfunctioning() bool
- func (a *Alarm) IsMetaAlarm() bool
- func (a *Alarm) IsMetaChild() bool
- func (a *Alarm) IsResolved() bool
- func (a *Alarm) IsSnoozed() bool
- func (a *Alarm) IsStateLocked() bool
- func (a *Alarm) RemoveChild(childEID string)
- func (a *Alarm) RemoveParent(parentEID string) bool
- type AlarmChange
- type AlarmChangeType
- type AlarmStep
- type AlarmSteps
- func (s *AlarmSteps) Add(step AlarmStep) error
- func (s AlarmSteps) Crop(currentStatus *AlarmStep, cropNum int) (AlarmSteps, bool)
- func (s AlarmSteps) Last() (AlarmStep, error)
- func (s AlarmSteps) Len() int
- func (s AlarmSteps) Swap(i, j int)
- func (s AlarmSteps) UpdateStateCounter(currentStatus *AlarmStep, currentStatusIdx int, counter CropCounter) AlarmSteps
- type AlarmValue
- type AlarmWithEntity
- type AlarmWithEntityField
- type Author
- type ByTimestamp
- type Coordinates
- type CpsNumber
- type CropCounter
- type Entity
- type EntityComment
- type Event
- func (e *Event) Format()
- func (e *Event) GetCompatRK() string
- func (e *Event) GetEID() string
- func (e *Event) GetExtraInfoVal(f string) (interface{}, bool)
- func (e *Event) GetIntField(f string) (int64, bool)
- func (e *Event) GetLockID() string
- func (e *Event) GetPerfData(allowedUnits []string) []PerfData
- func (e *Event) GetRequiredKeys() []string
- func (e *Event) GetStringField(f string) (string, bool)
- func (e *Event) InjectExtraInfos(source []byte) error
- func (e *Event) IsContextable() bool
- func (e *Event) IsOnlyServiceUpdate() bool
- func (e *Event) IsPbehaviorEvent() bool
- func (e *Event) IsValid() error
- func (v Event) MarshalEasyJSON(w *jwriter.Writer)
- func (e *Event) SetField(name string, value interface{}) (err error)
- func (v *Event) UnmarshalEasyJSON(l *jlexer.Lexer)
- type Exdate
- type GenericEvent
- type Info
- type MetaAlarmInactiveDelay
- type OptionalBool
- type OptionalInt64
- type OptionalInterface
- type OptionalRegexp
- type OptionalString
- type OptionalStringArray
- type PbehaviorInfo
- func (i *PbehaviorInfo) GetStepMessage() string
- func (i *PbehaviorInfo) GetStringField(f string) (string, bool)
- func (i *PbehaviorInfo) Is(t string) bool
- func (i *PbehaviorInfo) IsActive() bool
- func (i *PbehaviorInfo) IsDefaultActive() bool
- func (i PbehaviorInfo) IsZero() bool
- func (i *PbehaviorInfo) OneOf(t []string) bool
- func (i PbehaviorInfo) Same(v PbehaviorInfo) bool
- type PerfData
- type StateInfo
- type TicketInfo
Constants ¶
const ( ActionTypeAck = EventTypeAck ActionTypeAckRemove = EventTypeAckremove ActionTypeAssocTicket = EventTypeAssocTicket ActionTypeCancel = EventTypeCancel ActionTypeChangeState = EventTypeChangestate ActionTypeSnooze = EventTypeSnooze ActionTypeUnsnooze = EventTypeUnsnooze ActionTypePbehavior = "pbehavior" ActionTypePbehaviorRemove = "pbehaviorremove" ActionTypeWebhook = "webhook" )
const ( AlarmStepsHardLimit = 2000 AlarmLongOutputHistoryLimit = 100 )
Alarm consts
const ( RuleNameScenarioPrefix = "Scenario: " RuleNameIdleRulePrefix = "Idle rule: " RuleNameDeclareTicketRulePrefix = "Ticket declaration rule: " RuleNameRulePrefix = "Rule: " OutputCommentPrefix = "Comment: " OutputTitlePrefix = "Title: " OutputComponentPrefix = "Component: " )
const ( InitiatorUser = "user" InitiatorSystem = "system" InitiatorExternal = "external" )
event initiators
const ( SourceTypeResource = "resource" SourceTypeComponent = "component" SourceTypeConnector = "connector" SourceTypeService = "service" SourceTypeMetaAlarm = "metaalarm" )
Source types
const ( EventTypeAck = "ack" EventTypeAckremove = "ackremove" EventTypeAssocTicket = "assocticket" EventTypeCancel = "cancel" EventTypeCheck = "check" EventTypeComment = "comment" EventTypeChangestate = "changestate" EventTypeSnooze = "snooze" EventTypeUnsnooze = "unsnooze" EventTypeUncancel = "uncancel" EventTypeDeclareTicketWebhook = "declareticketwebhook" EventTypeWebhookStarted = "webhookstarted" EventTypeWebhookCompleted = "webhookcompleted" EventTypeWebhookFailed = "webhookfailed" EventTypeAutoWebhookStarted = "autowebhookstarted" EventTypeAutoWebhookCompleted = "autowebhookcompleted" EventTypeAutoWebhookFailed = "autowebhookfailed" EventTypePbhEnter = "pbhenter" EventTypePbhLeaveAndEnter = "pbhleaveandenter" EventTypePbhLeave = "pbhleave" EventTypeResolveCancel = "resolve_cancel" EventTypeResolveClose = "resolve_close" EventTypeResolveDeleted = "resolve_deleted" EventTypeUpdateStatus = "updatestatus" EventTypeActivate = "activate" EventTypeRunDelayedScenario = "run_delayed_scenario" EventTypeMetaAlarm = "metaalarm" EventTypeMetaAlarmAttachChildren = "metaalarmattachchildren" EventTypeMetaAlarmDetachChildren = "metaalarmdetachchildren" EventTypeMetaAlarmUngroup = "metaalarm_ungroup" EventTypeMetaAlarmUpdate = "metaalarm_update" EventTypeManualMetaAlarmGroup = "manual_metaalarm_group" EventTypeManualMetaAlarmUngroup = "manual_metaalarm_ungroup" EventTypeManualMetaAlarmUpdate = "manual_metaalarm_update" // Following event types are used to add manual instruction execution to alarm steps. EventTypeInstructionStarted = "instructionstarted" EventTypeInstructionPaused = "instructionpaused" EventTypeInstructionResumed = "instructionresumed" EventTypeInstructionCompleted = "instructioncompleted" EventTypeInstructionFailed = "instructionfailed" // EventTypeInstructionAborted is the same for manual and auto instructions. EventTypeInstructionAborted = "instructionaborted" // Following event types are used to add auto instruction execution to alarm steps. EventTypeAutoInstructionStarted = "autoinstructionstarted" EventTypeAutoInstructionCompleted = "autoinstructioncompleted" EventTypeAutoInstructionFailed = "autoinstructionfailed" // Following event types are used to add job execution to alarm steps. Events are // the same for manual and auto instructions. EventTypeInstructionJobStarted = "instructionjobstarted" EventTypeInstructionJobCompleted = "instructionjobcompleted" EventTypeInstructionJobFailed = "instructionjobfailed" // EventTypeRecomputeEntityService is used to recompute service context graph and state. EventTypeRecomputeEntityService = "recomputeentityservice" // EventTypeEntityUpdated is used to notify engines that entity is updated out of // event flow. EventTypeEntityUpdated = "entityupdated" // EventTypeEntityToggled is used to notify engines that entity is enabled/disabled. EventTypeEntityToggled = "entitytoggled" EventTypeUpdateCounters = "updatecounters" // EventTypeJunitTestSuiteUpdated is used to notify that test suite is updated but state is not changed. EventTypeJunitTestSuiteUpdated = "junittestsuiteupdated" // EventTypeJunitTestCaseUpdated is used to notify that test case is updated but state is not changed. EventTypeJunitTestCaseUpdated = "junittestcaseeupdated" // EventTypeNoEvents is used to create alarm for entity by idle rule. EventTypeNoEvents = "noevents" // EventTypeTrigger is used in axe rpc to send auto and manual instruction triggers EventTypeTrigger = "trigger" // EventTypeAutoInstructionActivate is used to activate alarm when an autoremediation triggered by create trigger is completed EventTypeAutoInstructionActivate = "autoinstructionactivate" EventTypeMetaAlarmChildActivate = "metaalarmchildactivate" EventTypeMetaAlarmChildDeactivate = "metaalarmchilddeactivate" )
Event types. Add each new event type to isValidEventType func.
const ( AlarmStateOK = iota AlarmStateMinor AlarmStateMajor AlarmStateCritical )
Alarm states
const ( AlarmStateTitleOK = "ok" AlarmStateTitleMinor = "minor" AlarmStateTitleMajor = "major" AlarmStateTitleCritical = "critical" )
const ( AlarmStatusOff = iota AlarmStatusOngoing AlarmStatusStealthy AlarmStatusFlapping AlarmStatusCancelled AlarmStatusNoEvents )
Alarm statuses
const ( AlarmStatusTitleOff = "off" AlarmStatusTitleOngoing = "ongoing" AlarmStatusTitleStealthy = "stealthy" AlarmStatusTitleFlapping = "flapping" AlarmStatusTitleCancelled = "cancelled" )
const ( AlarmStepStateIncrease = "stateinc" AlarmStepStateDecrease = "statedec" AlarmStepStatusIncrease = "statusinc" AlarmStepStatusDecrease = "statusdec" AlarmStepAck = "ack" AlarmStepAckRemove = "ackremove" AlarmStepComment = "comment" AlarmStepSnooze = "snooze" AlarmStepUnsnooze = "unsnooze" AlarmStepStateCounter = "statecounter" AlarmStepChangeState = "changestate" AlarmStepPbhEnter = "pbhenter" AlarmStepPbhLeave = "pbhleave" AlarmStepMetaAlarmAttach = "metaalarmattach" AlarmStepMetaAlarmDetach = "metaalarmdetach" AlarmStepActivate = "activate" AlarmStepResolve = "resolve" AlarmStepAssocTicket = "assocticket" AlarmStepDeclareTicket = "declareticket" AlarmStepDeclareTicketFail = "declareticketfail" AlarmStepWebhookStart = "webhookstart" AlarmStepWebhookComplete = "webhookcomplete" AlarmStepWebhookFail = "webhookfail" // Following alarm steps are used for manual instruction execution. AlarmStepInstructionStart = "instructionstart" AlarmStepInstructionPause = "instructionpause" AlarmStepInstructionResume = "instructionresume" AlarmStepInstructionComplete = "instructioncomplete" AlarmStepInstructionFail = "instructionfail" // AlarmStepInstructionAbort are used for manual and auto instruction execution. AlarmStepInstructionAbort = "instructionabort" // Following alarm steps are used for manual instruction execution. AlarmStepAutoInstructionStart = "autoinstructionstart" AlarmStepAutoInstructionComplete = "autoinstructioncomplete" AlarmStepAutoInstructionFail = "autoinstructionfail" // Following alarm steps are used for junit. AlarmStepJunitTestSuiteUpdate = "junittestsuiteupdate" AlarmStepJunitTestCaseUpdate = "junittestcaseupdate" )
Alarm steps
const ( EntityTypeConnector = "connector" EntityTypeComponent = "component" EntityTypeResource = "resource" EntityTypeService = "service" )
Entity types
const EntityDefaultImpactLevel = 1
const MinimalEventsCountThreshold = 2
const PbhCanonicalTypeActive = "active"
PbhCanonicalTypeActive is duplicate of pbehavior.TypeActive because of package cycle. todo: move type constants from pbehavior package to types package
Variables ¶
Functions ¶
func AsInteger ¶
AsInteger tries to convert an interface{} into an int64, and returns its value and an integer indicating whether it succeeded or not.
It works with int, uint, int64, uint64, CpsNumber and CpsTime (in this case, a unix timestamp is returned).
func InterfaceToString ¶
InterfaceToString tries to convert v to it's string value. Supported types: * float64 * string * bool * int|int64|uint|uint64 * []interface{} : join elements with "," * nil: will return empty string
Any other type will return empty string and an error, like lists or maps...
Types ¶
type Alarm ¶
type Alarm struct { ID string `bson:"_id" json:"_id"` Time datetime.CpsTime `bson:"t" json:"t"` EntityID string `bson:"d" json:"d"` Tags []string `bson:"tags,omitempty" json:"tags,omitempty"` ExternalTags []string `bson:"etags,omitempty" json:"etags,omitempty"` InternalTags []string `bson:"itags,omitempty" json:"itags,omitempty"` InternalTagsUpdated datetime.MicroTime `bson:"itags_upd" json:"itags_upd"` // todo move all field from Value to Alarm Value AlarmValue `bson:"v" json:"v"` // is used only for manual instructions KPI metrics KpiAssignedInstructions []string `bson:"kpi_assigned_instructions,omitempty" json:"kpi_assigned_instructions,omitempty"` KpiExecutedInstructions []string `bson:"kpi_executed_instructions,omitempty" json:"kpi_executed_instructions,omitempty"` // is used only for auto instructions KPI metrics KpiAssignedAutoInstructions []string `bson:"kpi_assigned_auto_instructions,omitempty" json:"kpi_assigned_auto_instructions,omitempty"` KpiExecutedAutoInstructions []string `bson:"kpi_executed_auto_instructions,omitempty" json:"kpi_executed_auto_instructions,omitempty"` // is used only for not acked metrics NotAckedMetricType string `bson:"not_acked_metric_type,omitempty" json:"-"` NotAckedMetricSendTime *datetime.CpsTime `bson:"not_acked_metric_send_time,omitempty" json:"-"` NotAckedSince *datetime.CpsTime `bson:"not_acked_since,omitempty" json:"-"` // InactiveAutoInstructionInProgress shows that autoremediation is launched and alarm is not active until the remediation is finished InactiveAutoInstructionInProgress bool `bson:"auto_instruction_in_progress,omitempty" json:"auto_instruction_in_progress,omitempty"` InactiveDelayMetaAlarmInProgress bool `bson:"inactive_delay_meta_alarm_in_progress,omitempty" json:"inactive_delay_meta_alarm_in_progress,omitempty"` // MetaAlarmInactiveDelay shows that an alarm is matched to some meta alarm rules with child_inactive_delay MetaAlarmInactiveDelay []MetaAlarmInactiveDelay `bson:"meta_alarm_inactive_delay,omitempty" json:"meta_alarm_inactive_delay,omitempty"` Healthcheck bool `bson:"healthcheck,omitempty" json:"-"` }
Alarm represents an alarm document.
func (*Alarm) Closable ¶
Closable checks the last step for it's state to be OK for at least d interval. Reference time is time.Now() when this function is called.
func (*Alarm) CropSteps ¶
CropSteps calls Crop() on Alarm.Value.Steps with alarm parameters. returns true if the alarm was modified.
func (*Alarm) CurrentState ¶
CurrentState returns the Current State of the Alarm
func (*Alarm) GetAppliedActions ¶
func (a *Alarm) GetAppliedActions() (steps AlarmSteps)
GetAppliedActions fetches applied to alarm actions: ACK, Snooze, AssocTicket, DeclareTicket Result is in a sorted by timestamp AlarmSteps, ticket data when defined
func (*Alarm) GetDurationField ¶
GetDurationField is a magic getter for duration fields for easier field retrieving when matching alarm pattern
func (*Alarm) GetInfoVal ¶
GetInfoVal is a magic getter for infos fields for easier field retrieving when matching alarm pattern
func (*Alarm) GetIntField ¶
GetIntField is a magic getter for int fields for easier field retrieving when matching alarm pattern
func (*Alarm) GetMetaAlarmInactiveExpiration ¶
func (*Alarm) GetRefField ¶
GetRefField is a magic getter for reference fields for easier field retrieving when matching alarm pattern
func (*Alarm) GetStringArrayField ¶
GetStringArrayField is a magic getter for string array fields for easier field retrieving when matching alarm pattern
func (*Alarm) GetStringField ¶
GetStringField is a magic getter for string fields for easier field retrieving when matching alarm pattern
func (*Alarm) GetTimeField ¶
GetTimeField is a magic getter for time fields for easier field retrieving when matching alarm pattern
func (*Alarm) HasSingleAck ¶
HasSingleAck returns true if the alarm has been acknowledged exactly once. Note that this method will return false if the alarm has received a first ack, an ackremove, and a second ack. It should be used to run actions on the first acknowledgement only.
func (*Alarm) HasUnlinkedParentByEID ¶
func (*Alarm) IsCanceled ¶
IsCanceled check if an Alarm is canceled
func (*Alarm) IsResolved ¶
IsResolved tell if an alarm has been resolved
func (*Alarm) IsStateLocked ¶
IsStateLocked checks that the Alarm is not Locked (by manual intervention for example)
type AlarmChange ¶
type AlarmChange struct { Type AlarmChangeType `json:"Type"` PreviousState CpsNumber `json:"PreviousState"` PreviousStateChange datetime.CpsTime `json:"PreviousStateChange"` PreviousStatus CpsNumber `json:"PreviousStatus"` PreviousStatusChange datetime.CpsTime `json:"PreviousStatusChange"` PreviousPbehaviorTime *datetime.CpsTime `json:"PreviousPbehaviorTime"` PreviousEntityPbehaviorTime *datetime.CpsTime `json:"PreviousEntityPbehaviorTime"` PreviousPbehaviorTypeID string `json:"PreviousPbehaviorTypeID"` PreviousPbehaviorCannonicalType string `json:"PreviousPbehaviorCannonicalType"` EventsCount int `json:"EventsCount"` }
AlarmChange is a struct containing the type of change that occurred on an alarm, as well as its previous state.
func NewAlarmChange ¶
func NewAlarmChange() AlarmChange
func NewAlarmChangeByAlarm ¶
func NewAlarmChangeByAlarm(alarm Alarm, t ...AlarmChangeType) AlarmChange
func (*AlarmChange) GetTriggers ¶
func (ac *AlarmChange) GetTriggers() []string
func (*AlarmChange) IsZero ¶
func (ac *AlarmChange) IsZero() bool
type AlarmChangeType ¶
type AlarmChangeType string
AlarmChangeType is a type representing a change that can occur on an alarm.
const ( AlarmChangeTypeNone AlarmChangeType = "" AlarmChangeTypeStateIncrease AlarmChangeType = "stateinc" AlarmChangeTypeStateDecrease AlarmChangeType = "statedec" AlarmChangeTypeCreate AlarmChangeType = "create" AlarmChangeTypeCreateAndPbhEnter AlarmChangeType = "createandpbhenter" AlarmChangeTypeAck AlarmChangeType = "ack" AlarmChangeTypeDoubleAck AlarmChangeType = "doubleack" AlarmChangeTypeAckremove AlarmChangeType = "ackremove" AlarmChangeTypeCancel AlarmChangeType = "cancel" AlarmChangeTypeUncancel AlarmChangeType = "uncancel" AlarmChangeTypeAssocTicket AlarmChangeType = "assocticket" AlarmChangeTypeSnooze AlarmChangeType = "snooze" AlarmChangeTypeUnsnooze AlarmChangeType = "unsnooze" AlarmChangeTypeResolve AlarmChangeType = "resolve" AlarmChangeTypeComment AlarmChangeType = "comment" AlarmChangeTypeChangeState AlarmChangeType = "changestate" AlarmChangeTypePbhEnter AlarmChangeType = "pbhenter" AlarmChangeTypePbhLeave AlarmChangeType = "pbhleave" AlarmChangeTypePbhLeaveAndEnter AlarmChangeType = "pbhleaveandenter" AlarmChangeTypeUpdateStatus AlarmChangeType = "changestatus" AlarmChangeTypeActivate AlarmChangeType = "activate" AlarmChangeTypeWebhookStart AlarmChangeType = "webhookstart" AlarmChangeTypeWebhookComplete AlarmChangeType = "webhookcomplete" AlarmChangeTypeWebhookFail AlarmChangeType = "webhookfail" AlarmChangeTypeDeclareTicketWebhook AlarmChangeType = "declareticketwebhook" AlarmChangeTypeDeclareTicketWebhookFail AlarmChangeType = "declareticketwebhookfail" AlarmChangeTypeAutoWebhookStart AlarmChangeType = "autowebhookstart" AlarmChangeTypeAutoWebhookComplete AlarmChangeType = "autowebhookcomplete" AlarmChangeTypeAutoWebhookFail AlarmChangeType = "autowebhookfail" AlarmChangeTypeAutoDeclareTicketWebhook AlarmChangeType = "autodeclareticketwebhook" AlarmChangeTypeAutoDeclareTicketWebhookFail AlarmChangeType = "autodeclareticketwebhookfail" // Following change types are used for manual instruction execution. AlarmChangeTypeInstructionStart AlarmChangeType = "instructionstart" AlarmChangeTypeInstructionPause AlarmChangeType = "instructionpause" AlarmChangeTypeInstructionResume AlarmChangeType = "instructionresume" AlarmChangeTypeInstructionComplete AlarmChangeType = "instructioncomplete" AlarmChangeTypeInstructionFail AlarmChangeType = "instructionfail" // AlarmChangeTypeInstructionAbort is used for manual and auto instruction execution. AlarmChangeTypeInstructionAbort AlarmChangeType = "instructionabort" // Following change types are used for auto instruction execution. AlarmChangeTypeAutoInstructionStart AlarmChangeType = "autoinstructionstart" AlarmChangeTypeAutoInstructionComplete AlarmChangeType = "autoinstructioncomplete" AlarmChangeTypeAutoInstructionFail AlarmChangeType = "autoinstructionfail" // Following change types are used for auto instruction triggers. AlarmChangeTypeAutoInstructionResultOk AlarmChangeType = "autoinstructionresultok" AlarmChangeTypeAutoInstructionResultFail AlarmChangeType = "autoinstructionresultfail" // Following change types are used for job execution. AlarmChangeTypeInstructionJobStart AlarmChangeType = "instructionjobstart" AlarmChangeTypeInstructionJobComplete AlarmChangeType = "instructionjobcomplete" AlarmChangeTypeInstructionJobFail AlarmChangeType = "instructionjobfail" // Following change types are used for junit. AlarmChangeTypeJunitTestSuiteUpdate AlarmChangeType = "junittestsuiteupdate" AlarmChangeTypeJunitTestCaseUpdate AlarmChangeType = "junittestcaseupdate" AlarmChangeTypeEnabled AlarmChangeType = "enabled" // AlarmChangeTypeAutoInstructionActivate is used to activate alarm when an autoremediation triggered by create trigger is completed AlarmChangeTypeAutoInstructionActivate AlarmChangeType = "autoinstructionactivate" // AlarmChangeEventsCount is used for eventscount trigger and alarm's events_count value should be added to the end of a trigger name, e.g. "eventscount3" AlarmChangeEventsCount AlarmChangeType = "eventscount" AlarmChangeTypeMetaAlarmChildActivate AlarmChangeType = "metaalarmchildactivate" AlarmChangeTypeMetaAlarmChildDeactivate AlarmChangeType = "metaalarmchilddeactivate" )
An AlarmChangeType can have the following values:
type AlarmStep ¶
type AlarmStep struct { Type string `bson:"_t" json:"_t"` Timestamp datetime.CpsTime `bson:"t" json:"t"` Author string `bson:"a" json:"a"` UserID string `bson:"user_id,omitempty" json:"user_id,omitempty"` Message string `bson:"m" json:"m"` Role string `bson:"role,omitempty" json:"role,omitempty"` Value CpsNumber `bson:"val" json:"val"` StateCounter CropCounter `bson:"statecounter,omitempty" json:"statecounter,omitempty"` PbehaviorCanonicalType string `bson:"pbehavior_canonical_type,omitempty" json:"pbehavior_canonical_type,omitempty"` IconName string `bson:"icon_name,omitempty" json:"icon_name,omitempty"` Color string `bson:"color,omitempty" json:"color,omitempty"` Initiator string `bson:"initiator,omitempty" json:"initiator,omitempty"` // Execution contains id // - of instruction execution for instruction steps // - of webhook execution for webhook steps Execution string `bson:"exec,omitempty" json:"exec,omitempty"` TicketInfo `bson:",inline"` DisplayGroup string `bson:"dgroup,omitempty" json:"dgroup,omitempty"` InPbehaviorInterval bool `bson:"in_pbh,omitempty" json:"in_pbh,omitempty"` }
AlarmStep represents a generic step used in an alarm.
func NewAlarmStep ¶
func NewAlarmStep( stepType string, timestamp datetime.CpsTime, author, msg, userID, role, initiator string, inPbehaviorInterval bool, ) AlarmStep
NewAlarmStep returns an AlarmStep. If the timestamp or author are empty, default values will be used to create an AlarmStep.
func NewPbhAlarmStep ¶
type AlarmSteps ¶
type AlarmSteps []AlarmStep
AlarmSteps is a sortable implementation of []*AlarmStep. Used for sorting steps in some functions. Implements sort.Interface
func (*AlarmSteps) Add ¶
func (s *AlarmSteps) Add(step AlarmStep) error
Add handle adding a step to the list
func (AlarmSteps) Crop ¶
func (s AlarmSteps) Crop(currentStatus *AlarmStep, cropNum int) (AlarmSteps, bool)
Crop steps by replacing stateinc and statedec steps after the current status with a statecounter step Returns :
- the updated alarm steps
- True if it was updated, false else
param currentStatus: the current status of the alarm. The steps will be cropped from this status param cropNum: crop only if we have at least cropNum steps with type AlarmStepStateIncrease or AlarmStepStateDecrease
func (AlarmSteps) Last ¶
func (s AlarmSteps) Last() (AlarmStep, error)
Last returns the last step, if any, or returns an error.
func (AlarmSteps) Len ¶
func (s AlarmSteps) Len() int
func (AlarmSteps) Swap ¶
func (s AlarmSteps) Swap(i, j int)
func (AlarmSteps) UpdateStateCounter ¶
func (s AlarmSteps) UpdateStateCounter(currentStatus *AlarmStep, currentStatusIdx int, counter CropCounter) AlarmSteps
UpdateStateCounter updates the alarm steps with the statecounter step Returns the updated AlarmSteps and the updated (or newly created) statecounter step. param currentStatus: the current status of the alarm. The statecounter step infos will come from it. param currentStatusIdx: the alarm current status' index. It is used to insert or update the statecounter step right after it. param counter: the crop counter to update or create the statecounter step from.
type AlarmValue ¶
type AlarmValue struct { ACK *AlarmStep `bson:"ack,omitempty" json:"ack,omitempty"` Canceled *AlarmStep `bson:"canceled,omitempty" json:"canceled,omitempty"` Snooze *AlarmStep `bson:"snooze,omitempty" json:"snooze,omitempty"` State *AlarmStep `bson:"state,omitempty" json:"state,omitempty"` Status *AlarmStep `bson:"status,omitempty" json:"status,omitempty"` LastComment *AlarmStep `bson:"last_comment,omitempty" json:"last_comment,omitempty"` ChangeState *AlarmStep `bson:"change_state,omitempty" json:"change_state,omitempty"` Tickets []AlarmStep `bson:"tickets,omitempty" json:"tickets,omitempty"` // Ticket contains the last created ticket Ticket *AlarmStep `bson:"ticket,omitempty" json:"ticket,omitempty"` Steps AlarmSteps `bson:"steps" json:"steps"` Component string `bson:"component" json:"component"` Connector string `bson:"connector" json:"connector"` ConnectorName string `bson:"connector_name" json:"connector_name"` CreationDate datetime.CpsTime `bson:"creation_date" json:"creation_date"` ActivationDate *datetime.CpsTime `bson:"activation_date,omitempty" json:"activation_date,omitempty"` DisplayName string `bson:"display_name" json:"display_name"` HardLimit *CpsNumber `bson:"hard_limit,omitempty" json:"hard_limit,omitempty"` InitialOutput string `bson:"initial_output" json:"initial_output"` Output string `bson:"output" json:"output"` InitialLongOutput string `bson:"initial_long_output" json:"initial_long_output"` LongOutput string `bson:"long_output" json:"long_output"` LongOutputHistory []string `bson:"long_output_history" json:"long_output_history"` LastUpdateDate datetime.CpsTime `bson:"last_update_date" json:"last_update_date"` LastEventDate datetime.CpsTime `bson:"last_event_date" json:"last_event_date"` Resource string `bson:"resource,omitempty" json:"resource,omitempty"` Resolved *datetime.CpsTime `bson:"resolved,omitempty" json:"resolved,omitempty"` PbehaviorInfo PbehaviorInfo `bson:"pbehavior_info,omitempty" json:"pbehavior_info,omitempty"` Meta string `bson:"meta,omitempty" json:"meta,omitempty"` MetaValuePath string `bson:"meta_value_path,omitempty" json:"meta_value_path,omitempty"` Parents []string `bson:"parents" json:"parents"` Children []string `bson:"children" json:"children"` UnlinkedParents []string `bson:"unlinked_parents" json:"unlinked_parents"` StateChangesSinceStatusUpdate CpsNumber `bson:"state_changes_since_status_update,omitempty" json:"state_changes_since_status_update,omitempty"` TotalStateChanges CpsNumber `bson:"total_state_changes,omitempty" json:"total_state_changes,omitempty"` // EventsCount accumulates count of check events. EventsCount CpsNumber `bson:"events_count,omitempty" json:"events_count,omitempty"` Infos map[string]map[string]interface{} `bson:"infos" json:"infos"` // store version of dynamic-infos rule RuleVersion map[string]string `bson:"infos_rule_version" json:"infos_rule_version"` // InactiveStart represents start of snooze or maintenance, pause, inactive pbehavior interval. // It's used only to compute InactiveDuration. InactiveStart *datetime.CpsTime `bson:"inactive_start,omitempty" json:"inactive_start"` // Duration represents a duration from creation date to resolve date. // Keep omitempty. Duration int64 `bson:"duration,omitempty" json:"duration"` // CurrentStateDuration represents a duration when an alarm was in current state. // Keep omitempty. CurrentStateDuration int64 `bson:"current_state_duration,omitempty" json:"current_state_duration"` // ActiveDuration represents a duration when an alarm wasn't in snooze or in maintenance, pause, inactive pbehavior interval. // Keep omitempty. ActiveDuration int64 `bson:"active_duration,omitempty" json:"active_duration"` // InactiveDuration represents a duration when an alarm was in snooze or in maintenance, pause, inactive pbehavior interval. InactiveDuration int64 `bson:"inactive_duration" json:"inactive_duration"` // SnoozeDuration represents a duration when an alarm was in snooze. SnoozeDuration int64 `bson:"snooze_duration" json:"snooze_duration"` // PbehaviorInactiveDuration represents a duration when an alarm was in maintenance, pause, inactive pbehavior interval. PbehaviorInactiveDuration int64 `bson:"pbh_inactive_duration" json:"pbh_inactive_duration"` }
AlarmValue represents a full description of an alarm.
func (*AlarmValue) Transform ¶
func (v *AlarmValue) Transform()
type AlarmWithEntity ¶
type AlarmWithEntity struct { Alarm Alarm `bson:"alarm" json:"alarm"` Entity Entity `bson:"entity" json:"entity"` }
AlarmWithEntity is an encapsulated type, mostly to facilitate the alarm manipulation for the post-processors
type AlarmWithEntityField ¶
AlarmWithEntityField is used to store an alarm with it's entity in the database. Use Alarm in all other cases.
type Author ¶
type Author struct { ID string `bson:"_id" json:"_id"` DisplayName string `bson:"display_name" json:"display_name"` }
Author in contrary to the author.Author struct without Name field
type ByTimestamp ¶
type ByTimestamp struct {
AlarmSteps
}
func (ByTimestamp) Less ¶
func (s ByTimestamp) Less(i, j int) bool
type Coordinates ¶
type Coordinates struct { Lat float64 `bson:"lat" json:"lat" binding:"required,latitude"` Lng float64 `bson:"lng" json:"lng" binding:"required,longitude"` }
func (Coordinates) IsZero ¶
func (c Coordinates) IsZero() bool
type CpsNumber ¶
type CpsNumber int64
CpsNumber is here for compatibility with old python engines. It will force an int64 from a float64.
func (CpsNumber) CpsTimestamp ¶
CpsTimestamp convert a number to a timestamp
func (CpsNumber) MarshalJSON ¶
MarshalJSON implements json.Encoder interface
type CropCounter ¶
type CropCounter struct { StateChanges int `bson:"statechanges" json:"statechanges"` Stateinc int `bson:"stateinc" json:"stateinc"` Statedec int `bson:"statedec" json:"statedec"` StateInfo int `bson:"state:0,omitempty" json:"state:0,omitempty"` StateMinor int `bson:"state:1,omitempty" json:"state:1,omitempty"` StateMajor int `bson:"state:2,omitempty" json:"state:2,omitempty"` StateCritical int `bson:"state:3,omitempty" json:"state:3,omitempty"` }
CropCounter provides an explicit way of counting the steps that were cropped.
func (CropCounter) IsZero ¶
func (counter CropCounter) IsZero() bool
func (*CropCounter) MergeCounter ¶
func (counter *CropCounter) MergeCounter(secondCounter CropCounter)
MergeCounter merges the current counter with the provided counter and returns the merged counter.
func (*CropCounter) UpdateWithStep ¶
func (counter *CropCounter) UpdateWithStep(step AlarmStep)
UpdateWithStep updates the CropCounter with the provided step informations.
type Entity ¶
type Entity struct { ID string `bson:"_id" json:"_id"` Name string `bson:"name" json:"name"` Author string `bson:"author,omitempty" json:"author,omitempty"` Description string `bson:"description" json:"description"` EnableHistory []datetime.CpsTime `bson:"enable_history" json:"enable_history"` Measurements interface{} `bson:"measurements" json:"measurements"` // unused collection ids Enabled bool `bson:"enabled" json:"enabled"` Infos map[string]Info `bson:"infos" json:"infos"` ComponentInfos map[string]Info `bson:"component_infos,omitempty" json:"component_infos,omitempty"` Type string `bson:"type" json:"type"` Category string `bson:"category" json:"category"` ImpactLevel int64 `bson:"impact_level" json:"impact_level"` Created datetime.CpsTime `bson:"created" json:"created"` Updated *datetime.CpsTime `bson:"updated,omitempty" json:"updated,omitempty"` LastEventDate *datetime.CpsTime `bson:"last_event_date,omitempty" json:"last_event_date,omitempty"` Connector string `bson:"connector,omitempty" json:"connector,omitempty"` Component string `bson:"component,omitempty" json:"component,omitempty"` // ImpactedServices field is only for connectors, see entity service RecomputeIdleSince method. ImpactedServices []string `bson:"impacted_services" json:"-"` // LastIdleRuleApply is used to mark entity if some idle rule was applied. LastIdleRuleApply string `bson:"last_idle_rule_apply,omitempty" json:"last_idle_rule_apply,omitempty"` // IdleSince represents since when entity didn't receive any events. IdleSince *datetime.CpsTime `bson:"idle_since,omitempty" json:"idle_since,omitempty"` ImportSource string `bson:"import_source,omitempty" json:"import_source"` Imported *datetime.CpsTime `bson:"imported,omitempty" json:"imported"` PbehaviorInfo PbehaviorInfo `bson:"pbehavior_info,omitempty" json:"pbehavior_info,omitempty"` LastPbehaviorDate *datetime.CpsTime `bson:"last_pbehavior_date,omitempty" json:"last_pbehavior_date,omitempty"` SliAvailState int64 `bson:"sli_avail_state" json:"sli_avail_state"` Services []string `bson:"services" json:"services,omitempty"` ServicesToAdd []string `bson:"services_to_add,omitempty" json:"services_to_add,omitempty"` ServicesToRemove []string `bson:"services_to_remove,omitempty" json:"services_to_remove,omitempty"` // Coordinates is used only in api, add json tag if it's required in an event. Coordinates Coordinates `bson:"coordinates,omitempty" json:"-"` // SoftDeleted is used to recompute service counters after dependency delete. SoftDeleted *datetime.CpsTime `bson:"soft_deleted,omitempty" json:"soft_deleted,omitempty"` // ResolveDeletedEventProcessed is set after processing service counters recalculation event on soft delete. ResolveDeletedEventProcessed *datetime.CpsTime `bson:"resolve_deleted_event_processed,omitempty" json:"resolve_deleted_event_processed,omitempty"` PerfData []string `bson:"perf_data,omitempty" json:"-"` PerfDataUpdated *datetime.CpsTime `bson:"perf_data_updated,omitempty" json:"-"` // IsNew and IsUpdated used in engine che in entity creation and eventfilter IsNew bool `bson:"-" json:"-"` IsUpdated bool `bson:"-" json:"-"` Healthcheck bool `bson:"healthcheck,omitempty" json:"-"` StateInfo *StateInfo `bson:"state_info" json:"state_info"` ComponentStateSettings bool `bson:"component_state_settings,omitempty" json:"component_state_settings,omitempty"` ComponentStateSettingsToAdd bool `bson:"component_state_settings_to_add,omitempty" json:"component_state_settings_to_add,omitempty"` ComponentStateSettingsToRemove bool `bson:"component_state_settings_to_remove,omitempty" json:"component_state_settings_to_remove,omitempty"` Comments []EntityComment `bson:"comments,omitempty" json:"comments,omitempty"` LastComment *EntityComment `bson:"last_comment,omitempty" json:"last_comment,omitempty"` }
Entity ...
func (*Entity) EnsureInitialized ¶
func (e *Entity) EnsureInitialized()
EnsureInitialized verifies that all complex structs are well initialized
func (*Entity) GetInfoVal ¶
GetInfoVal is a magic getter for infos fields for easier field retrieving when matching entity pattern
func (*Entity) GetIntField ¶
GetIntField is a magic getter for int fields for easier field retrieving when matching entity pattern
func (*Entity) GetStringField ¶
GetStringField is a magic getter for string fields for easier field retrieving when matching entity pattern
type EntityComment ¶
type Event ¶
type Event struct { ID *string `bson:"_id" json:"_id"` Connector string `bson:"connector" json:"connector"` ConnectorName string `bson:"connector_name" json:"connector_name"` EventType string `bson:"event_type" json:"event_type"` Component string `bson:"component" json:"component"` Resource string `bson:"resource" json:"resource"` PerfData string `bson:"perf_data" json:"perf_data"` Status *CpsNumber `bson:"status" json:"status"` SourceType string `bson:"source_type" json:"source_type"` LongOutput string `bson:"long_output" json:"long_output"` State CpsNumber `bson:"state" json:"state"` Output string `bson:"output" json:"output"` Alarm *Alarm `bson:"current_alarm" json:"current_alarm"` Entity *Entity `bson:"current_entity" json:"current_entity"` // AlarmID is used if an event is emitted for the specific alarm. AlarmID string `bson:"aid,omitempty" json:"aid,omitempty"` Author string `bson:"author" json:"author"` UserID string `bson:"user_id" json:"user_id"` Timestamp datetime.CpsTime `bson:"timestamp" json:"timestamp"` ReceivedTimestamp datetime.MicroTime `bson:"rt" json:"rt"` RK string `bson:"routing_key" json:"routing_key"` Duration CpsNumber `bson:"duration,omitempty" json:"duration,omitempty"` StatName string `bson:"stat_name" json:"stat_name"` Debug bool `bson:"debug" json:"debug"` Role string `bson:"role,omitempty" json:"role,omitempty"` ExtraInfos map[string]interface{} `bson:"extra_infos" json:"extra"` AlarmChange *AlarmChange `bson:"alarm_change" json:"alarm_change"` // Ticket related fields TicketInfo `bson:",inline"` // Tags contains external tags for alarm. Tags map[string]string `bson:"tags" json:"tags"` MetaAlarmRuleID string `bson:"metaalarm_rule_id,omitempty" json:"metaalarm_rule_id,omitempty"` MetaAlarmValuePath string `bson:"metaalarm_value_path,omitempty" json:"metaalarm_value_path,omitempty"` MetaAlarmParents []string `bson:"ma_parents,omitempty" json:"ma_parents,omitempty"` MetaAlarmChildren []string `bson:"ma_children,omitempty" json:"ma_children,omitempty"` // ManualMetaAlarmAutoResolve is used for manual meta alarms. ManualMetaAlarmAutoResolve bool `bson:"manual_meta_alarm_auto_resolve,omitempty" json:"manual_meta_alarm_auto_resolve,omitempty"` // DisplayName is used for manual meta alarms. DisplayName string `bson:"display_name,omitempty" json:"display_name,omitempty"` PbehaviorInfo PbehaviorInfo `bson:"pbehavior_info" json:"pbehavior_info"` // Initiator is used to detect who emits event. // InitiatorUser - UI // InitiatorSystem - engines // InitiatorExternal - third tool Initiator string `bson:"initiator" json:"initiator"` // Only for EventTypeRunDelayedScenario DelayedScenarioID string `bson:"delayed_scenario_id,omitempty" json:"delayed_scenario_id,omitempty"` DelayedScenarioData string `bson:"delayed_scenario_data,omitempty" json:"delayed_scenario_data,omitempty"` // AddedToServices contains ids of entity services to which entity has been added as dependency. AddedToServices []string `bson:"added_to_services,omitempty" json:"added_to_services,omitempty"` // RemovedFromServices contains ids of entity services from which entity has been removed as dependency. RemovedFromServices []string `bson:"removed_from_services,omitempty" json:"removed_from_services,omitempty"` // IdleRuleApply is used if event is emitted by idle rule. IdleRuleApply string `bson:"idle_rule_apply,omitempty" json:"idle_rule_apply,omitempty"` // Execution is used only for instruction events: EventTypeInstructionStarted, EventTypeInstructionCompleted, etc.. Execution string `bson:"execution,omitempty" json:"execution,omitempty"` // Instruction is used only for manual instructions kpi metrics Instruction string `bson:"instruction,omitempty" json:"instruction,omitempty"` // IsMetaAlarmUpdated is true if an alarm is added to a meta alarm on an event. IsMetaAlarmUpdated bool `bson:"ma_updated,omitempty" json:"ma_updated,omitempty"` // IsInstructionMatched is true if an alarm is matched to an auto instruction on an event. IsInstructionMatched bool `bson:"instr_matched,omitempty" json:"instr_matched,omitempty"` Healthcheck bool `bson:"healthcheck,omitempty" json:"healthcheck,omitempty"` StateSettingUpdated bool `bson:"state_setting_updated,omitempty" json:"state_setting_updated,omitempty"` }
Event represents a canopsis event.
func (*Event) Format ¶
func (e *Event) Format()
Format an event
"timestamp" is fill with time.Now() "event_type" is fill with EventTypeCheck
func (*Event) GetCompatRK ¶
GetCompatRK returns the event routing key. For compatibility only with old engines.
func (*Event) GetExtraInfoVal ¶
GetExtraInfoVal is a magic getter for extra infos fields for easier field retrieving when matching event pattern
func (*Event) GetIntField ¶
GetIntField is a magic getter for int fields for easier field retrieving when matching event pattern
func (*Event) GetLockID ¶
GetLockID returns lock name that used to block alarm
func (*Event) GetRequiredKeys ¶
GetRequiredKeys read all declared json tags in the struct
func (*Event) GetStringField ¶
GetStringField is a magic getter for string fields for easier field retrieving when matching event pattern
func (*Event) InjectExtraInfos ¶
InjectExtraInfos takes the raw JSON event document and puts any unknown field into Event.ExtraInfos
func (*Event) IsContextable ¶
IsContextable tells you if the given event can lead to context enrichment.
func (*Event) IsValid ¶
IsValid checks if an Event is valid for Canopsis processing.
func (Event) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (*Event) SetField ¶
SetField sets the value of a field of an event given its name.
type Exdate ¶
type GenericEvent ¶
type GenericEvent struct {
Content interface{}
}
GenericEvent contains an interface so you can do this: body := `<a json document>` var gevent GenericEvent json.Unmarshal(body, &gevent.Content) gevent.PartialID(<rules>)
func (*GenericEvent) JSONUnmarshal ¶
func (e *GenericEvent) JSONUnmarshal(body []byte) error
JSONUnmarshal is a shortcut for this: var event GenericEvent json.Unmarshal(body, &event.Content)
type Info ¶
type Info struct { Name string `bson:"name,omitempty" json:"name"` Description string `bson:"description,omitempty" json:"description"` Value interface{} `bson:"value,omitempty" json:"value"` }
Info contain extra values for the entity
type MetaAlarmInactiveDelay ¶
type OptionalBool ¶
type OptionalBool struct { // Set is a boolean indicating whether the value was set or not. Set bool // Value contains the value of the bool. It should only be taken into // account if Set is true. Value bool }
OptionalBool is a wrapper around bool that implements the bson.Setter interface.
Using this type instead of bool in a struct allows to :
- check whether the value was set or not in the bson document.
- raise an error when trying to unmarshal a value that is not an integer.
Note that when trying to unmarshal a value that is not a bool, UnmarshalBSONValue will raise an error that will not be handled by bson.Unmarshal. If this error is not handled in the UnmarshalBSONValue method of an ancestor, calls to MongoDB queries may fail.
type OptionalInt64 ¶
type OptionalInt64 struct { // Set is a boolean indicating whether the value was set or not. Set bool // Value contains the value of the int64. It should only be taken into // account if Set is true. Value int64 }
OptionalInt64 is a wrapper around int64 that implements the bson.Setter interface.
Using this type instead of int64 in a struct allows to :
- check whether the value was set or not in the bson document.
- raise an error when trying to unmarshal a value that is not an integer.
Note that when trying to unmarshal a value that is not an integer, UnmarshalBSONValue will raise an error that will not be handled by bson.Unmarshal. If this error is not handled in the UnmarshalBSONValue method of an ancestor, calls to MongoDB queries may fail.
type OptionalInterface ¶
type OptionalInterface struct { // Set is a boolean indicating whether the value was set or not. Set bool // Value contains the value of the interface{}. It should only be taken // into account if Set is true. Value interface{} }
OptionalInterface is a wrapper around interface{} that implements the bson.Setter interface.
Using this type instead of interface{} in a struct allows to check whether the value was set or not in the bson document.
type OptionalRegexp ¶
type OptionalRegexp struct { // Set is a boolean indicating whether the value was set or not. Set bool // Value contains the value of the regular expression. It should only be // taken into account if Set is true. Value utils.RegexExpression }
OptionalRegexp is a wrapper around regexp.Regexp that implements the bson.Setter interface.
Using this type in a struct allows to :
- check whether the value was set or not in the bson document.
- automatically compile a regular expression.
- raise an error when trying to unmarshal a value that is not a valid regular expression.
Note that when trying to unmarshal a value that is not a valid regular expression, UnmarshalBSONValue will raise an error that will not be handled by bson.Unmarshal. If this error is not handled in the UnmarshalBSONValue method of an ancestor, calls to MongoDB queries may fail.
type OptionalString ¶
type OptionalString struct { // Set is a boolean indicating whether the value was set or not. Set bool // Value contains the value of the string. It should only be taken into // account if Set is true. Value string }
OptionalString is a wrapper around string that implements the bson.Setter interface.
Using this type instead of string in a struct allows to :
- check whether the value was set or not in the bson document.
- raise an error when trying to unmarshal a value that is not an integer.
Note that when trying to unmarshal a value that is not a string, UnmarshalBSONValue will raise an error that will not be handled by bson.Unmarshal. If this error is not handled in the UnmarshalBSONValue method of an ancestor, calls to MongoDB queries may fail.
type OptionalStringArray ¶
type PbehaviorInfo ¶
type PbehaviorInfo struct { // Timestamp is time when entity enters pbehavior. // Use pointer of CpsTime to unmarshal null and undefined to nil pointer instead of zero CpsTime. Timestamp *datetime.CpsTime `bson:"timestamp" json:"timestamp" swaggertype:"integer"` // ID is ID of pbehavior.PBehavior. ID string `bson:"id" json:"id"` // Name is Name of pbehavior.PBehavior. Name string `bson:"name" json:"name"` // ReasonName is Name of pbehavior.Reason. ReasonName string `bson:"reason_name" json:"reason_name"` // ReasonID is ID of pbehavior.Reason. ReasonID string `bson:"reason" json:"reason"` // TypeID is ID of pbehavior.Type. TypeID string `bson:"type" json:"type"` // TypeName is Name of pbehavior.Type. TypeName string `bson:"type_name" json:"type_name"` // CanonicalType is Type of pbehavior.Type. CanonicalType string `bson:"canonical_type" json:"canonical_type"` IconName string `bson:"icon_name" json:"icon_name"` Color string `bson:"color" json:"color"` Author string `bson:"author" json:"author"` RuleName string `bson:"rule_name,omitempty" json:"rule_name,omitempty"` }
PbehaviorInfo represents current state of entity.
func (*PbehaviorInfo) GetStepMessage ¶
func (i *PbehaviorInfo) GetStepMessage() string
func (*PbehaviorInfo) GetStringField ¶
func (i *PbehaviorInfo) GetStringField(f string) (string, bool)
GetStringField is a magic getter for string fields for easier field retrieving when matching pbehavior info pattern
func (*PbehaviorInfo) Is ¶
func (i *PbehaviorInfo) Is(t string) bool
func (*PbehaviorInfo) IsActive ¶
func (i *PbehaviorInfo) IsActive() bool
func (*PbehaviorInfo) IsDefaultActive ¶
func (i *PbehaviorInfo) IsDefaultActive() bool
func (PbehaviorInfo) IsZero ¶
func (i PbehaviorInfo) IsZero() bool
func (*PbehaviorInfo) OneOf ¶
func (i *PbehaviorInfo) OneOf(t []string) bool
func (PbehaviorInfo) Same ¶
func (i PbehaviorInfo) Same(v PbehaviorInfo) bool
type StateInfo ¶
type TicketInfo ¶
type TicketInfo struct { Ticket string `bson:"ticket,omitempty" json:"ticket,omitempty"` TicketURL string `bson:"ticket_url,omitempty" json:"ticket_url,omitempty"` TicketComment string `bson:"ticket_comment,omitempty" json:"ticket_comment,omitempty"` TicketSystemName string `bson:"ticket_system_name,omitempty" json:"ticket_system_name,omitempty"` TicketMetaAlarmID string `bson:"ticket_meta_alarm_id,omitempty" json:"ticket_meta_alarm_id,omitempty"` TicketRuleID string `bson:"ticket_rule_id,omitempty" json:"ticket_rule_id,omitempty"` TicketRuleName string `bson:"ticket_rule_name,omitempty" json:"ticket_rule_name,omitempty"` TicketData map[string]string `bson:"ticket_data,omitempty" json:"ticket_data,omitempty"` }
func (TicketInfo) GetStepMessage ¶
func (t TicketInfo) GetStepMessage() string