Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Preso and SystemD integration #702

Open
jshrack-ssi opened this issue Mar 8, 2020 · 5 comments
Open

Add support for Preso and SystemD integration #702

jshrack-ssi opened this issue Mar 8, 2020 · 5 comments

Comments

@jshrack-ssi
Copy link

Please add cookbook recipe/template support for both Presto and SystemD integrations.

@stianfro
Copy link

+1 for systemd

@albertvaka
Copy link
Contributor

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

@stianfro
Copy link

stianfro commented Sep 22, 2020

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

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.

@albertvaka
Copy link
Contributor

albertvaka commented Sep 22, 2020

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 :)

@stianfro
Copy link

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants