noti

package
v0.0.0-...-f67effe Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2019 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AgentDown          EventType = "Agent down"
	AgentUp                      = "Agent up"
	MemorySpike                  = "Memory spike"
	MemorySpikeOver              = "Memory spike over"
	CPUSpike                     = "cpu spike"
	CPUSpikeOver                 = "cpu spike over "
	BandwithUsageLimit           = "Bandwidth usage limit exceed"
	NetworkSpike                 = "Network spike"
	NetworkSpikeOver             = "Network spike over"
	ServiceCrashed               = "Service Crashed"
	ServiveRunning               = "Service running"
	ProcessCrashed               = "process crashed"
	ProcessRunning               = "process running"
)
View Source
const (
	MemHightThreshold = 20
	CPUHightThreshold = 20
	EventTimeout      = 300 * time.Second
)

Variables

This section is empty.

Functions

func Decode

func Decode(raw []byte, out interface{}) error

func Encode

func Encode(v interface{}) ([]byte, error)

func NewFormattedMessage

func NewFormattedMessage(msgtype string, data interface{}) string

Types

type CredStore

type CredStore struct {
	// contains filtered or unexported fields
}

func NewCredStore

func NewCredStore() *CredStore

func (*CredStore) GetAPIFile

func (c *CredStore) GetAPIFile(provderType string) string

func (*CredStore) GetAPIKey

func (c *CredStore) GetAPIKey(provderType string) string

func (*CredStore) GetOption

func (c *CredStore) GetOption(provderType string, user string) string

func (*CredStore) GetToken

func (c *CredStore) GetToken(provderType string, user string) []string

func (*CredStore) SetOption

func (c *CredStore) SetOption(provderType string, user string, option string)

func (*CredStore) SetToken

func (c *CredStore) SetToken(provderType string, user string, authkey string)

type CredentialStore

type CredentialStore interface {
	GetAPIFile(string) string
	GetAPIKey(string) string
	SetToken(string, string, string)
	GetToken(string, string) []string
	SetOption(string, string, string)
	GetOption(string, string) string
}

CredentialStore provides storage of keys

type Event

type Event struct {
	Type    EventType
	Message string
}

type EventContainer

type EventContainer struct {
	Agentid string
	Events  []Event

	Timestamp int64
	Timestr   string
}

type EventManager

type EventManager struct {
	// contains filtered or unexported fields
}

func NewEventManager

func NewEventManager() *EventManager

func (*EventManager) ProcessLog

func (e *EventManager) ProcessLog(agentName, username string,
	rawlog []byte,
	ch chan<- []byte)

func (*EventManager) SaveToken

func (e *EventManager) SaveToken(user string, token string)

func (*EventManager) SendEvent

func (e *EventManager) SendEvent(user string, _data string)

type EventType

type EventType string

type Firebase

type Firebase struct {
	// contains filtered or unexported fields
}

Firebase bashed notification provider

func NewFirebase

func NewFirebase(confFile string) *Firebase

NewFirebase is a constuctor

func (*Firebase) GetName

func (f *Firebase) GetName() string

func (*Firebase) Init

func (f *Firebase) Init()

Init should initilize

func (*Firebase) PushNotification

func (f *Firebase) PushNotification(ctx context.Context, _token string, _data string) error

PushNotification pushes the notification

type HubAdapter

type HubAdapter struct {
}

type MessageFormat

type MessageFormat struct {
	Type string
	Data interface{}
}

type Provider

type Provider interface {
	Init()
	GetName() string
	PushNotification(context.Context, string, string) error
}

Provider is a notification provider interface

type WebHooked

type WebHooked struct {
}

func (*WebHooked) GetName

func (w *WebHooked) GetName() string

func (*WebHooked) Init

func (w *WebHooked) Init()

func (*WebHooked) PushNotification

func (w *WebHooked) PushNotification(ctx context.Context, token string, _data string) error

Jump to

Keyboard shortcuts

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