Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions cmd/bosun/conf/conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"io/ioutil"
"log"
"net"
"net/http"
"net/mail"
"net/url"
"os"
Expand Down Expand Up @@ -59,6 +60,7 @@ type Conf struct {

TSDBHost string // OpenTSDB relay and query destination: ny-devtsdb04:4242
GraphiteHost string // Graphite query host: foo.bar.baz
GraphiteHeaders []string // extra http headers when querying graphite.
LogstashElasticHosts expr.LogstashElasticHosts // CSV Elastic Hosts (All part of the same cluster) that stores logstash documents, i.e http://ny-elastic01:9200

tree *parse.Tree
Expand All @@ -84,6 +86,17 @@ func (c *Conf) GraphiteContext() graphite.Context {
if c.GraphiteHost == "" {
return nil
}
if len(c.GraphiteHeaders) > 0 {
headers := http.Header(make(map[string][]string))
for _, s := range c.GraphiteHeaders {
kv := strings.Split(s, ":")
headers.Add(kv[0], kv[1])
}
return graphite.HostHeader{
Host: c.GraphiteHost,
Header: headers,
}
}
return graphite.Host(c.GraphiteHost)
}

Expand Down Expand Up @@ -391,6 +404,11 @@ func (c *Conf) loadGlobal(p *parse.PairNode) {
c.TSDBHost = v
case "graphiteHost":
c.GraphiteHost = v
case "graphiteHeader":
if !strings.Contains(v, ":") {
c.errorf("graphiteHeader must be in key:value form")
}
c.GraphiteHeaders = append(c.GraphiteHeaders, v)
case "logstashElasticHosts":
c.LogstashElasticHosts = strings.Split(v, ",")
case "httpListen":
Expand Down
1 change: 1 addition & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Every variable is optional, though you should enable at least 1 backend.
* The items page.
* The graph page's tag list.
* graphiteHost: an ip, hostname, ip:port, hostname:port or a URL, defaults to standard http/https ports, defaults to "/render" path. Any non-zero path (even "/" overrides path)
* graphiteHeader: a http header to be sent to graphite on each request in 'key:value' format. optional. can be specified multiple times.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you must add an exception to the seen func to make this specifiable multiple times.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're right, fixed in #1234
thanks for still looking out matt ;)

* logstashElasticHost: Elasticsearch host populated by logstash. Same format as tsdbHost.

#### settings
Expand Down