From 78b4c3464f24312e461827c23651b873fb99d3d6 Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Fri, 10 Feb 2023 21:54:55 +0900 Subject: [PATCH] Add `consul` service config for `exporter_proxy`. --- cookbooks/prometheus-exporters/exporter_proxy.rb | 13 +++++++++++++ .../files/etc/consul.d/service-exporter_proxy.json | 14 ++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 cookbooks/prometheus-exporters/files/etc/consul.d/service-exporter_proxy.json diff --git a/cookbooks/prometheus-exporters/exporter_proxy.rb b/cookbooks/prometheus-exporters/exporter_proxy.rb index 8a2865f..9893c30 100644 --- a/cookbooks/prometheus-exporters/exporter_proxy.rb +++ b/cookbooks/prometheus-exporters/exporter_proxy.rb @@ -39,6 +39,19 @@ service 'exporter_proxy' do action [:enable, :start] end +remote_file '/etc/consul.d/service-exporter_proxy.json' do + user 'root' + group 'root' + + mode '644' + + notifies :restart, 'service[consul]' +end + +service 'consul' do + action :nothing +end + # Firewall settings here: %w( 60000/tcp ).each do |p| execute "ufw allow #{p}" do diff --git a/cookbooks/prometheus-exporters/files/etc/consul.d/service-exporter_proxy.json b/cookbooks/prometheus-exporters/files/etc/consul.d/service-exporter_proxy.json new file mode 100644 index 0000000..f1bbed4 --- /dev/null +++ b/cookbooks/prometheus-exporters/files/etc/consul.d/service-exporter_proxy.json @@ -0,0 +1,14 @@ +{ + "service": { + "name": "exporter_proxy", + "port": 60000, + "check":{ + "http": "http://localhost:60000/", + "tls_skip_verify": false, + "interval": "60s", + "timeout": "1s", + "status": "passing", + "success_before_passing": 3 + } + } +}