Documentation ¶
Index ¶
- Constants
- Variables
- func DispatchEvent()
- func ParseHookScript(configfile string)
- func SendEmailTo(user, password, host, to, subject, body, mailtype string) error
- type Event
- type EventQueue
- type ExprData
- type ScriptSyntax
- func (self *ScriptSyntax) CheckFloadValue(expr *ExprData, value float64) bool
- func (self *ScriptSyntax) CheckSyntakKeyWords(keywords string) bool
- func (self *ScriptSyntax) GetExpt(event *Event) *ExprData
- func (self *ScriptSyntax) IsExpr(keywords string) bool
- func (self *ScriptSyntax) ParseCondition(condition string) bool
- type Syntaxer
Constants ¶
View Source
const ( DISK_EVENT = iota CPU_EVENT MEM_EVENT STATUS_EVENT LOAD_EVENT )
钩子事件类型
Variables ¶
View Source
var DefaultEventMaps = map[string]int{"disk": DISK_EVENT, "cpu": CPU_EVENT, "mem": MEM_EVENT, "status": STATUS_EVENT, "load": LOAD_EVENT, }
事件对象映射
View Source
var DefaultScriptSyntaxKeywords = []string{"eventtarget",
"gt",
"lt",
"attr",
"callback",
}
语法关键字
View Source
var GEventQueue = NewEventQueue()
event queue
View Source
var GScriptSyntax = NewDefaultSyntax()
syntax
View Source
var NotifyTemplate = `` /* 347-byte string literal not displayed */
通告模板
Functions ¶
func SendEmailTo ¶
发送邮件
Types ¶
type Event ¶
type Event struct { EventType int EventTarget string EventAttr string EventCondition map[string]string EventCallback string EventHostIP string }
event
type EventQueue ¶
type EventQueue struct { EventCache cache.Cacher //email监控 EmailOpen bool EmailUser string EmailPwd string SmtpHost string EmailTo string }
事件列表
func (*EventQueue) PushEvent ¶
func (self *EventQueue) PushEvent(k string, v interface{})
push event
type ScriptSyntax ¶
type ScriptSyntax struct { }
func (*ScriptSyntax) CheckFloadValue ¶
func (self *ScriptSyntax) CheckFloadValue(expr *ExprData, value float64) bool
check fload
func (*ScriptSyntax) CheckSyntakKeyWords ¶
func (self *ScriptSyntax) CheckSyntakKeyWords(keywords string) bool
检查关键字
func (*ScriptSyntax) GetExpt ¶
func (self *ScriptSyntax) GetExpt(event *Event) *ExprData
func (*ScriptSyntax) ParseCondition ¶
func (self *ScriptSyntax) ParseCondition(condition string) bool
解析condition
Click to show internal directories.
Click to hide internal directories.