Skip to content
Snippets Groups Projects
Commit c3ad8d4e authored by Jason Plum's avatar Jason Plum
Browse files

node-exporter: add configuration attribute for environment

node-exporter makes use of Go's crypto/tls, as such may need `SSL_CERT_DIR` defined for
trusted certificates. Adding in the handling of the `env` node so that we can
populate the `SSL_CERT_DIR` variable for the process.
parent 71a35a38
No related branches found
No related tags found
No related merge requests found
......@@ -19,6 +19,7 @@
prometheus_user = account_helper.prometheus_user
node_exporter_log_dir = node['gitlab']['node-exporter']['log_directory']
textfile_dir = File.join(node['gitlab']['node-exporter']['home'], 'textfile_collector')
node_exporter_static_etc_dir = "/opt/gitlab/etc/node-exporter"
# node-exporter runs under the prometheus user account. If prometheus is
# disabled, it's up to this recipe to create the account
......@@ -30,6 +31,17 @@
recursive true
end
directory node_exporter_static_etc_dir do
owner prometheus_user
mode '0700'
recursive true
end
env_dir File.join(node_exporter_static_etc_dir, 'env') do
variables node['gitlab']['node-exporter']['env']
notifies :restart, "service[node-exporter]"
end
directory textfile_dir do
owner prometheus_user
mode '0755'
......
......@@ -2,4 +2,7 @@
exec 2>&1
<%= render("mount_point_check.erb") %>
umask 077
exec chpst -P -U <%= node['gitlab']['prometheus']['username'] %>:<%= node['gitlab']['prometheus']['group'] %> -u <%= node['gitlab']['prometheus']['username'] %>:<%= node['gitlab']['prometheus']['group'] %> /opt/gitlab/embedded/bin/node_exporter <%= @options[:flags] %>
exec chpst -e <%= @options[:env_dir] %> -P \
-U <%= node['gitlab']['prometheus']['username'] %>:<%= node['gitlab']['prometheus']['group'] %> \
-u <%= node['gitlab']['prometheus']['username'] %>:<%= node['gitlab']['prometheus']['group'] %> \
/opt/gitlab/embedded/bin/node_exporter <%= @options[:flags] %>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment