Documentation ¶
Index ¶
- Constants
- func ChangeColor(input string) interface{}
- func ChangeColorFloat64(input float64, threshold float64) interface{}
- func ChangeColorInt64(input int64) interface{}
- func LineSplit(line string) (int64, int64, string, int64, error)
- func LineSplitDynamic(line string, minutesAggr int64) (int64, int64, string, int64, error)
- func PeriodHumanRead(period int64, aggregationMinute int64) string
- type ChangeData
- type CountCompare
- type MailData
- type MonitorManage
- type MonitorManager
- func (mm *MonitorManager) Compare()
- func (mm *MonitorManager) HandleLine(line string) error
- func (mm *MonitorManager) Load()
- func (mm *MonitorManager) RemoveOutdate() error
- func (mm *MonitorManager) Save()
- func (mm *MonitorManager) SendMail(subject, body string) error
- func (mm *MonitorManager) SetAggregationMinute(aggregationMinute int64)
- func (mm *MonitorManager) SetChangeThreshold(newThreshold float64)
- func (mm *MonitorManager) SetLastTimestamp(ltime int64)
- func (mm *MonitorManager) SetReceiver(receiver []string)
- func (mm *MonitorManager) SetReserveDays(dayCount int64)
- func (mm *MonitorManager) SetSpids(in []string)
- type SmtpConfig
- type StatisticsCount
Constants ¶
View Source
const (
MonitorTitle = "短信提交数监控"
)
Variables ¶
This section is empty.
Functions ¶
func ChangeColor ¶
func ChangeColor(input string) interface{}
func ChangeColorFloat64 ¶
func ChangeColorInt64 ¶
func ChangeColorInt64(input int64) interface{}
func LineSplitDynamic ¶
返回毫秒时间戳int64 ,period int64, spid string,计费条数 int64,错误
func PeriodHumanRead ¶
Types ¶
type ChangeData ¶
type CountCompare ¶
type MonitorManage ¶
type MonitorManage interface { //设置内存中数据保留的天数 SetReserveDays(dayCount int64) //设置比较的周期 比如一个小时维度进行比较 SetAggregationMinute(aggregationMinute int64) //处理从其他的消息源传来的日志 HandleLine(line string) error //设置变化阈值 SetChangeThreshold(newThreshold float64) //设置收件人 SetReceiver(receiver []string) // SetSpids(in []string) //设置最后的日志时间戳(13位带毫秒),可以根据这个判断最后的日志时间 SetLastTimestamp(ltime int64) //根据日期 序列化成json写入到文件,日期是 timestamp/87600 Save() //根据日期 把json文件内容读取 反序列化成结构体 Load() //删除内存中的过期数据 RemoveOutdate() error // Compare() //发送报警邮件 SendMail(title, content string) error }
type MonitorManager ¶
type MonitorManager struct { *sync.Mutex ReserveDays int64 `json:"reserve_days"` AggregationMinute int64 `json:"aggregation_minute"` ChangeThreshold float64 `json:"change_threshold"` LastTimestamp int64 `json:"last_timestamp"` //SaveFilePath string `json:"save_file_path"` //数据内嵌map 第一个int64是 小时 timestamp/3600 小时的int64表示 //第二个map[string]int64 string代表spid,第二个int64表示提交数 DataMap map[int64]map[string]*StatisticsCount `json:"data_map"` SmtpConfig *SmtpConfig `json:"smtp_config"` SpIdMap map[string]bool `json:"sp_id_map"` }
func NewOrLoadMonitorManager ¶
func NewOrLoadMonitorManager(reserveDays int64, aggregationMinute int64, spids string) *MonitorManager
func (*MonitorManager) Compare ¶
func (mm *MonitorManager) Compare()
func (*MonitorManager) HandleLine ¶
func (mm *MonitorManager) HandleLine(line string) error
func (*MonitorManager) Load ¶
func (mm *MonitorManager) Load()
func (*MonitorManager) RemoveOutdate ¶
func (mm *MonitorManager) RemoveOutdate() error
动态范围 如半小时或者一小时聚合 需要改的
func (*MonitorManager) Save ¶
func (mm *MonitorManager) Save()
func (*MonitorManager) SendMail ¶
func (mm *MonitorManager) SendMail(subject, body string) error
func (*MonitorManager) SetAggregationMinute ¶
func (mm *MonitorManager) SetAggregationMinute(aggregationMinute int64)
func (*MonitorManager) SetChangeThreshold ¶
func (mm *MonitorManager) SetChangeThreshold(newThreshold float64)
func (*MonitorManager) SetLastTimestamp ¶
func (mm *MonitorManager) SetLastTimestamp(ltime int64)
func (*MonitorManager) SetReceiver ¶
func (mm *MonitorManager) SetReceiver(receiver []string)
func (*MonitorManager) SetReserveDays ¶
func (mm *MonitorManager) SetReserveDays(dayCount int64)
func (*MonitorManager) SetSpids ¶
func (mm *MonitorManager) SetSpids(in []string)
type SmtpConfig ¶
type SmtpConfig struct { SmtpHost string `json:"smtp_host"` //smtp.qq.com SmtpPort int `json:"smtp_port"` //= 465 Username string `json:"username"` //= '316957076' Password string `json:"password"` //= 'apwyxjaxlymncbah' Sender string `json:"sender"` //= '316957076@qq.com' Receivers []string `json:"receivers"` //.join(['429882405@qq.com','505727532@qq.com']) }
type StatisticsCount ¶
Click to show internal directories.
Click to hide internal directories.