models

package
v0.4.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2018 License: GPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DB 数据库连接池
	DB *mgo.Database

	// Config 配置信息
	Config serverConfig
	// LocalIP 本机活动IP
	LocalIP string

	// RuleDB 存放在mongodb rule 的规则库
	RuleDB = []ruleInfo{}
)
View Source
var Client *elastic.Client

Client http请求client

Functions

func Heartbeat

func Heartbeat()

Heartbeat 心跳线程,定时刷新配置和规则

func InsertEs

func InsertEs(dataType string, data ESSave)

InsertEs 将数据插入es

func InsertThread

func InsertThread()

InsertThread ES异步写入线程

func QueryLogLastTime

func QueryLogLastTime(ip string) (string, error)

QueryLogLastTime 查询ip最后一条登录日志的时间

Types

type DataInfo

type DataInfo struct {
	IP     string
	Type   string
	System string
	Data   []map[string]string
	Uptime time.Time
}

DataInfo 从agent接收数据的结构

type ESSave

type ESSave struct {
	IP   string            `json:"ip"`
	Data map[string]string `json:"data"`
	Time time.Time         `json:"time"`
}

ESSave 插入es记录结构

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL