Skip to content

Commit 60d1b02

Browse files
puhamihaiMihai Puha
andauthored
Allow user to specify host bind address (#44)
Signed-off-by: Mihai Puha <mihai.puha@criticaltechnologies.ro> Co-authored-by: Mihai Puha <mihai.puha@criticaltechnologies.ro>
1 parent a119d30 commit 60d1b02

File tree

4 files changed

+7
-0
lines changed

4 files changed

+7
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ Available options
5252
```
5353
Usage: gluster-metrics-exporter [OPTIONS]
5454
--metrics-path=URL Metrics Path (default: /metrics)
55+
--host-binding Exporter bind address (default: 0.0.0.0)
5556
-p PORT, --port=PORT Exporter Port (default: 9713)
5657
--cluster=NAME Cluster identifier
5758
--gluster-host=NAME Gluster Host to replace `localhost` from the peer command output (default: hostname)

src/args.cr

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ module GlusterMetricsExporter
1616
@@config.metrics_path = url
1717
end
1818

19+
parser.on("--host-binding=HOST", "Bind to specific IP address (default: #{@@config.host_binding})") do |host|
20+
@@config.host_binding = host
21+
end
22+
1923
parser.on("-p PORT", "--port=PORT", "Exporter Port (default: #{@@config.port})") do |port|
2024
@@config.port = port.to_i
2125
end

src/config.cr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ module GlusterMetricsExporter
55
include YAML::Serializable
66

77
property metrics_path = "/metrics",
8+
host_binding = "0.0.0.0",
89
port = 9713,
910
gluster_executable_path = "/usr/sbin/gluster",
1011
log_level = "info",

src/gluster-metrics-exporter.cr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ module GlusterMetricsExporter
7777

7878
Crometheus.default_registry.path = @@config.metrics_path
7979
Kemal.config.port = @@config.port
80+
Kemal.config.host_binding = @@config.host_binding
8081
Kemal.config.logger = ExporterAPILogHandler.new
8182
Kemal.run
8283
end

0 commit comments

Comments
 (0)