diff --git a/ipahealthcheck_exporter.go b/ipahealthcheck_exporter.go index 4ad00f2..9a6a060 100644 --- a/ipahealthcheck_exporter.go +++ b/ipahealthcheck_exporter.go @@ -21,6 +21,7 @@ var ( metricsPath string ipahealthcheckPath string ipahealthcheckLogPath string + address string port int sudo bool @@ -89,6 +90,7 @@ func init() { flag.StringVar(&metricsPath, "metrics-path", "/metrics", "Path under which to expose the metrics.") flag.StringVar(&ipahealthcheckPath, "ipahealthcheck-path", "/usr/bin/ipa-healthcheck", "Path to the ipa-healthcheck binary.") flag.StringVar(&ipahealthcheckLogPath, "ipahealthcheck-log-path", "/var/log/ipa/healthcheck/healthcheck.log", "Path to the ipa-healthcheck log file.") + flag.StringVar(&address, "address", "0.0.0.0", "Address on which to expose metrics.") flag.IntVar(&port, "port", 9888, "Port on which to expose metrics.") flag.BoolVar(&sudo, "sudo", false, "Use privilege escalation to run the health checks") } @@ -233,9 +235,9 @@ func main() { } }) - log.Infof("ipa-healthcheck exporter listening on http://0.0.0.0:%d\n", port) + log.Infof("ipa-healthcheck exporter listening on http://%v:%d\n", address, port) - if err := http.ListenAndServe(fmt.Sprintf(":%d", port), nil); err != nil { + if err := http.ListenAndServe(fmt.Sprintf("%v:%d", address, port), nil); err != nil { log.Fatal(err) } }