Add support for Preso and SystemD integration
Please add cookbook recipe/template support for both Presto and SystemD integrations.
+1 for systemd
I know it's not ideal, but note that you can use datadog_monitor to set up integrations that don't have a recipe yet.
See: https://github.com/DataDog/chef-datadog#datadog_monitor
I know it's not ideal, but note that you can use
datadog_monitorto set up integrations that don't have a recipe yet.See: https://github.com/DataDog/chef-datadog#datadog_monitor
Using datadog_monitor for systemd just results in an error because there is no template for it:
Chef::Exceptions::FileNotFound
------------------------------
Cookbook 'datadog' (4.5.0) does not contain a file at any of these locations:
templates/host-kitchen-centos-8.2.2004/systemd.yaml.erb
templates/centos-8.2.2004/systemd.yaml.erb
templates/centos/systemd.yaml.erb
templates/default/systemd.yaml.erb
templates/systemd.yaml.erb
Using the resource like this:
datadog_monitor 'systemd' do
instances [{
'unit_names' => [
'sshd',
],
}]
end
So you would have to create your own template for it to work I guess.
Hi @stianfro
If you pass the following to datadog_monitor:
use_integration_template true
Then it will use a default template that essentially puts whatever you specify as instances, logs and init_config in the output yaml.
Let me know if it works for you :)
@albertvaka just what I was looking for, it works great! :)
Here's what I ended up with for anyone interested:
ruby_block 'list systemd services' do
block do
Chef::Resource::RubyBlock.include Chef::Mixin::ShellOut
command = 'systemctl list-units --type service --no-pager --no-legend | awk -F" " \'{ print $1}\''
node.run_state['unit_names'] = shell_out(command).stdout.split(/\n+/)
end
not_if platform_family?('windows')
end
datadog_monitor 'systemd' do
instances [ node.run_state ]
use_integration_template true
not_if platform_family?('windows')
notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start']
end