2019-03-03 08:50:49 +00:00
|
|
|
# Loading the attributes:
|
|
|
|
include_recipe './attributes.rb'
|
|
|
|
|
2020-10-12 14:38:08 +00:00
|
|
|
include_recipe './prometheus_install.rb'
|
|
|
|
include_recipe './prometheus_setup.rb'
|
2020-07-18 05:54:13 +00:00
|
|
|
|
2020-10-12 14:38:08 +00:00
|
|
|
include_recipe './alertmanager_install.rb'
|
|
|
|
include_recipe './alertmanager_setup.rb'
|
2020-09-12 06:04:44 +00:00
|
|
|
|
2020-10-12 14:38:08 +00:00
|
|
|
include_recipe './alertmanager_webhook_install.rb'
|
|
|
|
include_recipe './alertmanager_webhook_setup.rb'
|
2020-09-13 16:25:31 +00:00
|
|
|
|
2020-10-24 04:23:45 +00:00
|
|
|
include_recipe './snmp_exporter_install.rb'
|
|
|
|
|
2020-10-12 14:38:08 +00:00
|
|
|
# Deploy /etc/hosts file:
|
|
|
|
HOSTNAME = run_command('uname -n').stdout.chomp
|
2020-09-13 16:25:31 +00:00
|
|
|
|
2020-10-12 14:38:08 +00:00
|
|
|
template '/etc/promtail/prometheus.yaml' do
|
|
|
|
owner 'root'
|
|
|
|
group 'root'
|
|
|
|
mode '644'
|
2020-09-13 16:25:31 +00:00
|
|
|
|
2020-10-12 14:38:08 +00:00
|
|
|
variables(HOSTNAME: HOSTNAME, LOKIENDPOINT: node['promtail']['lokiendpoint'])
|
2020-09-13 16:25:31 +00:00
|
|
|
|
2020-10-12 14:38:08 +00:00
|
|
|
notifies :restart, 'service[promtail-prometheus]'
|
2019-03-03 08:50:49 +00:00
|
|
|
end
|
|
|
|
|
2020-10-12 14:38:08 +00:00
|
|
|
# Deploy the `systemd` configuration:
|
|
|
|
remote_file '/lib/systemd/system/promtail-prometheus.service' do
|
|
|
|
owner 'root'
|
|
|
|
group 'root'
|
|
|
|
mode '644'
|
2020-09-27 05:21:58 +00:00
|
|
|
end
|
|
|
|
|
2020-10-12 14:38:08 +00:00
|
|
|
# Service setting:
|
|
|
|
service 'promtail-prometheus' do
|
|
|
|
action [ :enable, :restart ]
|
|
|
|
end
|