Documentation ¶
Index ¶
- Constants
- Variables
- func CreateMonitor(d *MonitorDefinition) (*monitor.Monitor, error)
- func FloatEquals(a, b float64) bool
- func GetBool(key string, m map[string]interface{}) (bool, error)
- func GetFloat(key string, m map[string]interface{}) (float64, error)
- func GetInt(key string, m map[string]interface{}) (int, error)
- func GetString(key string, m map[string]interface{}) (string, error)
- func GetStringList(key string, m map[string]interface{}) ([]string, error)
- func GetStringMap(key string, m map[string]interface{}) (map[string]string, error)
- func NewRouter() *mux.Router
- func Serve(addr string) error
- type List
- type MonitorDefinition
- type MonitorInfo
Constants ¶
const ( // Version may be used for REST API version checks in future. Version = "1.0" // VersionHeader is the HTTP request header for Version. VersionHeader = "X-Goma-Version" )
const (
// EPSILON is permitted error for float comparison.
EPSILON = 0.00000001
)
Variables ¶
var ( ErrBadName = errors.New("bad monitor name") ErrNoType = errors.New("no type") ErrInvalidType = errors.New("invalid type") ErrInvalidRange = errors.New("invalid min/max range") ErrNoKey = errors.New("no key") )
Errors for goma.
Functions ¶
func CreateMonitor ¶
func CreateMonitor(d *MonitorDefinition) (*monitor.Monitor, error)
CreateMonitor creates a monitor from MonitorDefinition.
func FloatEquals ¶
FloatEquals compares two floats allowing error within EPSILON.
func GetBool ¶
GetBool extracts a boolean from TOML decoded map. If m[key] does not exist or is not a bool, non-nil error is returned.
func GetFloat ¶
GetFloat extracts a float from TOML decoded map. If m[key] does not exist or is not a float/int, non-nil error is returned.
func GetInt ¶
GetInt extracts an integer from TOML decoded map. If m[key] does not exist or is not an integer, non-nil error is returned.
func GetString ¶
GetString extracts a string from TOML decoded map. If m[key] does not exist or is not a string, non-nil error is returned.
func GetStringList ¶
GetStringList constructs a string list from TOML decoded map. If m[key] does not exist or is not a string list, non-nil error is returned.
func GetStringMap ¶
GetStringMap constructs a map[string]string from TOML decoded map. If m[key] does not exist or is not a string map, non-nil error is returned.
Types ¶
type MonitorDefinition ¶
type MonitorDefinition struct { Name string `toml:"name" json:"name"` Probe map[string]interface{} `toml:"probe" json:"probe"` Filter map[string]interface{} `toml:"filter" json:"filter,omitempty"` Actions []map[string]interface{} `toml:"actions" json:"actions"` Interval int `toml:"interval" json:"interval,omitempty"` Timeout int `toml:"timeout" json:"timeout,omitempty"` Min float64 `toml:"min" json:"min,omitempty"` Max float64 `toml:"max" json:"max,omitempty"` }
MonitorDefinition is a struct to load monitor definitions. TOML and JSON can be used.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package actions provides API to implement goma actions.
|
Package actions provides API to implement goma actions. |
all
Package all import all actions to be compiled-in.
|
Package all import all actions to be compiled-in. |
exec
Package exec implements "exec" action type that runs arbitrary commands.
|
Package exec implements "exec" action type that runs arbitrary commands. |
http
Package http implements "http" action type that send events to HTTP(S) server.
|
Package http implements "http" action type that send events to HTTP(S) server. |
mail
Package mail implements "mail" action type that send mails.
|
Package mail implements "mail" action type that send mails. |
cmd
|
|
Package filters provides API to implement goma filters.
|
Package filters provides API to implement goma filters. |
all
Package all import all filters to be compiled-in.
|
Package all import all filters to be compiled-in. |
average
Package average implements moving-average filter type.
|
Package average implements moving-average filter type. |
Package monitor implements monitoring logics.
|
Package monitor implements monitoring logics. |
Package probes provides API to implement goma probes.
|
Package probes provides API to implement goma probes. |
all
Package all import all probes to be compiled-in.
|
Package all import all probes to be compiled-in. |
exec
Package exec implements "exec" probe type that runs an arbitrary command.
|
Package exec implements "exec" probe type that runs an arbitrary command. |
http
Package http implements "http" probe type that test HTTP(S) servers.
|
Package http implements "http" probe type that test HTTP(S) servers. |
mysql
Package mysql implements "mysql" probe type that test MySQL servers.
|
Package mysql implements "mysql" probe type that test MySQL servers. |