diff --git a/README.md b/README.md index febb9c3..2b68f29 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,7 @@ Available options ``` Usage: gluster-metrics-exporter [OPTIONS] --metrics-path=URL Metrics Path (default: /metrics) + --host-binding Exporter bind address (default: 0.0.0.0) -p PORT, --port=PORT Exporter Port (default: 9713) --cluster=NAME Cluster identifier --gluster-host=NAME Gluster Host to replace `localhost` from the peer command output (default: hostname) diff --git a/src/args.cr b/src/args.cr index b74976c..0669bee 100644 --- a/src/args.cr +++ b/src/args.cr @@ -16,6 +16,10 @@ module GlusterMetricsExporter @@config.metrics_path = url end + parser.on("--host-binding=HOST", "Bind to specific IP address (default: #{@@config.host_binding})") do |host| + @@config.host_binding = host + end + parser.on("-p PORT", "--port=PORT", "Exporter Port (default: #{@@config.port})") do |port| @@config.port = port.to_i end diff --git a/src/config.cr b/src/config.cr index 4a6f43b..1406bed 100644 --- a/src/config.cr +++ b/src/config.cr @@ -5,6 +5,7 @@ module GlusterMetricsExporter include YAML::Serializable property metrics_path = "/metrics", + host_binding = "0.0.0.0", port = 9713, gluster_executable_path = "/usr/sbin/gluster", log_level = "info", diff --git a/src/gluster-metrics-exporter.cr b/src/gluster-metrics-exporter.cr index 9570cdc..5bc37eb 100644 --- a/src/gluster-metrics-exporter.cr +++ b/src/gluster-metrics-exporter.cr @@ -77,6 +77,7 @@ module GlusterMetricsExporter Crometheus.default_registry.path = @@config.metrics_path Kemal.config.port = @@config.port + Kemal.config.host_binding = @@config.host_binding Kemal.config.logger = ExporterAPILogHandler.new Kemal.run end