Install `node_exporter` when finding a newer version.

This commit is contained in:
Kazuhiro MUSASHI 2019-11-06 00:00:30 +08:00
parent 45fe078188
commit a8b637a51e
1 changed files with 29 additions and 22 deletions

View File

@ -1,6 +1,9 @@
node_exporter_url = ''
node_exporter_bin = ''
tag = ''
vtag = ''
# Calculate the Download URL:
begin
require 'net/http'
@ -21,6 +24,9 @@ rescue
raise 'Cannot connect to http://github.com.'
end
# バージョン確認して、アップデート必要かどうか確認
result = run_command("node_exporter --version 2>&1 | grep #{tag}", error: false)
if result.exit_status != 0
# Download:
TMP = "/tmp/#{node_exporter_bin}"
@ -46,3 +52,4 @@ end
link "#{node['node_exporter']['location']}node_exporter" do
to "#{node['node_exporter']['storage']}node_exporter"
end
end