Install exporters for `Ubuntu24.04`.
This commit is contained in:
parent
3b61e2b7ac
commit
d8094f8a6b
|
@ -3,23 +3,12 @@
|
||||||
# -------------------------------------------
|
# -------------------------------------------
|
||||||
node.reverse_merge!({
|
node.reverse_merge!({
|
||||||
'node_exporter' => {
|
'node_exporter' => {
|
||||||
'url' => 'https://github.com/prometheus/node_exporter/releases/download/',
|
'url' => 'prometheus/node_exporter',
|
||||||
'prefix' => 'node_exporter-',
|
|
||||||
'postfix' => '.linux-amd64.tar.gz',
|
|
||||||
'storage' => '/opt/node_exporter/bin/',
|
'storage' => '/opt/node_exporter/bin/',
|
||||||
'location' => '/usr/local/bin/'
|
'location' => '/usr/local/bin/'
|
||||||
},
|
},
|
||||||
'blackbox_exporter' => {
|
|
||||||
'url' => 'https://github.com/prometheus/blackbox_exporter/releases/download/',
|
|
||||||
'prefix' => 'blackbox_exporter-',
|
|
||||||
'postfix' => '.linux-amd64.tar.gz',
|
|
||||||
'storage' => '/opt/blackbox_exporter/bin/',
|
|
||||||
'location' => '/usr/local/bin/'
|
|
||||||
},
|
|
||||||
'filestat_exporter' => {
|
'filestat_exporter' => {
|
||||||
'url' => 'https://github.com/michael-doubez/filestat_exporter/releases/download/',
|
'url' => 'michael-doubez/filestat_exporter',
|
||||||
'prefix' => 'filestat_exporter-',
|
|
||||||
'postfix' => '.linux-amd64.tar.gz',
|
|
||||||
'storage' => '/opt/filestat_exporter/',
|
'storage' => '/opt/filestat_exporter/',
|
||||||
'location' => '/usr/local/bin/'
|
'location' => '/usr/local/bin/'
|
||||||
},
|
},
|
||||||
|
|
|
@ -3,9 +3,7 @@ BIN = '/usr/local/bin/exporter_proxy'
|
||||||
CONFDIR = '/etc/prometheus_exporters.d/exporter_proxy/'
|
CONFDIR = '/etc/prometheus_exporters.d/exporter_proxy/'
|
||||||
CONF = 'config.yml'
|
CONF = 'config.yml'
|
||||||
|
|
||||||
execute "wget #{URL} -O #{BIN}" do
|
execute "eget rrreeeyyy/exporter_proxy --to /usr/local/bin/ --upgrade-only"
|
||||||
not_if "test -e #{BIN}"
|
|
||||||
end
|
|
||||||
|
|
||||||
file BIN do
|
file BIN do
|
||||||
user 'root'
|
user 'root'
|
||||||
|
|
|
@ -1,53 +1,20 @@
|
||||||
filestat_exporter_url = ''
|
# Install:
|
||||||
filestat_exporter_bin = ''
|
directory node['filestat_exporter']['storage'] do
|
||||||
|
owner 'root'
|
||||||
vtag = ''
|
group 'root'
|
||||||
|
mode '755'
|
||||||
# Calculate the Download URL:
|
|
||||||
begin
|
|
||||||
require 'net/http'
|
|
||||||
|
|
||||||
uri = URI.parse('https://github.com/michael-doubez/filestat_exporter/releases/latest')
|
|
||||||
|
|
||||||
Timeout.timeout(3) do
|
|
||||||
response = Net::HTTP.get_response(uri)
|
|
||||||
|
|
||||||
vtag = $1 if response['location'] =~ %r{tag\/(v\d+\.\d+\.\d+)}
|
|
||||||
|
|
||||||
filestat_exporter_bin = "#{node['filestat_exporter']['prefix']}#{vtag}#{node['filestat_exporter']['postfix']}"
|
|
||||||
filestat_exporter_url = "#{node['filestat_exporter']['url']}/#{vtag}/#{filestat_exporter_bin}"
|
|
||||||
end
|
|
||||||
rescue
|
|
||||||
# Abort the chef client process:
|
|
||||||
raise 'Cannot connect to http://github.com.'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# バージョン確認して、アップデート必要かどうか確認
|
execute "eget #{node['filestat_exporter']['url']} --to #{node['filestat_exporter']['storage']}"
|
||||||
result = run_command("filestat_exporter --version 2>&1 | grep #{vtag}", error: false)
|
|
||||||
if result.exit_status != 0
|
|
||||||
# Download:
|
|
||||||
TMP = "/tmp/#{filestat_exporter_bin}"
|
|
||||||
|
|
||||||
execute "wget #{filestat_exporter_url} -O #{TMP}"
|
# Change Owner and Permissions:
|
||||||
|
file "#{node['filestat_exporter']['storage']}filestat_exporter" do
|
||||||
# Install:
|
owner 'root'
|
||||||
directory node['filestat_exporter']['storage'] do
|
group 'root'
|
||||||
owner 'root'
|
mode '755'
|
||||||
group 'root'
|
end
|
||||||
mode '755'
|
|
||||||
end
|
# Create Link
|
||||||
|
link "#{node['filestat_exporter']['location']}filestat_exporter" do
|
||||||
execute "tar zxf #{TMP} -C #{node['filestat_exporter']['storage']} --strip-components 1"
|
to "#{node['filestat_exporter']['storage']}filestat_exporter"
|
||||||
|
|
||||||
# Change Owner and Permissions:
|
|
||||||
file "#{node['filestat_exporter']['storage']}filestat_exporter" do
|
|
||||||
owner 'root'
|
|
||||||
group 'root'
|
|
||||||
mode '755'
|
|
||||||
end
|
|
||||||
|
|
||||||
# Create Link
|
|
||||||
link "#{node['filestat_exporter']['location']}filestat_exporter" do
|
|
||||||
to "#{node['filestat_exporter']['storage']}filestat_exporter"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,55 +1,20 @@
|
||||||
node_exporter_url = ''
|
# Install:
|
||||||
node_exporter_bin = ''
|
directory node['node_exporter']['storage'] do
|
||||||
|
owner 'root'
|
||||||
tag = ''
|
group 'root'
|
||||||
vtag = ''
|
mode '755'
|
||||||
|
|
||||||
# Calculate the Download URL:
|
|
||||||
begin
|
|
||||||
require 'net/http'
|
|
||||||
|
|
||||||
uri = URI.parse('https://github.com/prometheus/node_exporter/releases/latest')
|
|
||||||
|
|
||||||
Timeout.timeout(3) do
|
|
||||||
response = Net::HTTP.get_response(uri)
|
|
||||||
|
|
||||||
vtag = $1 if response['location'] =~ %r{tag\/(v\d+\.\d+\.\d+)}
|
|
||||||
tag = vtag.sub(/^v/, '')
|
|
||||||
|
|
||||||
node_exporter_bin = "#{node['node_exporter']['prefix']}#{tag}#{node['node_exporter']['postfix']}"
|
|
||||||
node_exporter_url = "#{node['node_exporter']['url']}/#{vtag}/#{node_exporter_bin}"
|
|
||||||
end
|
|
||||||
rescue
|
|
||||||
# Abort the chef client process:
|
|
||||||
raise 'Cannot connect to http://github.com.'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# バージョン確認して、アップデート必要かどうか確認
|
execute "eget #{node['node_exporter']['url']} --to #{node['node_exporter']['storage']} --upgrade-only"
|
||||||
result = run_command("node_exporter --version 2>&1 | grep #{tag}", error: false)
|
|
||||||
if result.exit_status != 0
|
|
||||||
# Download:
|
|
||||||
TMP = "/tmp/#{node_exporter_bin}"
|
|
||||||
|
|
||||||
execute "wget #{node_exporter_url} -O #{TMP}"
|
# Change Owner and Permissions:
|
||||||
|
file "#{node['node_exporter']['storage']}node_exporter" do
|
||||||
# Install:
|
owner 'root'
|
||||||
directory node['node_exporter']['storage'] do
|
group 'root'
|
||||||
owner 'root'
|
mode '755'
|
||||||
group 'root'
|
end
|
||||||
mode '755'
|
|
||||||
end
|
# Create Link
|
||||||
|
link "#{node['node_exporter']['location']}node_exporter" do
|
||||||
execute "tar zxf #{TMP} -C #{node['node_exporter']['storage']} --strip-components 1"
|
to "#{node['node_exporter']['storage']}node_exporter"
|
||||||
|
|
||||||
# Change Owner and Permissions:
|
|
||||||
file "#{node['node_exporter']['storage']}node_exporter" do
|
|
||||||
owner 'root'
|
|
||||||
group 'root'
|
|
||||||
mode '755'
|
|
||||||
end
|
|
||||||
|
|
||||||
# Create Link
|
|
||||||
link "#{node['node_exporter']['location']}node_exporter" do
|
|
||||||
to "#{node['node_exporter']['storage']}node_exporter"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue