-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move to a modules/probers model, like the blackbox_exporter. (#34)
There are a number of reasons for this change: - Modules allow a single instance of the exporter to be configured with numerous different tls configs. Previously you had to run a different exporter for each combination. - Adding new and more complicated options to the exporter should be easier with modules than if I was to go down the route of accepting configuration directly through url params - I prefer defining a specific prober (https,tcp) over using the URL to guess what the user wants
- Loading branch information
1 parent
5ca5c8c
commit 801179e
Showing
711 changed files
with
200,218 additions
and
95,531 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package config | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
"github.com/prometheus/common/config" | ||
yaml "gopkg.in/yaml.v3" | ||
) | ||
|
||
var ( | ||
DefaultConfig = &Config{ | ||
map[string]Module{ | ||
"tcp": Module{ | ||
Prober: "tcp", | ||
}, | ||
"http": Module{ | ||
Prober: "https", | ||
}, | ||
"https": Module{ | ||
Prober: "https", | ||
}, | ||
}, | ||
} | ||
) | ||
|
||
func LoadConfig(confFile string) (*Config, error) { | ||
var c *Config | ||
|
||
yamlReader, err := os.Open(confFile) | ||
if err != nil { | ||
return c, fmt.Errorf("error reading config file: %s", err) | ||
} | ||
defer yamlReader.Close() | ||
decoder := yaml.NewDecoder(yamlReader) | ||
decoder.KnownFields(true) | ||
|
||
if err = decoder.Decode(&c); err != nil { | ||
return c, fmt.Errorf("error parsing config file: %s", err) | ||
} | ||
|
||
return c, nil | ||
|
||
} | ||
|
||
type Config struct { | ||
Modules map[string]Module `yaml:"modules"` | ||
} | ||
|
||
type Module struct { | ||
Prober string `yaml:"prober,omitempty"` | ||
TLSConfig config.TLSConfig `yaml:"tls_config,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
modules: | ||
https_insecure: | ||
prober: https | ||
tls_config: | ||
insecure_skip_verify: true | ||
tcp_servername: | ||
prober: tcp | ||
tls_config: | ||
server_name: example.com | ||
tcp_client_auth: | ||
prober: tcp | ||
tls_config: | ||
ca_file: /etc/tls/ca.crt | ||
cert_file: /etc/tls/tls.crt | ||
key_file: /etc/tls/tls.key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,21 @@ | ||
module github.com/ribbybibby/ssl_exporter | ||
|
||
require ( | ||
github.com/prometheus/client_golang v0.9.2 | ||
github.com/prometheus/common v0.2.0 | ||
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d // indirect | ||
github.com/golang/protobuf v1.4.2 // indirect | ||
github.com/jpillora/backoff v1.0.0 // indirect | ||
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect | ||
github.com/prometheus/client_golang v1.6.0 | ||
github.com/prometheus/common v0.10.0 | ||
github.com/prometheus/procfs v0.1.3 // indirect | ||
github.com/sirupsen/logrus v1.6.0 // indirect | ||
golang.org/x/net v0.0.0-20200602114024-627f9648deb9 // indirect | ||
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1 // indirect | ||
golang.org/x/text v0.3.2 // indirect | ||
google.golang.org/protobuf v1.24.0 // indirect | ||
gopkg.in/alecthomas/kingpin.v2 v2.2.6 | ||
gopkg.in/yaml.v2 v2.3.0 // indirect | ||
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 | ||
) | ||
|
||
go 1.14 |
Oops, something went wrong.