Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientConfig ¶
type ClientConfig struct { // TLSEnabled is used to inform NewESClient whether to // communicate with Elasticsearch via TLS. This value // should come from the 'elasticsearch.client.tls_enabled' // field of the main configuration file TLSEnabled bool `json:"tls_enabled"` // CACert is the path to a PEM-encoded CA certificate file. // This value should come from the 'elasticsearch.client.ca_cert' // field of the main configuration file CACert string `json:"ca_cert"` // ClientCert is the path to a PEM-encoded client // certificate file when connecting via TLS. This value // should come from the 'elasticsearch.client.client_cert' // field of the main configuration file ClientCert string `json:"client_cert"` // ClientKey is the path to a PEM-encoded client key file // when connecting via TLS. This value should come from the // 'elasticsearch.client.client_key' field of the main // configuration file ClientKey string `json:"client_key"` // ServerName is the server name to use as the SNI host when // connecting via TLS. This value should come from the // 'elasticsearch.client.server_name' field of the main // configuration file ServerName string `json:"server_name"` }
ClientConfig is used to create new configured new *http.Client instances.
type Config ¶
type Config struct { // Elasticsearch is the Elasticsearch client and server // configuration. This value should come from the // 'elasticsearch' field of the main configuration file Elasticsearch *ESConfig `json:"elasticsearch"` // Distributed is whether or not this process will be run // in a distributed fashion. This value should come from // the 'distributed' field of the main configuration file Distributed bool `json:"distributed"` // Consul is the configuration of your Consul server. This // field is required if the process shall be run in a // distributed fashion. This value should come from the // 'consul' field of the main configuration file Consul map[string]string `json:"consul"` // Rules are the definitions of the alerts Rules []*RuleConfig `json:"-"` }
Config represents the main configuration file.
func ParseConfig ¶
ParseConfig parses the main configuration file and returns a *Config instance or a non-nil error if there was an error.
type ESConfig ¶
type ESConfig struct { // Server represents the 'elasticsearch.server' field // of the main configuration file Server *ServerConfig `json:"server"` // Client represents the 'elasticsearch.client' field // of the main configuration file Client *ClientConfig `json:"client"` }
ESConfig represents the 'elasticsearch' field of the main configuration file.
type OutputConfig ¶
type OutputConfig struct { // Type is the type of output method. Some examples include // 'email', 'file', and 'slack'. Additional output methods // may be added in the future Type string `json:"type"` // Config is used to configure the chosen type of output method. // The content of this field is specific to the output type. // Please refer to the README for more detailed information // on this field Config map[string]interface{} `json:"config"` }
OutputConfig maps to each element of 'output' field of a rule configuration file.
type RuleConfig ¶
type RuleConfig struct { // Name is the name of the rule. This value should come // from the 'name' field of the rule configuration file Name string `json:"name"` // ElasticsearchIndex is the index that this rule should // query. This value should come from the 'index' field // of the rule configuration file ElasticsearchIndex string `json:"index"` // CronSchedule is the interval at which the // *github.com/morningconsult/go-elasticsearch-alerts/command/query.QueryHandler // will execute the query. This value should come from // the 'schedule' field of the rule configuration file CronSchedule string `json:"schedule"` // BodyField is the field on which the application should // group query responses before sending alerts. This value // should come from the 'body_field' field of the rule // configuration file BodyField string `json:"body_field"` // ElasticsearchBodyRaw is the untyped query that this // alert should send when querying Elasticsearch. This // value should come from the 'body' field of the // rule configuration file ElasticsearchBodyRaw interface{} `json:"body"` // ElasticsearchBody is the typed query that this alert // will send when querying Elasticsearch ElasticsearchBody map[string]interface{} `json:"-"` // Filters are the additional fields on which the application // should group query responses before sending alerts. This // value should come from the 'filters' field of the rule // configuration file Filters []string `json:"filters"` // Outputs are the methods by which alerts should be sent Outputs []*OutputConfig `json:"outputs"` }
RuleConfig represents a rule configuration file
func ParseRules ¶ added in v0.0.13
func ParseRules() ([]*RuleConfig, error)
ParseRules parses the rule configuration files and returns an array of *RuleConfig or a non-nil error if there was an error.
type ServerConfig ¶
type ServerConfig struct { // ElasticsearchURL is the URL of your Elasticsearch instance. // This value should come from the 'elasticsearch.server.url' // field of the main configuration file ElasticsearchURL string `json:"url"` }
ServerConfig represents the 'elasticsearch.server' field of the main configuration file.