Skip to content

Commit

Permalink
[HWORKS-378] Enable metrics endpoints for consul agents (#42)
Browse files Browse the repository at this point in the history
* [HWORKS-378] Enable metrics endpoints for consul agents

* Add a parameter for the consul server RPC port
  • Loading branch information
SirOibaf authored Feb 10, 2023
1 parent a1a4980 commit 749a751
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
5 changes: 4 additions & 1 deletion attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
default['consul']['configure_resolv_conf'] = "true"
default['consul']['effective_resolv_conf'] = ""
default['consul']['http_api_port'] = "8501"
default['consul']['rpc_port'] = "8300"
default['consul']['domain'] = "consul"

default['consul']['bind_address'] = ""
Expand All @@ -29,4 +30,6 @@

default['consul']['health-check']['retryable-check-file'] = "#{node['consul']['bin_dir']}/retryable_health_check.sh"
default['consul']['health-check']['max-attempts'] = 7
default['consul']['health-check']['multiplier'] = 1.2
default['consul']['health-check']['multiplier'] = 1.2

default['consul']['metrics']['prometheus_retention_time'] = "1m"
8 changes: 8 additions & 0 deletions metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
attribute "consul/http_api_port",
:description => "Port of agent HTTP API",
:type => 'string'

attribute "consul/rpc_port",
:description => "RPC Server port",
:type => 'string'

attribute "consul/domain",
:description => "Domain to be handled by Consul",
Expand Down Expand Up @@ -91,3 +95,7 @@
attribute "consul/health-check/multiplier",
:description => "If a health check fails it will retry for max-attempts before being declared as dead. This attribute controls the sleep interval between consecutive attempts",
:type => 'string'

attribute "consul/metrics/prometheus_retention_time",
:description => "Retention time for Prometheus metrics",
:type => 'string'
9 changes: 7 additions & 2 deletions templates/default/config/master.hcl.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,10 @@ cert_file = "<%= @certificate %>"
key_file = "<%= @key %>"
ports = {
http = -1,
https = <%= node['consul']['http_api_port'] %>
}
https = <%= node['consul']['http_api_port'] %>,
server = <%= node['consul']['rpc_port'] %>
}
telemetry = {
prometheus_retention_time = "<%= node['consul']['metrics']['prometheus_retention_time'] %>",
disable_hostname = true
}
9 changes: 7 additions & 2 deletions templates/default/config/slave.hcl.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,10 @@ cert_file = "<%= @certificate %>"
key_file = "<%= @key %>"
ports = {
http = -1,
https = <%= node['consul']['http_api_port'] %>
}
https = <%= node['consul']['http_api_port'] %>,
server = <%= node['consul']['rpc_port'] %>
}
telemetry = {
prometheus_retention_time = "<%= node['consul']['metrics']['prometheus_retention_time'] %>",
disable_hostname = true
}

0 comments on commit 749a751

Please sign in to comment.