Documentation ¶
Index ¶
- func CreateCheck(conn *nats.Conn, check *models.Check) error
- func FindAllClients(conn *nats.Conn) ([]models.Client, error)
- func FindAllCommands(conn *nats.Conn) ([]models.Command, error)
- func FindAllGroups(conn *nats.Conn) ([]models.Group, error)
- func FindCheck(conn *nats.Conn, filter utils.Filter) ([]models.Check, error)
- func FindCheckID(conn *nats.Conn, checkID bson.ObjectId) (*models.Check, error)
- func FindWithClientAndCommand(conn *nats.Conn, clientID, commandID bson.ObjectId) (*models.Check, error)
- func UpdateCheck(conn *nats.Conn, checkID bson.ObjectId) (bool, error)
- type Alert
- func (a Alert) Alert() providers.AlertProvider
- func (a *Alert) Check(resp string, conn *nats.Conn)
- func (a Alert) ClientID() bson.ObjectId
- func (a Alert) Delay() int
- func (a Alert) ID() bson.ObjectId
- func (a Alert) IterServices() <-chan services.Service
- func (a Alert) PreviousAlert() time.Time
- func (a Alert) Services() []services.Service
- func (a Alert) ServicesLength() int
- func (a *Alert) SetAlert(alert providers.AlertProvider)
- func (a *Alert) SetClientID(clientID bson.ObjectId)
- func (a *Alert) SetDelay(delay int)
- func (a *Alert) SetID(id bson.ObjectId)
- func (a *Alert) SetPreviousAlert(previous time.Time)
- func (a *Alert) SetServices(s []services.Service)
- func (a *Alert) Update(alert models.AlertOption) bool
- type Check
- func (c *Check) AddAlert(alert *Alert)
- func (c *Check) Alerts() []*Alert
- func (c Check) AlertsLength() int
- func (c *Check) Checked() (checked bool)
- func (c *Check) Command() (cmd *Command)
- func (c *Check) Error() (err bool)
- func (c *Check) Finished() (finished bool)
- func (c *Check) Group() (g *Group)
- func (c *Check) ID() (id bson.ObjectId)
- func (c Check) IterAlerts() <-chan *Alert
- func (c *Check) RemoveAlertByID(id bson.ObjectId)
- func (c *Check) SetChecked(checked bool)
- func (c *Check) SetError(err bool)
- func (c *Check) SetFinished(finished bool)
- func (c *Check) SetGroup(g *Group)
- func (c *Check) SetID(id bson.ObjectId)
- func (c *Check) SetTimestamp(t time.Time)
- func (c *Check) Timestamp() (timestamp time.Time)
- type Client
- func (c *Client) AddCheck(check *Check)
- func (c *Client) AddGroup(group *Group)
- func (c Client) Check(i int) (check *Check)
- func (c Client) CheckByPastID(id bson.ObjectId) (check *Check)
- func (c Client) Checks() (checks []*Check)
- func (c Client) ChecksByCommandID(id bson.ObjectId) []*Check
- func (c Client) ChecksLength() (count int)
- func (c Client) Conn() (conn net.Conn)
- func (c Client) Group(i int) (group *Group)
- func (c Client) GroupByCommand(commandID bson.ObjectId) (groups []*Group)
- func (c Client) GroupByName(name string) (group *Group)
- func (c Client) Groups() (groups []*Group)
- func (c Client) GroupsLength() (count int)
- func (c Client) HasGroupByName(name string) bool
- func (c Client) ID() (id bson.ObjectId)
- func (c Client) IP() (ip string)
- func (c Client) IterChecks() <-chan *Check
- func (c Client) IterGroups() <-chan *Group
- func (c Client) Ping(port string) ([]PingResult, error)
- func (c *Client) RemoveCheck(i int) (ok bool)
- func (c *Client) RemoveCheckByGroupID(id bson.ObjectId) (ok bool)
- func (c *Client) RemoveCheckByID(id bson.ObjectId) (ok bool)
- func (c *Client) RemoveGroup(i int) (ok bool)
- func (c *Client) RemoveGroupsByCommand(commandID bson.ObjectId) (ok bool)
- func (c *Client) RemoveGroupsByName(name string) (ok bool)
- func (c *Client) ResetCheck(name string)
- func (c *Client) SaveCheck(conn *nats.Conn, check *Check, resp string)
- func (c *Client) SendCheck(conn *nats.Conn, check *Check) string
- func (c Client) SendMessage(message string) (resp string, err error)
- func (c *Client) SetConn(conn net.Conn)
- func (c *Client) SetIP(ip string)
- func (c *Client) StartCheck(conn *nats.Conn)
- type Command
- func (c *Command) Clone() *Command
- func (c Command) Command() (cmd string)
- func (c Command) FailOnError() (stop bool)
- func (c Command) GroupID() bson.ObjectId
- func (c Command) ID() bson.ObjectId
- func (c Command) Interval() (next int)
- func (c *Command) SetCommand(command string)
- func (c *Command) SetFailOnError(stop bool)
- func (c *Command) SetGroupID(id bson.ObjectId)
- func (c *Command) SetInterval(next int)
- type Group
- func (g *Group) AddCommand(cmd *Command)
- func (g Group) Command(i int) (cmd *Command)
- func (g Group) CommandByID(id bson.ObjectId) (cmd *Command)
- func (g Group) Commands() (cmds []*Command)
- func (g Group) HasCommand(id bson.ObjectId) (ok bool)
- func (g Group) ID() bson.ObjectId
- func (g Group) IterCommands() <-chan *Command
- func (g Group) Length() (count int)
- func (g Group) Name() (name string)
- func (g *Group) RemoveCommand(i int) (ok bool)
- func (g *Group) RemoveCommandByID(id bson.ObjectId) (ok bool)
- func (g *Group) SetName(name string)
- type Manager
- func (c *Manager) AddClient(client *Client)
- func (c Manager) Client(i int) (cl *Client)
- func (c Manager) ClientByID(id bson.ObjectId) (cl *Client)
- func (c Manager) Clients() (cls []*Client)
- func (c Manager) IterClients() <-chan *Client
- func (c Manager) Length() (count int)
- func (c *Manager) RemoveClient(i int) (ok bool)
- func (c *Manager) RemoveClientByID(id bson.ObjectId) (ok bool)
- type PingResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateCheck ¶
func FindAllClients ¶
func FindAllCommands ¶
func FindAllGroups ¶
Types ¶
type Alert ¶
type Alert struct {
// contains filtered or unexported fields
}
Alert - is the virtual alert struct
func NewAlert ¶
func NewAlert(ao models.AlertOption) *Alert
NewAlert - will create a new virtual alert based on AlertOptions
func (Alert) Alert ¶
func (a Alert) Alert() providers.AlertProvider
Alert - Will return the AlertProvider
func (Alert) IterServices ¶
IterServices - Will return a channel and loop through all the services in a safe way and pass it to the channel
func (Alert) PreviousAlert ¶
PreviousAlert - Will return when the previous alert was made
func (Alert) ServicesLength ¶
ServicesLength - Will return the amount of services associated with the alert
func (*Alert) SetAlert ¶
func (a *Alert) SetAlert(alert providers.AlertProvider)
SetAlert - Will modify the AlertProvider associated with the alert
func (*Alert) SetClientID ¶
SetClientID Will modify the virtual Client ID
func (*Alert) SetPreviousAlert ¶
SetPreviousAlert - Will modify when the previous alert was made
func (*Alert) SetServices ¶
SetServices - Will modify all of the services associated with the alert
type Check ¶
type Check struct {
// contains filtered or unexported fields
}
Check - Virtual check struct
func (Check) AlertsLength ¶
AlertsLength will return the amount of alerts associated with this check
func (Check) IterAlerts ¶
IterServices - Will return a channel and loop through all the alerts in a safe way and pass it to the channel
func (*Check) RemoveAlertByID ¶
RemoveAlertByID will remove an alert from the check
func (*Check) SetChecked ¶
SetChecked modifies whether the check has been checked or not
func (*Check) SetFinished ¶
SetFinished modifies whether the check is finished or not
func (*Check) SetTimestamp ¶
SetTimestamp modifies the checks timestamp
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (Client) Check ¶
Check returns the specific check that belongs to the client, the index is based on the array index
func (Client) CheckByPastID ¶
CheckByPastID returns a specific check that belongs to the client based on the check ID
func (Client) ChecksByCommandID ¶
ChecksByCommandID returns a specific check that belongs to the client based on the command ID
func (Client) ChecksLength ¶
ChecksLength will return the amount of checks that belongs to the client
func (Client) Group ¶
Group returns a specific group that the client belongs to, the index is based on the array index
func (Client) GroupByCommand ¶
GroupByCommand will return all groups with a specific command ID
func (Client) GroupByName ¶
GroupByName returns the group with a specific name if the client belongs to it
func (Client) GroupsLength ¶
GroupsLength will return the amount of groups that the client belongs to
func (Client) HasGroupByName ¶
HasGroupByName returns if the client belongs to a group with a specific name
func (Client) IterChecks ¶
IterChecks will return a channel and loop through all the checks in a safe way and pass it to the channel
func (Client) IterGroups ¶
IterGroups will return a channel and loop through all the groups in a safe way and pass it to the channel
func (Client) Ping ¶
func (c Client) Ping(port string) ([]PingResult, error)
Port will check if a port is open on a server
func (*Client) RemoveCheck ¶
RemoveCheck will remove a specific check from the client, the index is based on the array in memory
func (*Client) RemoveCheckByGroupID ¶
RemoveCheckByGroupID will remove a specific check from the client based on the group id
func (*Client) RemoveCheckByID ¶
RemoveCheckByID will remove a specific check from the client based on the check ID
func (*Client) RemoveGroup ¶
RemoveGroup will remove a group from the client, the index is based on the array in memory
func (*Client) RemoveGroupsByCommand ¶
RemoveGroupsByCommand will remove a group from the client based on the command id
func (*Client) RemoveGroupsByName ¶
RemoveGroupsByName will remove a group from the client based on the groups name
func (*Client) ResetCheck ¶
ResetCheck will set error and checked to false on all checks with a specific name for the client
func (*Client) SendCheck ¶
SendCheck will send a check to the client and then save the check to the database
func (Client) SendMessage ¶
SendMessage will create a TCP connection to the client then send a message to it and return the reply or error
func (*Client) StartCheck ¶
func (c *Client) StartCheck(conn *nats.Conn)
StartCheck loop through all clients check and check if it's time to do any checks.
type Command ¶
type Command struct {
// contains filtered or unexported fields
}
Command is the structure for virtual commands
func ConvertCommands ¶
func NewCommand ¶
NewCommand creates a new command from parameters
func (*Command) Clone ¶
Clone copies all the values of a command and returns a new command in a safe way
func (Command) FailOnError ¶
FailOnError returns the stop error value in a safe way
func (*Command) SetCommand ¶
SetCommand modifies the command in a safe way
func (*Command) SetFailOnError ¶
SetFailOnError modifies if the check should stop on an error or not in a safe way
func (*Command) SetGroupID ¶
SetGroupID modifies the group ID in a safe way
func (*Command) SetInterval ¶
SetInterval modifies the time between checks in a safe way
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
Group is the structure of a virtual group
func (*Group) AddCommand ¶
AddCommand add a new command in memory
func (Group) Command ¶
Command tries to find a command in memory in a safe way, the index is based on the in memory array
func (Group) CommandByID ¶
CommandByID tries to find a command in memory in a safe way, based on the command ID
func (Group) HasCommand ¶
HasCommand will return if the command ID exists or not in memory
func (Group) IterCommands ¶
IterCommands - Will return a channel and loop through all the commands in a safe way and pass it to the channel
func (*Group) RemoveCommand ¶
RemoveCommand removes a command from memory, the index is based on the in memory array
func (*Group) RemoveCommandByID ¶
RemoveByID removes a command from memory based on the command id
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager struct, contains all the virtual clients
func NewManager ¶
NewManager - Will read from database and create new virtual clients
func (Manager) ClientByID ¶
ClientByID - Check for a specifci client based on the client ID
func (Manager) IterClients ¶
IterClients - Will return a channel and loop through all the clients in a safe way and pass it to the channel
func (*Manager) RemoveClient ¶
RemoveClient - Remove a client from memory, the index is based on in memory array
type PingResult ¶
PingResult is the struct that will hold the result of a ping check