2020-10-24 09:54:58 +00:00
|
|
|
# Create Link
|
|
|
|
link '/etc/prometheus_exporters.d/snmp.yml' do
|
|
|
|
to "#{node['snmp_exporter']['storage']}snmp.yml"
|
|
|
|
end
|
|
|
|
|
|
|
|
# Deploy `supervisord` config:
|
|
|
|
remote_file '/etc/supervisor/conf.d/snmp_exporter.conf' do
|
|
|
|
owner 'root'
|
|
|
|
group 'root'
|
|
|
|
mode '644'
|
|
|
|
|
|
|
|
notifies :restart, 'service[supervisor]'
|
|
|
|
end
|
|
|
|
|
2020-10-24 10:34:01 +00:00
|
|
|
# Deploy `consul` config:
|
|
|
|
remote_file '/etc/consul.d/service-snmp_exporter.json' do
|
|
|
|
owner 'root'
|
|
|
|
group 'root'
|
|
|
|
mode '644'
|
|
|
|
|
|
|
|
notifies :restart, 'service[supervisor]'
|
|
|
|
end
|
|
|
|
|
2020-10-24 09:54:58 +00:00
|
|
|
# Restart the `supervisor`:
|
|
|
|
service 'supervisor' do
|
|
|
|
action :nothing
|
|
|
|
end
|
2020-10-24 15:16:11 +00:00
|
|
|
|
|
|
|
# Deploy /etc/hosts file:
|
|
|
|
template '/etc/promtail/snmp_exporter.yaml' do
|
|
|
|
owner 'root'
|
|
|
|
group 'root'
|
|
|
|
mode '644'
|
|
|
|
|
|
|
|
variables(HOSTNAME: node[:hostname], LOKIENDPOINT: node['promtail']['lokiendpoint'])
|
|
|
|
|
|
|
|
notifies :restart, 'service[promtail-prometheus]'
|
|
|
|
end
|
2020-10-24 15:16:55 +00:00
|
|
|
|
|
|
|
# Deploy the `systemd` configuration:
|
|
|
|
remote_file '/lib/systemd/system/promtail-snmp_exporter.service' do
|
|
|
|
owner 'root'
|
|
|
|
group 'root'
|
|
|
|
mode '644'
|
|
|
|
end
|
|
|
|
|
|
|
|
# Service setting:
|
|
|
|
service 'promtail-snmp_exporter' do
|
|
|
|
action [ :enable, :restart ]
|
|
|
|
end
|