diff --git a/cookbooks/prometheus/alertmanager_setup.rb b/cookbooks/prometheus/alertmanager_setup.rb index 31c0774..253f780 100644 --- a/cookbooks/prometheus/alertmanager_setup.rb +++ b/cookbooks/prometheus/alertmanager_setup.rb @@ -61,6 +61,19 @@ remote_file '/etc/logrotate.d/alertmanager' do mode '644' end +# Deploy `vector` config for `alertmanager`: +remote_file '/etc/vector/alertmanager.toml' do + owner 'root' + group 'root' + mode '644' + + notifies :restart, 'service[vector-alertmanager]' +end + +service 'vector-alertmanager' do + action [:enable, :start] +end + # Firewall settings here: %w( 9093/tcp ).each do |p| execute "ufw allow #{p}" do diff --git a/cookbooks/prometheus/files/etc/systemd/system/vector-alertmanager.service b/cookbooks/prometheus/files/etc/systemd/system/vector-alertmanager.service new file mode 100644 index 0000000..5a0cba8 --- /dev/null +++ b/cookbooks/prometheus/files/etc/systemd/system/vector-alertmanager.service @@ -0,0 +1,16 @@ +[Unit] +Description=Vector +Documentation=https://vector.dev +After=network-online.target +Requires=network-online.target + +[Service] +ExecStart=/usr/bin/vector --config /etc/vector/alertmanager.toml +ExecReload=/bin/kill -HUP $MAINPID +Restart=always +StandardOutput=journal +StandardError=journal +SyslogIdentifier=vector + +[Install] +WantedBy=multi-user.target