2016-11-28 05:13:15 +00:00
|
|
|
package events
|
|
|
|
|
|
|
|
const (
|
|
|
|
CENTRAL_POLLING = "P"
|
|
|
|
CENTRAL_EVENT = "E"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
2016-11-28 06:00:12 +00:00
|
|
|
COLLECTOR_INSTALL = "/_api/collector/event/status/install"
|
2016-11-30 04:51:35 +00:00
|
|
|
COLLECTOR_INIT = "/_api/collector/event/status/initialize"
|
|
|
|
COLLECTOR_START = "/_api/collector/event/status/start"
|
|
|
|
COLLECTOR_STOP = "/_api/collector/event/status/stop"
|
|
|
|
DISCOVERY_START = "/_api/collector/event/discovery/status/start"
|
|
|
|
DISCOVERY_END = "/_api/collector/event/discovery/status/end"
|
|
|
|
HOST_START = "/_api/collector/event/discovery/host/status/start"
|
|
|
|
HOST_FOUND = "/_api/collector/event/discovery/host/status/found"
|
|
|
|
HOST_END = "/_api/collector/event/discovery/host/status/end"
|
|
|
|
PORT_START = "/_api/collector/event/discovery/port/status/start"
|
|
|
|
PORT_FOUND = "/_api/collector/event/discovery/port/status/found"
|
|
|
|
PORT_END = "/_api/collector/event/discovery/port/status/end"
|
|
|
|
SERVICE_END = "/_api/collector/event/discovery/service/status/end"
|
2016-11-28 05:13:15 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type URLMaker interface {
|
|
|
|
GetUrl() string
|
|
|
|
}
|
|
|
|
|
|
|
|
type Event struct {
|
|
|
|
Collector_id string
|
|
|
|
Time Timestamp
|
|
|
|
EventType string
|
|
|
|
Data interface{}
|
2016-11-30 05:44:35 +00:00
|
|
|
//Result chan Result `json:"-"`
|
2016-11-28 05:13:15 +00:00
|
|
|
}
|
|
|
|
|
2016-11-30 05:44:35 +00:00
|
|
|
//func (e *Event) GetResult() Result {
|
|
|
|
// return <-e.Result
|
|
|
|
//}
|
2016-11-28 05:13:15 +00:00
|
|
|
|
|
|
|
func NewEvent(dataType string, data interface{}) *Event {
|
|
|
|
return &Event{
|
|
|
|
Collector_id: "", // get this collector identity
|
|
|
|
Time: Now(),
|
|
|
|
EventType: dataType,
|
|
|
|
Data: data,
|
|
|
|
}
|
|
|
|
}
|