-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Originally this PR was about adding prometheus monitoring to services and nodes in the ECS cluster, but then we realized that the application level metrics are trickier to implement because ECS deployed tasks have a random port assigned, but [the standard ec2 discovery settings in Prometheus](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#ec2_sd_config) require you to provide the port in advance. So for this reason in this PR we only set up node level metrics, since nodes can have a node exporter process running in a fixed port (see #179). Since the ECS nodes are not reachable through the Internet, we added a proxy server to forward scrape requests from the monitoring server to the actual nodes. To achieve node level metrics scraping, we: - Add an Nginx proxy configuration to the clickhouse proxy server to direct traffic from the monitoring server to the actual nodes. In order to know to which node is directed each scraping request, we send the private IP address of the node as a path parameter and using nginx rules we parse the right host to send the metrics request to - Add a Prometheus relabeling configuration that will take what the standard ec2 discovery settings provide and use it to rewrite the address to point to the proxy server and adding the private IP as a parameter - Add the permission configurations required to allow traffic from the monitoring server to the proxy server, and from the proxy server to the cluster nodes This PR solves #171 and #172 and depends on #179
- Loading branch information
Showing
12 changed files
with
169 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
tls_cert_dir: /var/lib/dehydrated/certs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
ansible/roles/clickhouse_proxy/templates/prometheus-proxy.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
server { | ||
listen 9200 ssl; | ||
|
||
server_name {{ clickhouse_proxy_public_fqdn }}; | ||
|
||
include /etc/nginx/ssl_intermediate.conf; | ||
|
||
ssl_certificate {{tls_cert_dir}}/{{inventory_hostname}}/fullchain.pem; | ||
ssl_certificate_key {{tls_cert_dir}}/{{inventory_hostname}}/privkey.pem; | ||
ssl_trusted_certificate {{tls_cert_dir}}/{{inventory_hostname}}/chain.pem; | ||
|
||
proxy_ssl_server_name on; | ||
location ~ /([a-zA-Z0-9_\.]+)/(.*) { | ||
proxy_pass http://$1:9100/$2$is_args$args; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters