Merge branch 'divide-prometheus-cookbook' of kazu634/itamae into master
This commit is contained in:
commit
979323acc6
|
@ -0,0 +1,48 @@
|
|||
# -------------------------------------------
|
||||
# Specifying the default settings:
|
||||
# -------------------------------------------
|
||||
node.reverse_merge!({
|
||||
'prometheus' => {
|
||||
'manager' => false,
|
||||
'url' => 'https://github.com/prometheus/prometheus/releases/download/',
|
||||
'prefix' => 'prometheus-',
|
||||
'postfix' => '.linux-amd64.tar.gz',
|
||||
'storage' => '/opt/prometheus/',
|
||||
'location' => '/usr/local/bin/'
|
||||
},
|
||||
'node_exporter' => {
|
||||
'url' => 'https://github.com/prometheus/node_exporter/releases/download/',
|
||||
'prefix' => 'node_exporter-',
|
||||
'postfix' => '.linux-amd64.tar.gz',
|
||||
'storage' => '/opt/node_exporter/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/'
|
||||
},
|
||||
'alertmanager' => {
|
||||
'url' => 'https://github.com/prometheus/alertmanager/releases/download/',
|
||||
'prefix' => 'alertmanager-',
|
||||
'postfix' => '.linux-amd64.tar.gz',
|
||||
'storage' => '/opt/prometheus/',
|
||||
'location' => '/usr/local/bin/'
|
||||
},
|
||||
'alertmanager_webhook' => {
|
||||
'url' => 'https://github.com/tomtom-international/alertmanager-webhook-logger/releases/download/',
|
||||
'prefix' => 'alertmanager-webhook-logger-',
|
||||
'postfix' => '.tar.gz',
|
||||
'storage' => '/opt/prometheus/',
|
||||
'location' => '/usr/local/bin/'
|
||||
},
|
||||
'filestat_exporter' => {
|
||||
'url' => 'https://github.com/michael-doubez/filestat_exporter/releases/download/',
|
||||
'prefix' => 'filestat_exporter-',
|
||||
'postfix' => '.linux-amd64.tar.gz',
|
||||
'storage' => '/opt/filestat_exporter/',
|
||||
'location' => '/usr/local/bin/'
|
||||
},
|
||||
})
|
|
@ -0,0 +1,21 @@
|
|||
# Loading the attributes:
|
||||
include_recipe './attributes.rb'
|
||||
|
||||
# Create `/etc/prometheus.d/`:
|
||||
%w(/etc/prometheus_exporters.d).each do |d|
|
||||
directory d do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '0755'
|
||||
end
|
||||
end
|
||||
|
||||
# Install the node_exporter here:
|
||||
include_recipe './node_exporter_install.rb'
|
||||
include_recipe './node_exporter_setup.rb'
|
||||
|
||||
# Install the filestat_exporter here:
|
||||
include_recipe './filestat_exporter_install.rb'
|
||||
include_recipe './filestat_exporter_setup.rb'
|
||||
|
||||
include_recipe './exporter_proxy.rb'
|
|
@ -0,0 +1,12 @@
|
|||
[Unit]
|
||||
Description=Grafana Promtail for Prometheus
|
||||
Documentation=https://github.com/grafana/loki
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
User=root
|
||||
Restart=always
|
||||
ExecStart=/usr/local/bin/promtail --config.file=/etc/promtail/prometheus.yaml
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -1,58 +1,36 @@
|
|||
# Loading the attributes:
|
||||
include_recipe './attributes.rb'
|
||||
|
||||
# Install the Prometheus manager:
|
||||
if node['prometheus']['manager']
|
||||
include_recipe './prometheus_install.rb'
|
||||
include_recipe './prometheus_setup.rb'
|
||||
include_recipe './prometheus_install.rb'
|
||||
include_recipe './prometheus_setup.rb'
|
||||
|
||||
include_recipe './alertmanager_install.rb'
|
||||
include_recipe './alertmanager_setup.rb'
|
||||
include_recipe './alertmanager_install.rb'
|
||||
include_recipe './alertmanager_setup.rb'
|
||||
|
||||
include_recipe './alertmanager_webhook_install.rb'
|
||||
include_recipe './alertmanager_webhook_setup.rb'
|
||||
include_recipe './alertmanager_webhook_install.rb'
|
||||
include_recipe './alertmanager_webhook_setup.rb'
|
||||
|
||||
# Deploy /etc/hosts file:
|
||||
HOSTNAME = run_command('uname -n').stdout.chomp
|
||||
# Deploy /etc/hosts file:
|
||||
HOSTNAME = run_command('uname -n').stdout.chomp
|
||||
|
||||
template '/etc/promtail/prometheus.yaml' do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '644'
|
||||
template '/etc/promtail/prometheus.yaml' do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '644'
|
||||
|
||||
variables(HOSTNAME: HOSTNAME, LOKIENDPOINT: node['promtail']['lokiendpoint'])
|
||||
variables(HOSTNAME: HOSTNAME, LOKIENDPOINT: node['promtail']['lokiendpoint'])
|
||||
|
||||
notifies :restart, 'service[promtail-prometheus]'
|
||||
end
|
||||
|
||||
# Deploy the `systemd` configuration:
|
||||
remote_file '/lib/systemd/system/promtail-prometheus.service' do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '644'
|
||||
end
|
||||
|
||||
# Service setting:
|
||||
service 'promtail-prometheus' do
|
||||
action [ :enable, :restart ]
|
||||
end
|
||||
notifies :restart, 'service[promtail-prometheus]'
|
||||
end
|
||||
|
||||
# Create `/etc/prometheus.d/`:
|
||||
%w(/etc/prometheus_exporters.d).each do |d|
|
||||
directory d do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '0755'
|
||||
end
|
||||
# Deploy the `systemd` configuration:
|
||||
remote_file '/lib/systemd/system/promtail-prometheus.service' do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '644'
|
||||
end
|
||||
|
||||
# Install the node_exporter here:
|
||||
include_recipe './node_exporter_install.rb'
|
||||
include_recipe './node_exporter_setup.rb'
|
||||
|
||||
# Install the filestat_exporter here:
|
||||
include_recipe './filestat_exporter_install.rb'
|
||||
include_recipe './filestat_exporter_setup.rb'
|
||||
|
||||
include_recipe './exporter_proxy.rb'
|
||||
# Service setting:
|
||||
service 'promtail-prometheus' do
|
||||
action [ :enable, :restart ]
|
||||
end
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
[program:blackbox-targets]
|
||||
command=/usr/local/bin/consul-template -consul-addr 127.0.0.1:8500 -template "/etc/consul-template.d/blackbox-targets.tmpl:/etc/prometheus.d/targets/servers.yml"
|
||||
stdout_logfile=/var/log/supervisor/blackbox-targets.log
|
||||
redirect_stderr=true
|
||||
stdout_logfile_maxbytes=1MB
|
||||
stdout_logfile_backups=5
|
||||
autorestart=true
|
||||
stopsignal=INT
|
|
@ -1,8 +0,0 @@
|
|||
[program:blackbox_exporter]
|
||||
command=/usr/local/bin/blackbox_exporter --config.file="/etc/prometheus.d/blackbox.yml"
|
||||
stdout_logfile=/var/log/supervisor/blackbox_exporter.log
|
||||
redirect_stderr=true
|
||||
stdout_logfile_maxbytes=1MB
|
||||
stdout_logfile_backups=5
|
||||
autorestart=true
|
||||
stopsignal=HUP
|
|
@ -5,4 +5,4 @@ include_recipe '../cookbooks/monit/default.rb'
|
|||
include_recipe '../cookbooks/consul/default.rb'
|
||||
include_recipe '../cookbooks/fzf/default.rb'
|
||||
include_recipe '../cookbooks/promtail/default.rb'
|
||||
include_recipe '../cookbooks/prometheus/default.rb'
|
||||
include_recipe '../cookbooks/prometheus-exporters/default.rb'
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
include_recipe '../cookbooks/prometheus/default.rb'
|
||||
include_recipe '../cookbooks/grafana/default.rb'
|
||||
include_recipe '../cookbooks/loki/default.rb'
|
Loading…
Reference in New Issue