Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Checker ¶
type Checker struct {
// contains filtered or unexported fields
}
Checker is a worker that executes SQLs and sends metrics.
type Config ¶
type Config struct { // DB is a configuration of the database to connect. DB DataSourceConfig `yaml:"data_source"` // Notifiers are configurations of output plugins. Notifiers NotifiersConfig `yaml:"notifiers"` // Rules are a list of rules to monitor Rules []Rule `yaml:"rules"` }
Config represents the structure of the configuration file.
type DB ¶ added in v0.0.2
type DB struct {
// contains filtered or unexported fields
}
DB is an implementation of DataSource.
type DataSource ¶
type DataSource interface { Get(rule Rule) (QueryResult, error) Close() error }
DataSource is an interface which get metrics from.
type DataSourceConfig ¶ added in v0.0.2
type DataSourceConfig struct { // Driver is type of the database to connect. // Currently suppoted databases are as follows: // - postgres // - mysql Driver string `yaml:"driver"` // Options is a map of options to connect. // These options are passed to sql.Open. // The supported options are depend on the database driver. Options DataSourceOptions `yaml:"options"` }
DataSourceConfig is a configuration of the database to connect.
type DataSourceOptions ¶
DataSourceOptions is a map of options to connect.
type Dogstatsd ¶
type Dogstatsd struct {
// contains filtered or unexported fields
}
Dogstatsd is a configuration of the dogstatsd to connect.
type DogstatsdConfig ¶ added in v0.0.2
type DogstatsdConfig struct { // Host is a hostname or IP address of the dogstatsd. Host string `yaml:"host"` // Port is a port number of the dogstatsd. Port string `yaml:"port"` // Namespace to prepend to all statsd calls Namespace string `yaml:"namespace"` // Tags are global tags to be added to every statsd call Tags []string `yaml:"tags"` }
DogstatsdConfig is a configuration of the dogstatsd to connect.
type Event ¶ added in v0.1.0
type Event struct { // Title of the event. Required. Title string // Text is the description of the event. Required. Text string // Level is a level of the event. // This can be info, error, warning or success. (default: info) Level string // Tags for the event. Tags []string }
An Event is an object that can be posted to the Notifier.
type Monitor ¶
type Monitor struct {
// contains filtered or unexported fields
}
Monitor represents a main process of monitoring.
func NewMonitor ¶
NewMonitor returns an instance of Monitor.
type Notifier ¶ added in v0.0.2
type Notifier interface { Put(qr QueryResult, rule Rule) error Event(e *Event) error }
Notifier is an interface which send metrics to.
type NotifiersConfig ¶ added in v0.0.2
type NotifiersConfig struct { // Dogstatsd is a configuration of the dogstatsd to connect. Dogstatsd DogstatsdConfig `yaml:"dogstatsd"` }
NotifiersConfig are configurations of notifiers.
type QueryResult ¶ added in v0.0.2
type QueryResult struct {
Records []Record
}
QueryResult has multiple records.
type Rule ¶
type Rule struct { // Name of the rule. // The metic name sent to the dogstatsd is: // Dogstatsd.Namespace + Rule.Name + Rule.ValueCols[*] Name string `yaml:"name"` // Interval of the monitoring. Interval time.Duration `yaml:"interval"` // Query to the database. Query string `yaml:"query"` // Notifier is a name of notifier to send metrics. Notifier string `yaml:"notifier"` // ValueCols is a list of names of the columns used as metric values. ValueCols []string `yaml:"value_cols"` // TagCols is a list of names of the columns used as metric tags. TagCols []string `yaml:"tag_cols"` }
Rule represents monitoring conditions.