Skip to content

Commit ead21da

Browse files
authored
Add argument to make telemetry path configurable (#96)
1 parent 73c24e2 commit ead21da

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

cmd/node-cert-exporter/main.go

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,23 @@ var BRANCH string
2727
var GOVERSION string
2828

2929
var (
30-
host string
31-
port int
32-
listen string
33-
paths []string
34-
excludePaths []string
35-
includeGlobs []string
36-
excludeGlobs []string
37-
tls bool
38-
tlsCertFile string
39-
tlsKeyFile string
30+
host string
31+
port int
32+
listen string
33+
telemetryPath string
34+
paths []string
35+
excludePaths []string
36+
includeGlobs []string
37+
excludeGlobs []string
38+
tls bool
39+
tlsCertFile string
40+
tlsKeyFile string
4041
)
4142

4243
func init() {
4344
prometheus.MustRegister(version.NewCollector("prometheus_cert_exporter"))
4445
pflag.StringVar(&listen, "listen", ":9117", "Address to listen on for metrics and telemetry. Defaults to :9117")
46+
pflag.StringVar(&telemetryPath, "telemetry-path", "/metrics", "Path under which to expose metrics.")
4547
pflag.StringSliceVar(&paths, "path", []string{"."}, "List of paths to search for SSL certificates. Defaults to current directory.")
4648
pflag.StringSliceVar(&excludePaths, "exclude-path", []string{}, "List of paths to exclute from searching for SSL certificates.")
4749
pflag.StringSliceVar(&includeGlobs, "include-glob", []string{}, "List files matching a pattern to include. This flag can be used multiple times.")
@@ -75,7 +77,7 @@ func main() {
7577
prometheus.MustRegister(e)
7678

7779
glog.V(2).Infof("Listening on %s", listen)
78-
http.Handle("/metrics", promhttp.Handler())
80+
http.Handle(telemetryPath, promhttp.Handler())
7981

8082
if tls {
8183
if tlsCertFile == "" || tlsKeyFile == "" {

0 commit comments

Comments
 (0)