Index | Files | Directories

package conf

import ""


Package Files

actionNotify.go bytesize.go conf.go lookup.go notify.go system.go system_elastic2.go system_elastic5.go system_elastic6.go system_elastic7.go system_elastic_all.go unknownNotify.go

func GenHash Uses

func GenHash(s string) string

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 Uses

func GetNotificationChains(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 ValidateSystemConf Uses

func ValidateSystemConf(sc SystemConfProvider) error

ValidateSystemConf runs sanity checks on the system configuration

type ActionNotificationContext Uses

type ActionNotificationContext struct {
    States     []*ActionNotificationIncidentState
    User       string
    Message    string
    ActionType models.ActionType
    // contains filtered or unexported fields
func (a ActionNotificationContext) IncidentLink(i int64) string

type ActionNotificationIncidentState Uses

type ActionNotificationIncidentState struct {
    AlertVars Vars

type Alert Uses

type Alert struct {
    Text string
    *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:"-"`
    AlertTemplateKeys map[string]*template.Template `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 Uses

type AnnotateConf struct {
    Hosts         []string // CSV of Elastic Hosts, currently the only backend in annotate
    Version       string
    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 Uses

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

AuthConf is configuration for bosun's authentication

type AzureMonitorConf Uses

type AzureMonitorConf struct {
    SubscriptionId string
    TenantId       string
    ClientId       string
    ClientSecret   string
    Concurrency    int
    DebugRequest   bool
    DebugResponse  bool

AzureConf contains configuration for an Azure metrics

func (AzureMonitorConf) Valid Uses

func (ac AzureMonitorConf) Valid() error

Valid returns if the configuration for the AzureMonitor has required fields with appropriate values

type BulkEditRequest Uses

type BulkEditRequest []EditRequest

BulkEditRequest is a collection of BulkEditRequest to be applied sequentially

type ByteSize Uses

type ByteSize float64
const (
    KB  ByteSize = 1 << (10 * iota)

func (ByteSize) String Uses

func (b ByteSize) String() string

type CloudWatchConf Uses

type CloudWatchConf struct {
    Enabled        bool
    ExpansionLimit int
    PagesLimit     int
    Concurrency    int

func (CloudWatchConf) Valid Uses

func (c CloudWatchConf) Valid() error

type DBConf Uses

type DBConf struct {
    RedisHost          string
    RedisDb            int
    RedisPassword      string
    RedisClientSetName bool
    RedisSentinels     []string
    RedisMasterName    string

    LedisDir      string
    LedisBindAddr string

DBConf stores the connection information for Bosun's internal storage

type Duration Uses

type Duration struct {

Duration is a time.Duration with a UnmarshalText method so durations can be decoded from TOML.

func (*Duration) UnmarshalText Uses

func (d *Duration) UnmarshalText(text []byte) error

UnmarshalText is the method called by TOML when decoding a value

type ESClientOptions Uses

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

type EditRequest Uses

type EditRequest struct {
    Name   string
    Type   string
    Text   string
    Delete bool

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 Uses

type ElasticConf AnnotateConf

ElasticConf contains configuration for an elastic host that Bosun can query

type EnabledBackends Uses

type EnabledBackends struct {
    OpenTSDB     bool
    Graphite     bool
    Influx       bool
    Elastic      bool
    Annotate     bool
    AzureMonitor bool
    CloudWatch   bool
    Prom         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 Entry Uses

type Entry struct {
    Def  string
    Name string

Entry is an entry in a Lookup.

type ExprEntry Uses

type ExprEntry struct {
    AlertKey models.AlertKey
    Values   map[string]string

type ExprLookup Uses

type ExprLookup struct {
    Tags    []string
    Entries []*ExprEntry

TODO: remove this and merge it with Lookup

func (*ExprLookup) Get Uses

func (lookup *ExprLookup) Get(key string, tag opentsdb.TagSet) (value string, ok bool)

type GraphiteConf Uses

type GraphiteConf struct {
    Host    string
    Headers map[string]string

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 Uses

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 Uses

type LDAPConf struct {
    // Domain name (used to make domain/username)
    Domain string
    //user base dn (LDAP Auth)
    UserBaseDn 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 Uses

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 Uses

type Locator interface{}

A Locator stores the information about the location of the rule in the underlying rule store

type Lookup Uses

type Lookup struct {
    Text    string
    Name    string
    Tags    []string
    Entries []*Entry
    Locator `json:"-"`

A Lookup is used to return values based on the tags of a response. It provides switch/case functionality

func (*Lookup) ToExpr Uses

func (lookup *Lookup) ToExpr() *ExprLookup

type Macro Uses

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 Uses

type Notification struct {
    Text string
    Name  string
    Email []*mail.Address

    Post, Get *url.URL

    // template keys to use for plain notifications

    // template keys to use for action notifications. ActionNone contains catch-all fields if present. More specific will override.
    ActionTemplateKeys map[models.ActionType]*NotificationTemplateKeys

    UnknownTemplateKeys      NotificationTemplateKeys
    UnknownMultiTemplateKeys NotificationTemplateKeys

    Print        bool
    Next         *Notification
    Timeout      time.Duration
    ContentType  string
    RunOnActions string
    GroupActions bool

    UnknownMinGroupSize *int // nil means use global defaults. 0 means no-grouping at all.
    UnknownThreshold    *int // nil means use global defaults. 0 means no limit

    NextName        string `json:"-"`
    RawEmail        string `json:"-"`
    RawPost, RawGet 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) NotifyAction Uses

func (n *Notification) NotifyAction(at models.ActionType, t *Template, c SystemConfProvider, states []*models.IncidentState, user, message string, rcp RuleConfProvider)

NotifyAction should be used for action notifications.

func (*Notification) NotifyAlert Uses

func (n *Notification) NotifyAlert(rt *models.RenderedTemplates, c SystemConfProvider, ak string, attachments ...*models.Attachment)

NotifyAlert triggers Email/HTTP/Print actions for the Notification object. Called when an alert is first triggered, or on escalations.

func (*Notification) NotifyMultipleUnknowns Uses

func (n *Notification) NotifyMultipleUnknowns(t *Template, c SystemConfProvider, groups map[string]models.AlertKeys, states []*models.IncidentState)

func (*Notification) NotifyUnknown Uses

func (n *Notification) NotifyUnknown(t *Template, c SystemConfProvider, name string, aks []models.AlertKey, states *models.IncidentState)

func (*Notification) PrepEmail Uses

func (n *Notification) PrepEmail(subject, body string, ak string, attachments []*models.Attachment) *PreparedEmail

func (*Notification) PrepHttp Uses

func (n *Notification) PrepHttp(method string, url string, body string, alertDetails *NotificationDetails) *PreparedHttp

func (*Notification) PrepareAction Uses

func (n *Notification) PrepareAction(at models.ActionType, t *Template, c SystemConfProvider, states []*models.IncidentState, user, message string, rcp RuleConfProvider) *PreparedNotifications

Prepate an action notification, but don't send yet.

func (*Notification) PrepareAlert Uses

func (n *Notification) PrepareAlert(rt *models.RenderedTemplates, ak string, attachments ...*models.Attachment) *PreparedNotifications

PrepareAlert does all of the work of selecting what content to send to which sources. It does not actually send any notifications, but the returned object can be used to send them.

func (*Notification) PrepareMultipleUnknowns Uses

func (n *Notification) PrepareMultipleUnknowns(t *Template, c SystemConfProvider, groups map[string]models.AlertKeys, states []*models.IncidentState) *PreparedNotifications

func (*Notification) PrepareUnknown Uses

func (n *Notification) PrepareUnknown(t *Template, c SystemConfProvider, name string, aks []models.AlertKey, states *models.IncidentState) *PreparedNotifications

func (*Notification) RunOnActionType Uses

func (n *Notification) RunOnActionType(at models.ActionType) bool

func (*Notification) SendHttp Uses

func (n *Notification) SendHttp(method string, url string, body string)

type NotificationDetails Uses

type NotificationDetails struct {
    Ak          []string // alert key
    At          string   // action type
    NotifyName  string   // notification name
    TemplateKey string   // template key
    NotifyType  int      // notifications type e.g alert, unknown etc

type NotificationTemplateKeys Uses

type NotificationTemplateKeys struct {
    PostTemplate, GetTemplate string // templates to use for post/get urls
    BodyTemplate              string // template to use for post body or email body. defaults to "body" for post and "emailBody" (if it exists) for email
    EmailSubjectTemplate      string // template to use for email subject. Default to "subject"

NotificationTemplateKeys is the set of fields that may be templated out per notification. Each field points to the name of a field on a template object.

func (*NotificationTemplateKeys) Combine Uses

func (n *NotificationTemplateKeys) Combine(defaults *NotificationTemplateKeys) *NotificationTemplateKeys

Combine merges keys from another set, copying only those values that do not exist on the first set of template keys. It returns a new object every time, and accepts nils on either side.

type Notifications Uses

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 Uses

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

func (*Notifications) GetAllChained Uses

func (ns *Notifications) GetAllChained() map[string]*Notification

GetAllChained returns all unique notifications, including chains

type OpenTSDBConf Uses

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 PreparedEmail Uses

type PreparedEmail struct {
    To          []string
    Subject     string
    Body        string
    AK          string
    Attachments []*models.Attachment

func (*PreparedEmail) Send Uses

func (p *PreparedEmail) Send(c SystemConfProvider) error

type PreparedHttp Uses

type PreparedHttp struct {
    URL     string
    Method  string
    Headers map[string]string `json:",omitempty"`
    Body    string
    Details *NotificationDetails

func (*PreparedHttp) Send Uses

func (p *PreparedHttp) Send() (int, error)

type PreparedNotifications Uses

type PreparedNotifications struct {
    Email  *PreparedEmail
    HTTP   []*PreparedHttp
    Print  bool
    Name   string
    Errors []string

func (*PreparedNotifications) Send Uses

func (p *PreparedNotifications) Send(c SystemConfProvider) (errs []error)

type PromConf Uses

type PromConf struct {
    URL string

PromConf contains configuration for a Prometheus TSDB that Bosun can query

func (PromConf) Valid Uses

func (pc PromConf) Valid() error

Valid returns if the configuration for the PromConf has required fields needed to create a prometheus tsdb client

type RuleConfProvider Uses

type RuleConfProvider interface {
    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 Uses

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)

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 Uses

type SMTPConf struct {
    EmailFrom string
    Host      string
    Username  string
    Password  string `json:"-"`

SMTPConf contains information for the mail server for which bosun will send emails through

type SaveHook Uses

type SaveHook func(files, user, message string, args ...string) error

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 Uses

func MakeSaveCommandHook(cmdName string) (f SaveHook, err error)

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 Uses

type Squelch map[string]*regexp.Regexp

Squelch is a map of tag keys to regexes that are applied to tag values. Squelches are used to filter results from query responses

func (Squelch) Squelched Uses

func (s Squelch) Squelched(tags opentsdb.TagSet) bool

Squelched takes a tag set and returns true if the given tagset should be squelched based on the Squelche

type Squelches Uses

type Squelches []Squelch

Squelches is a collection of Squelch

func (*Squelches) Add Uses

func (s *Squelches) Add(v string) error

Add adds a sqluech baed on the tags in the first argument. The value of the tag is a regular expression. Tags are passed as a string in the format of

func (*Squelches) Squelched Uses

func (s *Squelches) Squelched(tags opentsdb.TagSet) bool

Squelched takes a tag set and returns true if the given tagset should be squelched based on the Squelches

type SystemConf Uses

type SystemConf struct {
    HTTPListen  string
    HTTPSListen string
    TLSCertFile string
    TLSKeyFile  string

    Hostname      string
    Scheme        string // default http
    Ping          bool
    PingDuration  Duration // Duration from now to stop pinging hosts based on time since the host tag was touched
    TimeAndDate   []int    // 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
    AlertCheckDistribution string   // Method to distribute alet checks. No distribution if equals ""

    DBConf DBConf

    SMTPConf SMTPConf

    RuleVars map[string]string

    ExampleExpression string

    OpenTSDBConf     OpenTSDBConf
    GraphiteConf     GraphiteConf
    InfluxConf       InfluxConf
    ElasticConf      map[string]ElasticConf
    AzureMonitorConf map[string]AzureMonitorConf
    PromConf         map[string]PromConf
    CloudWatchConf   CloudWatchConf
    AnnotateConf     AnnotateConf

    AuthConf *AuthConf

    MaxRenderedTemplateAge int // in days

    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 Uses

func LoadSystemConfig(conf string) (*SystemConf, error)

LoadSystemConfig is like LoadSystemConfigFile but loads the config from a string

func LoadSystemConfigFile Uses

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 Uses

func (sc *SystemConf) AnnotateEnabled() bool

AnnotateEnabled returns if annotations have been enabled or not

func (*SystemConf) EnabledBackends Uses

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) GetAlertCheckDistribution Uses

func (sc *SystemConf) GetAlertCheckDistribution() string

GetAlertCheckDistribution returns if the alert rule checks are scattered over check period

func (*SystemConf) GetAnnotateElasticHosts Uses

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 Uses

func (sc *SystemConf) GetAnnotateIndex() string

GetAnnotateIndex returns the name of the Elastic index that should be used for annotations

func (*SystemConf) GetAuthConf Uses

func (sc *SystemConf) GetAuthConf() *AuthConf

func (*SystemConf) GetAzureMonitorContext Uses

func (sc *SystemConf) GetAzureMonitorContext() expr.AzureMonitorClients

GetAzureMonitorContext returns a the collection of API clients needed query the Azure Monitor and Application Insights APIs

func (*SystemConf) GetCheckFrequency Uses

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) GetCloudWatchContext Uses

func (sc *SystemConf) GetCloudWatchContext() cloudwatch.Context

func (*SystemConf) GetCommandHookPath Uses

func (sc *SystemConf) GetCommandHookPath() string

GetCommandHookPath returns the path of a command that should be run on every save

func (*SystemConf) GetDefaultRunEvery Uses

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 Uses

func (sc *SystemConf) GetElasticContext() expr.ElasticHosts

GetElasticContext returns an Elastic context which contains all the information needed to run Elastic queries.

func (*SystemConf) GetEmailFrom Uses

func (sc *SystemConf) GetEmailFrom() string

GetEmailFrom returns the email address that Bosun will use to send mail notifications from

func (*SystemConf) GetExampleExpression Uses

func (sc *SystemConf) GetExampleExpression() string

GetExampleExpression returns the default expression for "Expression" tab.

func (*SystemConf) GetGraphiteContext Uses

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 Uses

func (sc *SystemConf) GetHTTPListen() string

GetHTTPListen returns the hostname:port that Bosun should listen on

func (*SystemConf) GetHTTPSListen Uses

func (sc *SystemConf) GetHTTPSListen() string

GetHTTPSListen returns the hostname:port that Bosun should listen on with tls

func (*SystemConf) GetInfluxContext Uses

func (sc *SystemConf) GetInfluxContext() client.HTTPConfig

GetInfluxContext returns a Influx context which contains all the information needed to query Influx.

func (*SystemConf) GetInternetProxy Uses

func (sc *SystemConf) GetInternetProxy() string

GetInternetProxy sets a proxy for outgoing network requests from Bosun. Currently it only impacts requests made for shortlinks to

func (*SystemConf) GetLedisBindAddr Uses

func (sc *SystemConf) GetLedisBindAddr() string

GetLedisBindAddr returns the address that Ledis should listen on

func (*SystemConf) GetLedisDir Uses

func (sc *SystemConf) GetLedisDir() string

GetLedisDir returns the directory where Ledis should store its files

func (*SystemConf) GetMaxRenderedTemplateAge Uses

func (sc *SystemConf) GetMaxRenderedTemplateAge() int

GetMaxRenderedTemplateAge returns the maximum time in days to keep rendered templates after the incident end date.

func (*SystemConf) GetMinGroupSize Uses

func (sc *SystemConf) GetMinGroupSize() int

GetMinGroupSize returns the minimum number of alerts needed to group the alerts on Bosun's dashboard

func (*SystemConf) GetPing Uses

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 Uses

func (sc *SystemConf) GetPingDuration() time.Duration

GetPingDuration returns the duration that discovered hosts (will be pinged until the host is not seen.

func (*SystemConf) GetPromContext Uses

func (sc *SystemConf) GetPromContext() expr.PromClients

GetPromContext initializes returns a collection of Prometheus API v1 client APIs (connections) from the configuration

func (*SystemConf) GetRedisDb Uses

func (sc *SystemConf) GetRedisDb() int

GetRedisDb returns the redis database number to use

func (*SystemConf) GetRedisHost Uses

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) GetRedisMasterName Uses

func (sc *SystemConf) GetRedisMasterName() string

GetRedisMasterName returns master name of redis instance within sentinel. If this is return none empty string redis sentinel will be used

func (*SystemConf) GetRedisPassword Uses

func (sc *SystemConf) GetRedisPassword() string

GetRedisPassword returns the password that should be used to connect to redis

func (*SystemConf) GetRuleFilePath Uses

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 Uses

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 Uses

func (sc *SystemConf) GetSMTPHost() string

GetSMTPHost returns the SMTP mail server host that Bosun will use to relay through

func (*SystemConf) GetSMTPPassword Uses

func (sc *SystemConf) GetSMTPPassword() string

GetSMTPPassword returns the SMTP password that Bosun will use to connect to the mail server

func (*SystemConf) GetSMTPUsername Uses

func (sc *SystemConf) GetSMTPUsername() string

GetSMTPUsername returns the SMTP username that Bosun will use to connect to the mail server

func (*SystemConf) GetSearchSince Uses

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 Uses

func (sc *SystemConf) GetShortURLKey() string

GetShortURLKey returns the API key that should be used to generate shortlinks from Bosun's UI

func (*SystemConf) GetSystemConfProvider Uses

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 Uses

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 Uses

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 Uses

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 Uses

func (sc *SystemConf) GetTSDBHost() string

GetTSDBHost returns the configured TSDBHost

func (*SystemConf) GetTimeAndDate Uses

func (sc *SystemConf) GetTimeAndDate() []int

GetTimeAndDate returns the 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 Uses

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) IsRedisClientSetName Uses

func (sc *SystemConf) IsRedisClientSetName() bool

RedisClientSetName returns if CLIENT SETNAME shoud send to redis.

func (sc *SystemConf) MakeLink(path string, v *url.Values) string

MakeLink creates a HTML Link based on Bosun's configured Hostname

func (*SystemConf) ReloadEnabled Uses

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 Uses

func (sc *SystemConf) SaveEnabled() bool

SaveEnabled returns if saving via the UI and config editing API endpoints should be enabled

func (*SystemConf) SetTSDBHost Uses

func (sc *SystemConf) SetTSDBHost(tsdbHost string)

SetTSDBHost sets the OpenTSDB host and used when Bosun is set to readonly mode

type SystemConfProvider Uses

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
    GetRedisMasterName() string
    GetRedisDb() int
    GetRedisPassword() string
    IsRedisClientSetName() bool
    GetTimeAndDate() []int
    GetSearchSince() time.Duration

    GetCheckFrequency() time.Duration
    GetDefaultRunEvery() int
    GetAlertCheckDistribution() string
    GetUnknownThreshold() int
    GetMinGroupSize() int

    GetShortURLKey() string
    GetInternetProxy() string

    GetRuleFilePath() string
    SaveEnabled() bool
    ReloadEnabled() bool
    GetCommandHookPath() string

    SetTSDBHost(tsdbHost string)
    GetTSDBHost() string

    GetAnnotateElasticHosts() expr.ElasticConfig
    GetAnnotateIndex() string

    GetAuthConf() *AuthConf

    GetMaxRenderedTemplateAge() int

    GetExampleExpression() string

    // Contexts
    GetTSDBContext() opentsdb.Context
    GetGraphiteContext() graphite.Context
    GetInfluxContext() client.HTTPConfig
    GetElasticContext() expr.ElasticHosts
    GetAzureMonitorContext() expr.AzureMonitorClients
    GetCloudWatchContext() cloudwatch.Context
    GetPromContext() expr.PromClients
    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 Uses

type Template struct {
    Text string
    Name            string
    Body            *template.Template            `json:"-"`
    Subject         *template.Template            `json:"-"`
    CustomTemplates map[string]*template.Template `json:"-"`

    RawBody, RawSubject string
    RawCustoms          map[string]string

    Locator `json:"-"`

Template stores information about a notification template. Templates are based on Go's text and html/template.

func (*Template) Get Uses

func (t *Template) Get(name string) *template.Template

type URL Uses

type URL struct {

URL is a *url.URL with a UnmarshalText method so a url can be decoded from TOML.

func (*URL) UnmarshalText Uses

func (u *URL) UnmarshalText(text []byte) error

UnmarshalText is the method called by TOML when decoding a value

type Vars Uses

type Vars map[string]string

Vars holds a map of variable names to the variable's value


rule/parsePackage parse builds parse trees for configurations as defined by conf.
templatePackage template is a thin wrapper over go's text/template and html/template packages.

Package conf imports 43 packages (graph) and is imported by 8 packages. Updated 2020-06-23. Refresh now. Tools for package owners.