Documentation ¶
Index ¶
- func GenHash(s string) string
- func GetNotificationChains(c RuleConfProvider, n map[string]*Notification) [][]string
- func Send(e *email.Email, addr, username, password string) error
- func SendMail(addr, username, password string, from string, to []string, msg []byte) error
- func ValidateSystemConf(sc SystemConfProvider) error
- type Alert
- type AnnotateConf
- type AuthConf
- type BulkEditRequest
- type ByteSize
- type DBConf
- type Duration
- type ESClientOptions
- type EditRequest
- type ElasticConf
- type EnabledBackends
- type Entry
- type ExprEntry
- type ExprLookup
- type GraphiteConf
- type InfluxConf
- type LDAPConf
- type LDAPGroup
- type Locator
- type LogStashConf
- type Lookup
- type Macro
- type Notification
- func (n *Notification) DoEmail(subject, body []byte, c SystemConfProvider, ak string, ...)
- func (n *Notification) DoGet(ak string)
- func (n *Notification) DoPost(payload []byte, ak string)
- func (n *Notification) DoPrint(payload string)
- func (n *Notification) GetPayload(subject, body string) (payload []byte)
- func (n *Notification) Notify(subject, body string, emailsubject, emailbody []byte, c SystemConfProvider, ...)
- type Notifications
- type OpenTSDBConf
- type RuleConfProvider
- type RuleConfWriter
- type SMTPConf
- type SaveHook
- type Squelch
- type Squelches
- type SystemConf
- func (sc *SystemConf) AnnotateEnabled() bool
- func (sc *SystemConf) EnabledBackends() EnabledBackends
- func (sc *SystemConf) GetAnnotateElasticHosts() expr.ElasticConfig
- func (sc *SystemConf) GetAnnotateIndex() string
- func (sc *SystemConf) GetAuthConf() *AuthConf
- func (sc *SystemConf) GetCheckFrequency() time.Duration
- func (sc *SystemConf) GetCommandHookPath() string
- func (sc *SystemConf) GetDefaultRunEvery() int
- func (sc *SystemConf) GetElasticContext() expr.ElasticHosts
- func (sc *SystemConf) GetEmailFrom() string
- func (sc *SystemConf) GetGraphiteContext() graphite.Context
- func (sc *SystemConf) GetHTTPListen() string
- func (sc *SystemConf) GetHTTPSListen() string
- func (sc *SystemConf) GetInfluxContext() client.HTTPConfig
- func (sc *SystemConf) GetInternetProxy() string
- func (sc *SystemConf) GetLedisBindAddr() string
- func (sc *SystemConf) GetLedisDir() string
- func (sc *SystemConf) GetLogstashContext() expr.LogstashElasticHosts
- func (sc *SystemConf) GetLogstashElasticHosts() expr.LogstashElasticHosts
- func (sc *SystemConf) GetMinGroupSize() int
- func (sc *SystemConf) GetPing() bool
- func (sc *SystemConf) GetPingDuration() time.Duration
- func (sc *SystemConf) GetRedisDb() int
- func (sc *SystemConf) GetRedisHost() string
- func (sc *SystemConf) GetRedisPassword() string
- func (sc *SystemConf) GetRuleFilePath() string
- func (sc *SystemConf) GetRuleVars() map[string]string
- func (sc *SystemConf) GetSMTPHost() string
- func (sc *SystemConf) GetSMTPPassword() string
- func (sc *SystemConf) GetSMTPUsername() string
- func (sc *SystemConf) GetSearchSince() time.Duration
- func (sc *SystemConf) GetShortURLKey() string
- func (sc *SystemConf) GetSystemConfProvider() (SystemConfProvider, error)
- func (sc *SystemConf) GetTLSCertFile() string
- func (sc *SystemConf) GetTLSKeyFile() string
- func (sc *SystemConf) GetTSDBContext() opentsdb.Context
- func (sc *SystemConf) GetTSDBHost() string
- func (sc *SystemConf) GetTimeAndDate() []int
- func (sc *SystemConf) GetUnknownThreshold() int
- func (sc *SystemConf) MakeLink(path string, v *url.Values) string
- func (sc *SystemConf) ReloadEnabled() bool
- func (sc *SystemConf) SaveEnabled() bool
- func (sc *SystemConf) SetTSDBHost(tsdbHost string)
- type SystemConfProvider
- type Template
- type URL
- type Vars
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenHash ¶
GenHash generates a unique hash of a string. It is used so we can compare edited text configuration to running text configuration and see if it has changed
func GetNotificationChains ¶
func GetNotificationChains(c RuleConfProvider, n map[string]*Notification) [][]string
GetNotificationChains returns the warn or crit notification chains for a configured alert. Each chain is a list of notification names. If a notification name as already been seen in the chain it ends the list with the notification name with a of "..." which indicates that the chain will loop.
func Send ¶
Send an email using the given host and SMTP auth (optional), returns any error thrown by smtp.SendMail. This function merges the To, Cc, and Bcc fields and calls the smtp.SendMail function using the Email.Bytes() output as the message.
func SendMail ¶
SendMail connects to the server at addr, switches to TLS if possible, authenticates with the optional mechanism a if possible, and then sends an email from address from, to addresses to, with message msg.
func ValidateSystemConf ¶
func ValidateSystemConf(sc SystemConfProvider) error
ValidateSystemConf runs sanity checks on the system configuration
Types ¶
type Alert ¶
type Alert struct { Text string Vars *Template `json:"-"` Name string Crit *expr.Expr `json:",omitempty"` Warn *expr.Expr `json:",omitempty"` Depends *expr.Expr `json:",omitempty"` Squelch Squelches `json:"-"` CritNotification *Notifications WarnNotification *Notifications Unknown time.Duration MaxLogFrequency time.Duration IgnoreUnknown bool UnknownsNormal bool UnjoinedOK bool `json:",omitempty"` Log bool RunEvery int ReturnType models.FuncType TemplateName string `json:"-"` RawSquelch []string `json:"-"` Locator `json:"-"` }
Alert stores all information about alerts. All other major sections of rule configuration are referenced by alerts including Templates, Macros, and Notifications. Alerts hold the expressions that determine the Severity of the Alert. There are also flags the alter the behavior of the alert and how the expression is evaluated. This structure is available to users from templates. Consult documentation before making changes
type AnnotateConf ¶
type AnnotateConf struct { Hosts []string // CSV of Elastic Hosts, currently the only backend in annotate SimpleClient bool // If true ES will connect over NewSimpleClient ClientOptions ESClientOptions // ES client options Index string // name of index / table }
AnnotateConf contains the elastic configuration to enable Annotations support
type AuthConf ¶
type AuthConf struct { AuthDisabled bool //Secret string to hash auth tokens. Needed to enable token auth. TokenSecret string //Secret sting used to encrypt cookie. CookieSecret string //LDAP configuration LDAP LDAPConf }
AuthConf is configuration for bosun's authentication
type BulkEditRequest ¶
type BulkEditRequest []EditRequest
BulkEditRequest is a collection of BulkEditRequest to be applied sequentially
type DBConf ¶
type DBConf struct { RedisHost string RedisDb int RedisPassword string LedisDir string LedisBindAddr string }
DBConf stores the connection information for Bosun's internal storage
type Duration ¶
Duration is a time.Duration with a UnmarshalText method so durations can be decoded from TOML.
func (*Duration) UnmarshalText ¶
UnmarshalText is the method called by TOML when decoding a value
type ESClientOptions ¶
type ESClientOptions struct { Enabled bool // if true use client option else ignore BasicAuthUsername string // username for HTTP Basic Auth BasicAuthPassword string // password for HTTP Basic Auth Scheme string // https (default http) SnifferEnabled bool // sniffer enabled or disabled SnifferTimeoutStartup time.Duration // in seconds (default is 5 sec) SnifferTimeout time.Duration // in seconds (default is 2 sec) SnifferInterval time.Duration // in minutes (default is 15 min) HealthcheckEnabled bool // healthchecks enabled or disabled HealthcheckTimeoutStartup time.Duration // in seconds (default is 5 sec) HealthcheckTimeout time.Duration // in seconds (default is 1 sec) HealthcheckInterval time.Duration // in seconds (default is 60 sec) MaxRetries int // max. number of retries before giving up (default 10) GzipEnabled bool // enables or disables gzip compression (disabled by default) }
ESClientOptions: elastic search client options reference https://github.com/olivere/elastic/blob/release-branch.v3/client.go#L107
type EditRequest ¶
EditRequest is a proposed edit to the config file for sections. The Name is the name of section, Type can be "alert", "template", "notification", "lookup", or "macro". The Text should be the full text of the definition, including the declaration and brackets (i.e. "alert foo { .. }"). If Delete is true then the section will be deleted. In order to rename something, specify the old name in the Name field but have the Text definition contain the new name.
type ElasticConf ¶
type ElasticConf struct { Hosts []string SimpleClient bool ClientOptions ESClientOptions }
ElasticConf contains configuration for an elastic host that Bosun can query
type EnabledBackends ¶
type EnabledBackends struct { OpenTSDB bool Graphite bool Influx bool Elastic bool Logstash bool Annotate bool }
EnabledBackends stores which query backends supported by bosun are enabled via the system configuration. This is used so it can be passed to the rule parser and the parse errors can be thrown for query functions that are used when the backend is not enabled
type ExprLookup ¶
TODO: remove this and merge it with Lookup
type GraphiteConf ¶
GraphiteConf contains a string representing the host of a graphite server and a map of headers to be sent with each Graphite request
type InfluxConf ¶
type InfluxConf struct { URL string Username string Password string `json:"-"` UserAgent string Timeout Duration UnsafeSSL bool Precision string }
InfluxConf contains configuration for an influx host that Bosun can query
type LDAPConf ¶
type LDAPConf struct { // Domain name (used to make domain/username) Domain string // LDAP server LdapAddr string // allow insecure ldap connection? AllowInsecure bool // default permission level for anyone who can log in. Try "Reader". DefaultPermission string //List of group level permissions Groups []LDAPGroup //List of user specific permission levels Users map[string]string //Root search path for group lookups. Usually something like "DC=myorg,DC=com". //Only needed if using group permissions RootSearchPath string }
type LDAPGroup ¶
type LDAPGroup struct { // group search path string Path string // Access to grant members of group Ex: "Admin" Role string }
LDAPGroup is a Group level access specification for ldap
type Locator ¶
type Locator interface{}
A Locator stores the information about the location of the rule in the underlying rule store
type LogStashConf ¶
type LogStashConf struct {
Hosts expr.LogstashElasticHosts
}
LogStashConf contains a list of elastic hosts for the depcrecated logstash functions
type Lookup ¶
A Lookup is used to return values based on the tags of a response. It provides switch/case functionality
func (*Lookup) ToExpr ¶
func (lookup *Lookup) ToExpr() *ExprLookup
type Macro ¶
type Macro struct { Text string Pairs interface{} // this is BAD TODO Name string Locator `json:"-"` }
Macro provides the ability to reuse partial sections of alert definition text. Macros can contain other macros
type Notification ¶
type Notification struct { Text string Vars Name string Email []*mail.Address Post, Get *url.URL Body *ttemplate.Template Print bool Next *Notification Timeout time.Duration ContentType string RunOnActions bool UseBody bool NextName string `json:"-"` RawEmail string `json:"-"` RawPost, RawGet string `json:"-"` RawBody string `json:"-"` Locator `json:"-"` }
Notification stores information about a notification. A notification is the definition of an action that should be performed when an alert is triggered
func (*Notification) DoEmail ¶
func (n *Notification) DoEmail(subject, body []byte, c SystemConfProvider, ak string, attachments ...*models.Attachment)
func (*Notification) DoGet ¶
func (n *Notification) DoGet(ak string)
func (*Notification) DoPost ¶
func (n *Notification) DoPost(payload []byte, ak string)
func (*Notification) DoPrint ¶
func (n *Notification) DoPrint(payload string)
func (*Notification) GetPayload ¶
func (n *Notification) GetPayload(subject, body string) (payload []byte)
func (*Notification) Notify ¶
func (n *Notification) Notify(subject, body string, emailsubject, emailbody []byte, c SystemConfProvider, ak string, attachments ...*models.Attachment)
Notify triggers Email/HTTP/Print actions for the Notification object
type Notifications ¶
type Notifications struct { Notifications map[string]*Notification `json:"-"` // Table key -> table Lookups map[string]*Lookup }
Notifications contains a mapping of notification names to all notifications in the configuration. The Lookups Property enables notification lookups - the ability to trigger different notifications based an alerts resulting tags
func (*Notifications) Get ¶
func (ns *Notifications) Get(c RuleConfProvider, tags opentsdb.TagSet) map[string]*Notification
Get returns the set of notifications based on given tags and applys any notification lookup tables
type OpenTSDBConf ¶
type OpenTSDBConf struct { ResponseLimit int64 Host string // OpenTSDB relay and query destination: ny-devtsdb04:4242 Version opentsdb.Version // If set to 2.2 , enable passthrough of wildcards and filters, and add support for groupby }
OpenTSDBConf contains OpenTSDB specific configuration information. The ResponseLimit will prevent Bosun from loading responses larger than its size in bytes. The version enables certain features of OpenTSDB querying
type RuleConfProvider ¶
type RuleConfProvider interface { RuleConfWriter GetUnknownTemplate() *Template GetTemplate(string) *Template GetAlerts() map[string]*Alert GetAlert(string) *Alert GetNotifications() map[string]*Notification GetNotification(string) *Notification GetLookup(string) *Lookup AlertSquelched(*Alert) func(opentsdb.TagSet) bool Squelched(*Alert, opentsdb.TagSet) bool Expand(string, map[string]string, bool) string GetFuncs(EnabledBackends) map[string]parse.Func }
RuleConfProvider is an interface for accessing information that bosun needs to know about rule configuration. Rule configuration includes Macros, Alerts, Notifications, Lookup tables, squelching, and variable expansion. Currently there is only one implementation of this inside bosun in the rule package. The interface exists to ensure that the rest of Bosun does not manipulate the rule configuration in unexpected ways. Also so the possibility of an alternative store for rules can exist the future. However, when this is added it is expected that the interface will change significantly.
type RuleConfWriter ¶
type RuleConfWriter interface { BulkEdit(BulkEditRequest) error GetRawText() string GetHash() string SaveRawText(rawConf, diff, user, message string, args ...string) error RawDiff(rawConf string) (string, error) SetReload(reload func() error) SetSaveHook(SaveHook) }
RuleConfWriter is a collection of the methods that are used to manipulate the configuration Save methods will trigger the reload that has been passed to the rule configuration
type SMTPConf ¶
SMTPConf contains information for the mail server for which bosun will send emails through
type SaveHook ¶
SaveHook is a function that is passed files as a string (currently the only implementation has a single file, so there is no convention for the format of multiple files yet), a user a message and vargs. A SaveHook is called when using bosun to save the config. A save is reverted when the SaveHook returns an error.
func MakeSaveCommandHook ¶
MakeSaveCommandHook takes a function based on the command name and will run it on save passing files, user, message, args... as arguments to the command. For the SaveHook function that is returned, If the command fails to execute or returns a non normal output then an error is returned.
type Squelch ¶
Squelch is a map of tag keys to regexes that are applied to tag values. Squelches are used to filter results from query responses
type Squelches ¶
type Squelches []Squelch
Squelches is a collection of Squelch
type SystemConf ¶
type SystemConf struct { HTTPListen string HTTPSListen string TLSCertFile string TLSKeyFile string Hostname string Ping bool PingDuration Duration // Duration from now to stop pinging hosts based on time since the host tag was touched TimeAndDate []int // timeanddate.com cities list SearchSince Duration ShortURLKey string InternetProxy string MinGroupSize int UnknownThreshold int CheckFrequency Duration // Time between alert checks: 5m DefaultRunEvery int // Default number of check intervals to run each alert: 1 DBConf DBConf SMTPConf SMTPConf RuleVars map[string]string OpenTSDBConf OpenTSDBConf GraphiteConf GraphiteConf InfluxConf InfluxConf ElasticConf map[string]ElasticConf LogStashConf LogStashConf AnnotateConf AnnotateConf AuthConf *AuthConf EnableSave bool EnableReload bool CommandHookPath string RuleFilePath string // contains filtered or unexported fields }
SystemConf contains all the information that bosun needs to run. Outside of the conf package usage should be through conf.SystemConfProvider
func LoadSystemConfig ¶
func LoadSystemConfig(conf string) (*SystemConf, error)
LoadSystemConfig is like LoadSystemConfigFile but loads the config from a string
func LoadSystemConfigFile ¶
func LoadSystemConfigFile(fileName string) (*SystemConf, error)
LoadSystemConfigFile loads the system configuration in TOML format. It will error if there are values in the config that were not parsed
func (*SystemConf) AnnotateEnabled ¶
func (sc *SystemConf) AnnotateEnabled() bool
AnnotateEnabled returns if annotations have been enabled or not
func (*SystemConf) EnabledBackends ¶
func (sc *SystemConf) EnabledBackends() EnabledBackends
EnabledBackends returns and EnabledBackends struct which contains fields to state if a backend is enabled in the configuration or not
func (*SystemConf) GetAnnotateElasticHosts ¶
func (sc *SystemConf) GetAnnotateElasticHosts() expr.ElasticConfig
GetAnnotateElasticHosts returns the Elastic hosts that should be used for annotations. Annotations are not enabled if this has no hosts
func (*SystemConf) GetAnnotateIndex ¶
func (sc *SystemConf) GetAnnotateIndex() string
GetAnnotateIndex returns the name of the Elastic index that should be used for annotations
func (*SystemConf) GetAuthConf ¶
func (sc *SystemConf) GetAuthConf() *AuthConf
func (*SystemConf) GetCheckFrequency ¶
func (sc *SystemConf) GetCheckFrequency() time.Duration
GetCheckFrequency returns the default CheckFrequency that the schedule should run at. Checks by default will run at CheckFrequency * RunEvery
func (*SystemConf) GetCommandHookPath ¶
func (sc *SystemConf) GetCommandHookPath() string
GetCommandHookPath returns the path of a command that should be run on every save
func (*SystemConf) GetDefaultRunEvery ¶
func (sc *SystemConf) GetDefaultRunEvery() int
GetDefaultRunEvery returns the default multipler of how often an alert should run based on the CheckFrequency. Checks by default will run at CheckFrequency * RunEvery
func (*SystemConf) GetElasticContext ¶
func (sc *SystemConf) GetElasticContext() expr.ElasticHosts
GetElasticContext returns an Elastic context which contains all the information needed to run Elastic queries.
func (*SystemConf) GetEmailFrom ¶
func (sc *SystemConf) GetEmailFrom() string
GetEmailFrom returns the email address that Bosun will use to send mail notifications from
func (*SystemConf) GetGraphiteContext ¶
func (sc *SystemConf) GetGraphiteContext() graphite.Context
GetGraphiteContext returns a Graphite context which contains all the information needed to query Graphite. A nil context is returned if GraphiteHost is not set.
func (*SystemConf) GetHTTPListen ¶
func (sc *SystemConf) GetHTTPListen() string
GetHTTPListen returns the hostname:port that Bosun should listen on
func (*SystemConf) GetHTTPSListen ¶
func (sc *SystemConf) GetHTTPSListen() string
GetHTTPSListen returns the hostname:port that Bosun should listen on with tls
func (*SystemConf) GetInfluxContext ¶
func (sc *SystemConf) GetInfluxContext() client.HTTPConfig
GetInfluxContext returns a Influx context which contains all the information needed to query Influx.
func (*SystemConf) GetInternetProxy ¶
func (sc *SystemConf) GetInternetProxy() string
GetInternetProxy sets a proxy for outgoing network requests from Bosun. Currently it only impacts requests made for shortlinks to https://goo.gl/
func (*SystemConf) GetLedisBindAddr ¶
func (sc *SystemConf) GetLedisBindAddr() string
GetLedisBindAddr returns the address that Ledis should listen on
func (*SystemConf) GetLedisDir ¶
func (sc *SystemConf) GetLedisDir() string
GetLedisDir returns the directory where Ledis should store its files
func (*SystemConf) GetLogstashContext ¶
func (sc *SystemConf) GetLogstashContext() expr.LogstashElasticHosts
GetLogstashContext returns a Logstash context which contains all the information needed to query Elastic for logstash style queries. This is deprecated
func (*SystemConf) GetLogstashElasticHosts ¶
func (sc *SystemConf) GetLogstashElasticHosts() expr.LogstashElasticHosts
GetLogstashElasticHosts returns the Hosts to connect to for issuing logstash functions (which are depcrecated)
func (*SystemConf) GetMinGroupSize ¶
func (sc *SystemConf) GetMinGroupSize() int
GetMinGroupSize returns the minimum number of alerts needed to group the alerts on Bosun's dashboard
func (*SystemConf) GetPing ¶
func (sc *SystemConf) GetPing() bool
GetPing returns if Bosun's pinging is enabled. When Ping is enabled, bosun will ping all hosts that is has indexed and record metrics about those pings.
func (*SystemConf) GetPingDuration ¶
func (sc *SystemConf) GetPingDuration() time.Duration
GetPingDuration returns the duration that discovered hosts (will be pinged until the host is not seen.
func (*SystemConf) GetRedisDb ¶
func (sc *SystemConf) GetRedisDb() int
GetRedisDb returns the redis database number to use
func (*SystemConf) GetRedisHost ¶
func (sc *SystemConf) GetRedisHost() string
GetRedisHost returns the host to use for Redis. If this is set than Redis will be used instead of Ledis.
func (*SystemConf) GetRedisPassword ¶
func (sc *SystemConf) GetRedisPassword() string
GetRedisPassword returns the password that should be used to connect to redis
func (*SystemConf) GetRuleFilePath ¶
func (sc *SystemConf) GetRuleFilePath() string
GetRuleFilePath returns the path to the file containing contains rules rules include Alerts, Macros, Notifications, Templates, and Global Variables
func (*SystemConf) GetRuleVars ¶
func (sc *SystemConf) GetRuleVars() map[string]string
GetRuleVars user defined variables that will be available to the rule configuration under "$sys.". This is so values with secrets can be defined in the system configuration
func (*SystemConf) GetSMTPHost ¶
func (sc *SystemConf) GetSMTPHost() string
GetSMTPHost returns the SMTP mail server host that Bosun will use to relay through
func (*SystemConf) GetSMTPPassword ¶
func (sc *SystemConf) GetSMTPPassword() string
GetSMTPPassword returns the SMTP password that Bosun will use to connect to the mail server
func (*SystemConf) GetSMTPUsername ¶
func (sc *SystemConf) GetSMTPUsername() string
GetSMTPUsername returns the SMTP username that Bosun will use to connect to the mail server
func (*SystemConf) GetSearchSince ¶
func (sc *SystemConf) GetSearchSince() time.Duration
GetSearchSince returns the duration that certain search requests should filter out results if they are older (have not been indexed) since the duration
func (*SystemConf) GetShortURLKey ¶
func (sc *SystemConf) GetShortURLKey() string
GetShortURLKey returns the API key that should be used to generate https://goo.gl/ shortlinks from Bosun's UI
func (*SystemConf) GetSystemConfProvider ¶
func (sc *SystemConf) GetSystemConfProvider() (SystemConfProvider, error)
GetSystemConfProvider returns the SystemConfProvider interface and validates the logic of the configuration. If the configuration is not valid an error is returned
func (*SystemConf) GetTLSCertFile ¶
func (sc *SystemConf) GetTLSCertFile() string
GetTLSCertFile returns the path to the tls certificate to listen with (pem format). Must be specified with HTTPSListen.
func (*SystemConf) GetTLSKeyFile ¶
func (sc *SystemConf) GetTLSKeyFile() string
GetTLSKeyFile returns the path to the tls key to listen with (pem format). Must be specified with HTTPSListen.
func (*SystemConf) GetTSDBContext ¶
func (sc *SystemConf) GetTSDBContext() opentsdb.Context
GetTSDBContext returns an OpenTSDB context limited to c.ResponseLimit. A nil context is returned if TSDBHost is not set.
func (*SystemConf) GetTSDBHost ¶
func (sc *SystemConf) GetTSDBHost() string
GetTSDBHost returns the configured TSDBHost
func (*SystemConf) GetTimeAndDate ¶
func (sc *SystemConf) GetTimeAndDate() []int
GetTimeAndDate returns the http://www.timeanddate.com/ that should be available to the UI so it can show links to translate UTC times to various timezones. This feature is only for creating UI Links as Bosun is expected to be running on a machine that is set to UTC
func (*SystemConf) GetUnknownThreshold ¶
func (sc *SystemConf) GetUnknownThreshold() int
GetUnknownThreshold returns the threshold in which multiple unknown alerts in a check iteration should be grouped into a single notification
func (*SystemConf) MakeLink ¶
func (sc *SystemConf) MakeLink(path string, v *url.Values) string
MakeLink creates a HTML Link based on Bosun's configured Hostname
func (*SystemConf) ReloadEnabled ¶
func (sc *SystemConf) ReloadEnabled() bool
ReloadEnabled returns if reloading of the rule config should be enabled. This will return true if save is enabled but reload is not enabled.
func (*SystemConf) SaveEnabled ¶
func (sc *SystemConf) SaveEnabled() bool
SaveEnabled returns if saving via the UI and config editing API endpoints should be enabled
func (*SystemConf) SetTSDBHost ¶
func (sc *SystemConf) SetTSDBHost(tsdbHost string)
SetTSDBHost sets the OpenTSDB host and used when Bosun is set to readonly mode
type SystemConfProvider ¶
type SystemConfProvider interface { GetHTTPListen() string GetHTTPSListen() string GetTLSCertFile() string GetTLSKeyFile() string GetRuleVars() map[string]string GetSMTPHost() string GetSMTPUsername() string // SMTP username GetSMTPPassword() string // SMTP password GetPing() bool GetPingDuration() time.Duration GetEmailFrom() string GetLedisDir() string GetLedisBindAddr() string GetRedisHost() string GetRedisDb() int GetRedisPassword() string GetTimeAndDate() []int GetSearchSince() time.Duration GetCheckFrequency() time.Duration GetDefaultRunEvery() int GetUnknownThreshold() int GetMinGroupSize() int GetShortURLKey() string GetInternetProxy() string GetRuleFilePath() string SaveEnabled() bool ReloadEnabled() bool GetCommandHookPath() string SetTSDBHost(tsdbHost string) GetTSDBHost() string GetLogstashElasticHosts() expr.LogstashElasticHosts GetAnnotateElasticHosts() expr.ElasticConfig GetAnnotateIndex() string GetAuthConf() *AuthConf // Contexts GetTSDBContext() opentsdb.Context GetGraphiteContext() graphite.Context GetInfluxContext() client.HTTPConfig GetLogstashContext() expr.LogstashElasticHosts GetElasticContext() expr.ElasticHosts AnnotateEnabled() bool MakeLink(string, *url.Values) string EnabledBackends() EnabledBackends }
SystemConfProvider providers all the information about the system configuration. the interface exists to ensure that no changes are made to the system configuration outside of the package without a setter
type Template ¶
type Template struct { Text string Vars Name string Body *htemplate.Template `json:"-"` Subject *ttemplate.Template `json:"-"` RawBody, RawSubject string Locator `json:"-"` }
Template stores information about a notification template. Templates are based on Go's text and html/template.
type URL ¶
URL is a *url.URL with a UnmarshalText method so a url can be decoded from TOML.
func (*URL) UnmarshalText ¶
UnmarshalText is the method called by TOML when decoding a value