2023-02-10 12:51:20 +00:00
|
|
|
URL = 'https://github.com/rrreeeyyy/exporter_proxy/releases/download/v0.4.1/exporter_proxy_linux_amd64'
|
2020-10-12 14:56:41 +00:00
|
|
|
BIN = '/usr/local/bin/exporter_proxy'
|
|
|
|
CONFDIR = '/etc/prometheus_exporters.d/exporter_proxy/'
|
|
|
|
CONF = 'config.yml'
|
|
|
|
|
2024-06-10 02:54:39 +00:00
|
|
|
execute "eget rrreeeyyy/exporter_proxy --to /usr/local/bin/ --upgrade-only"
|
2020-10-12 14:56:41 +00:00
|
|
|
|
|
|
|
file BIN do
|
|
|
|
user 'root'
|
|
|
|
group 'root'
|
|
|
|
|
|
|
|
mode '755'
|
|
|
|
end
|
|
|
|
|
|
|
|
directory CONFDIR do
|
|
|
|
user 'root'
|
|
|
|
group 'root'
|
|
|
|
|
|
|
|
mode '755'
|
|
|
|
end
|
|
|
|
|
|
|
|
remote_file "#{CONFDIR}#{CONF}" do
|
|
|
|
user 'root'
|
|
|
|
group 'root'
|
|
|
|
|
|
|
|
mode '644'
|
|
|
|
end
|
|
|
|
|
2023-02-10 09:59:17 +00:00
|
|
|
remote_file '/etc/systemd/system/exporter_proxy.service' do
|
2020-10-12 14:56:41 +00:00
|
|
|
user 'root'
|
|
|
|
group 'root'
|
|
|
|
|
|
|
|
mode '644'
|
|
|
|
end
|
|
|
|
|
2023-02-10 09:59:17 +00:00
|
|
|
service 'exporter_proxy' do
|
|
|
|
action [:enable, :start]
|
2020-10-12 14:56:41 +00:00
|
|
|
end
|
|
|
|
|
2023-02-10 12:54:55 +00:00
|
|
|
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
|
|
|
|
|
2020-10-12 14:56:41 +00:00
|
|
|
# Firewall settings here:
|
|
|
|
%w( 60000/tcp ).each do |p|
|
|
|
|
execute "ufw allow #{p}" do
|
|
|
|
user 'root'
|
|
|
|
|
|
|
|
not_if "LANG=c ufw status | grep #{p}"
|
|
|
|
|
|
|
|
notifies :run, 'execute[ufw reload-or-enable]'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
execute 'ufw reload-or-enable' do
|
|
|
|
user 'root'
|
|
|
|
command 'LANG=C ufw reload | grep skipping && ufw --force enable || exit 0'
|
|
|
|
|
|
|
|
action :nothing
|
|
|
|
end
|