From 548c0ebf356fc66e00f210e8685addf8a14890e0 Mon Sep 17 00:00:00 2001 From: cocker-cc Date: Thu, 19 Oct 2023 22:55:19 +0200 Subject: [PATCH] Fix Linting Fix Linting according to best Practices stated in PDK-Templates. PDK and the PDK-Templates themselves cannot currently be updated, because the current Rspec-Tests together with the custom spec_helper.rb cannot be used with recent PDK-Templates. --- .fixtures.yml | 32 +- environments/centos7/Vagrantfile | 2 +- environments/centos8/Vagrantfile | 2 +- environments/etc/manifests/site.pp | 4 +- environments/opensuse15/Vagrantfile | 2 +- environments/ubuntu1604/Vagrantfile | 2 +- functions/tag6.pp | 2 +- lib/puppet/reports/datadog_reports.rb | 4 +- manifests/init.pp | 705 +++++++++--------- manifests/install_integration.pp | 15 +- manifests/integration.pp | 22 +- manifests/integrations/activemq_xml.pp | 96 +-- manifests/integrations/apache.pp | 52 +- manifests/integrations/cacti.pp | 40 +- manifests/integrations/cassandra.pp | 63 +- manifests/integrations/ceph.pp | 32 +- manifests/integrations/consul.pp | 57 +- manifests/integrations/directory.pp | 124 ++- manifests/integrations/disk.pp | 164 ++-- manifests/integrations/dns_check.pp | 45 +- manifests/integrations/docker_daemon.pp | 129 ++-- manifests/integrations/elasticsearch.pp | 66 +- manifests/integrations/fluentd.pp | 40 +- manifests/integrations/generic.pp | 38 +- manifests/integrations/haproxy.pp | 49 +- manifests/integrations/http_check.pp | 307 ++++---- manifests/integrations/jenkins.pp | 32 +- manifests/integrations/jmx.pp | 31 +- manifests/integrations/kafka.pp | 149 ++-- manifests/integrations/kong.pp | 24 +- manifests/integrations/kubernetes.pp | 44 +- manifests/integrations/kubernetes_state.pp | 32 +- manifests/integrations/linux_proc_extras.pp | 32 +- manifests/integrations/logs.pp | 41 +- manifests/integrations/marathon.pp | 27 +- manifests/integrations/memcache.pp | 70 +- manifests/integrations/mesos_master.pp | 33 +- manifests/integrations/mesos_slave.pp | 26 +- manifests/integrations/mongo.pp | 159 ++-- manifests/integrations/mysql.pp | 162 ++-- manifests/integrations/network.pp | 58 +- manifests/integrations/nginx.pp | 31 +- manifests/integrations/ntp.pp | 54 +- manifests/integrations/oom_kill.pp | 21 +- manifests/integrations/pgbouncer.pp | 89 +-- manifests/integrations/php_fpm.pp | 79 +- manifests/integrations/postfix.pp | 66 +- manifests/integrations/postgres.pp | 164 ++-- .../integrations/postgres_custom_metric.pp | 20 +- manifests/integrations/process.pp | 74 +- manifests/integrations/rabbitmq.pp | 121 ++- manifests/integrations/redis.pp | 72 +- manifests/integrations/riak.pp | 29 +- manifests/integrations/snmp.pp | 58 +- manifests/integrations/solr.pp | 73 +- manifests/integrations/ssh.pp | 73 +- manifests/integrations/supervisord.pp | 53 +- manifests/integrations/system_core.pp | 27 +- manifests/integrations/tcp_check.pp | 206 +++-- manifests/integrations/tomcat.pp | 80 +- manifests/integrations/twemproxy.pp | 63 +- manifests/integrations/varnish.pp | 47 +- manifests/integrations/zk.pp | 54 +- manifests/params.pp | 25 +- manifests/redhat.pp | 30 +- manifests/reports.pp | 71 +- manifests/security_agent.pp | 20 +- manifests/service.pp | 33 +- manifests/suse.pp | 23 +- manifests/system_probe.pp | 44 +- manifests/tag5.pp | 27 +- manifests/ubuntu.pp | 45 +- manifests/windows.pp | 41 +- 73 files changed, 2457 insertions(+), 2470 deletions(-) diff --git a/.fixtures.yml b/.fixtures.yml index e8d3a33f..8b0545f2 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -1,27 +1,13 @@ +--- fixtures: - repositories: - stdlib: - repo: "git://github.com/puppetlabs/puppetlabs-stdlib.git" - ref: "4.25.0" - concat: - repo: "git://github.com/puppetlabs/puppetlabs-concat.git" - ref: "4.1.1" - apt: - repo: "git://github.com/puppetlabs/puppetlabs-apt.git" - ref: "4.5.0" - puppetserver_gem: - repo: "git://github.com/puppetlabs/puppetlabs-puppetserver_gem.git" - ref: "1.0.0" forge_modules: - yumrepo_core: - repo: "puppetlabs/yumrepo_core" - ref: "1.2.0" - powershell: - repo: "puppetlabs/powershell" - ref: "4.1.0" - zypprepo: - repo: "puppet/zypprepo" - ref: "3.1.0" + powershell: puppetlabs/powershell + yumrepo_core: puppetlabs/yumrepo_core + zypprepo: puppet/zypprepo + repositories: + apt: https://github.com/puppetlabs/puppetlabs-apt + concat: https://github.com/puppetlabs/puppetlabs-concat + puppetserver_gem: https://github.com/puppetlabs/puppetlabs-puppetserver_gem + stdlib: https://github.com/puppetlabs/puppetlabs-stdlib symlinks: custom_datadog: "#{source_dir}/spec/custom_fixtures/custom_datadog" - datadog_agent: "#{source_dir}" diff --git a/environments/centos7/Vagrantfile b/environments/centos7/Vagrantfile index 8ea9d18b..21381829 100644 --- a/environments/centos7/Vagrantfile +++ b/environments/centos7/Vagrantfile @@ -3,7 +3,7 @@ Vagrant.configure("2") do |config| config.vm.provision "file", source: "../../environments/etc", destination: "$HOME/puppet" config.vm.synced_folder "../../", "/puppet-datadog-agent" config.vm.provision "shell", inline: <<-SHELL - #install puppet 5 + # install puppet 5 rpm -ivh http://yum.puppetlabs.com/puppet5-release-el-7.noarch.rpm yum install -y puppet ln -s /opt/puppetlabs/puppet/bin/puppet /usr/bin/puppet diff --git a/environments/centos8/Vagrantfile b/environments/centos8/Vagrantfile index c510332f..e3218227 100644 --- a/environments/centos8/Vagrantfile +++ b/environments/centos8/Vagrantfile @@ -3,7 +3,7 @@ Vagrant.configure("2") do |config| config.vm.provision "file", source: "../../environments/etc", destination: "$HOME/puppet" config.vm.synced_folder "../../", "/puppet-datadog-agent" config.vm.provision "shell", inline: <<-SHELL - #install puppet 6 + # install puppet 6 dnf install -y https://yum.puppetlabs.com/puppet-release-el-8.noarch.rpm dnf install -y puppet diff --git a/environments/etc/manifests/site.pp b/environments/etc/manifests/site.pp index 78fde18d..dc594938 100644 --- a/environments/etc/manifests/site.pp +++ b/environments/etc/manifests/site.pp @@ -1,9 +1,8 @@ node default { - class { 'datadog_agent': api_key => 'somenonnullapikeythats32charlong', agent_extra_options => { - use_http => true, + use_http => true, }, # Hostname is necessary for Agent to start up properly in container since 7.40.0 # https://github.com/DataDog/datadog-agent/issues/14152#issuecomment-1301842615 @@ -24,5 +23,4 @@ username => 'status', password => 'hunter1', } - } diff --git a/environments/opensuse15/Vagrantfile b/environments/opensuse15/Vagrantfile index 90a5bc6d..06a0f1a8 100644 --- a/environments/opensuse15/Vagrantfile +++ b/environments/opensuse15/Vagrantfile @@ -5,7 +5,7 @@ Vagrant.configure("2") do |config| config.vm.provision "file", source: "../../environments/etc", destination: "$HOME/puppet" config.vm.synced_folder "../../", "/puppet-datadog-agent" config.vm.provision "shell", inline: <<-SHELL - #install puppet 6 + # install puppet 6 zypper ar -G https://yum.puppet.com/puppet/sles/15/x86_64/ puppet-repo zypper install -y puppet-agent ln -s /opt/puppetlabs/puppet/bin/puppet /usr/bin/puppet diff --git a/environments/ubuntu1604/Vagrantfile b/environments/ubuntu1604/Vagrantfile index e0c22263..6047d06d 100644 --- a/environments/ubuntu1604/Vagrantfile +++ b/environments/ubuntu1604/Vagrantfile @@ -5,7 +5,7 @@ Vagrant.configure("2") do |config| config.vm.synced_folder "../../", "/puppet-datadog-agent" config.vm.provision "shell", inline: <<-SHELL - #install puppet 4 + # install puppet 4 ln -s /opt/puppetlabs/puppet/bin/puppet /usr/bin/puppet # install modules diff --git a/functions/tag6.pp b/functions/tag6.pp index 8e63a1c1..8c02abbf 100644 --- a/functions/tag6.pp +++ b/functions/tag6.pp @@ -9,7 +9,7 @@ function datadog_agent::tag6( ) { if $tag_names =~ Array { $tags = $tag_names.reduce([]) |$_tags , $tag| { - concat($_tags, datadog_agent::tag6($tag, $lookup_fact, $lookup_table)) + concat($_tags, datadog_agent::tag6($tag, $lookup_fact, $lookup_table)) } } else { if $lookup_fact =~ String { diff --git a/lib/puppet/reports/datadog_reports.rb b/lib/puppet/reports/datadog_reports.rb index 56ee3528..b33de959 100644 --- a/lib/puppet/reports/datadog_reports.rb +++ b/lib/puppet/reports/datadog_reports.rb @@ -127,7 +127,7 @@ def process Puppet.debug "Sending metrics for #{@msg_host} to Datadog" @dog.batch_metrics do metrics.each do |metric, data| - data.values.each do |val| + data.each_value do |val| name = "puppet.#{val[1].tr(' ', '_')}.#{metric}".downcase value = val[2] @dog.emit_point(name.to_s, value, host: @msg_host.to_s) @@ -137,7 +137,7 @@ def process facts = Puppet::Node::Facts.indirection.find(host).values facts_tags = REPORT_FACT_TAGS.map { |name| "#{name}:#{facts.dig(*name.split('.'))}" } - trusted_facts = (Puppet.lookup(:trusted_information) { Hash.new }).to_h + trusted_facts = (Puppet.lookup(:trusted_information) { {} }).to_h trusted_fact_tags = REPORT_TRUSTED_FACT_TAGS.map { |name| "#{name}:#{trusted_facts.dig(*name.split('.'))}" } dog_tags = facts_tags + trusted_fact_tags diff --git a/manifests/init.pp b/manifests/init.pp index d52a9111..92676483 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,260 +1,282 @@ -# Class: datadog_agent +# @summary Contains the agent installation mechanism for the Datadog module # -# This class contains the agent installation mechanism for the Datadog module # -# Parameters: -# $dd_url: -# The host of the Datadog intake server to send agent data to. -# Defaults to https://app.datadoghq.com. -# $datadog_site: -# The site of the Datadog intake to send Agent data to. Defaults to 'datadoghq.com', -# can be set to 'datadoghq.eu' to send data to the EU site or 'us3.datadoghq.com'. -# This option is only available with agent version >= 6.6.0. -# $host: -# Force the hostname to whatever you want. (default: auto-detected) -# $api_key: -# Your DataDog API Key. Please replace with your key value. -# $agent_flavor: -# Linux-only. The Agent flavor to install, eg: "datadog-agent" or "datadog-iot-agent". -# $collect_ec2_tags -# Collect AWS EC2 custom tags as agent tags. -# Boolean. Default: false -# $collect_gce_tags -# Collect Google Cloud Engine metadata as agent tags. -# Boolean. Default: false -# $collect_instance_metadata -# The Agent will try to collect instance metadata for EC2 and GCE instances. -# Boolean. Default: true -# $tags -# Optional array of tags. -# $hiera_tags -# Boolean to grab tags from hiera to allow merging -# $facts_to_tags -# Optional array of facts' names that you can use to define tags following the scheme: "fact_name:fact_value". -# See also trusted_facts_to_tags. -# Note: this is not for Puppet Report Tags. See report_fact_tags -# $trusted_facts_to_tags -# Optional array of trusted facts' names that you can use to define tags following -# the scheme: "fact_name:fact_value". -# Note: this is not for Puppet Report Tags. See report_trusted_fact_tags -# $puppet_run_reports -# Will send results from your puppet agent runs back to the datadog service. -# $reports_url -# The URL to use when sending puppet run reports. Default: https://api.${datadog_site} -# $manage_dogapi_gem -# When reports are enabled, ensure the dogapi gem (required) is installed. -# $puppetmaster_user -# Will chown the api key used by the report processor to this user. -# Defaults to the user the puppetmaster is configured to run as. -# $non_local_traffic -# Enable you to use the agent as a proxy. Defaults to false. -# See https://github.com/DataDog/dd-agent/wiki/Proxy-Configuration -# $dogstreams -# Optional array of logs to parse and custom parsers to use. -# See https://github.com/DataDog/dd-agent/blob/ed5e698/datadog.conf.example#L149-L178 -# $log_level -# Set value of 'log_level' variable. Default is 'info' as in dd-agent. -# Valid values here are: critical, debug, error, fatal, info, warn and warning. -# $hostname_extraction_regex -# Completely optional. -# Instead of reporting the puppet nodename, use this regex to extract the named -# 'hostname' captured group to report the run in Datadog. -# ex.: '^(?.*\.datadoghq\.com)(\.i-\w{8}\..*)?$' -# $hostname_fqdn -# Make the agent use "hostname -f" on unix-based systems as a last resort -# way of determining the hostname instead of Golang "os.Hostname()" -# This will be enabled by default in version 6.6 -# More information at https://dtdg.co/flag-hostname-fqdn -# Optional: Valid values here are: true or false. -# $log_to_syslog -# Set value of 'log_to_syslog' variable. Default is true -> yes as in dd-agent. -# Valid values here are: true or false. -# $report_fact_tags -# Sets tags for report events sent to Datadog from specified facts -# $report_trusted_fact_tags -# Sets tags for report events sent to Datadog from specified trusted facts -# $statsd_forward_host -# Set the value of the statsd_forward_host varable. Used to forward all -# statsd metrics to another host. -# $manage_repo -# Deprecated. Only works for RPM. Install datadog-agent manually and then set -# manage_install=false to achieve the same behaviour as setting this to false. -# $manage_install -# Boolean to indicate whether this module should attempt to install the -# Agent, or assume it will be installed by other means. Default true. -# $graphite_listen_port -# Set graphite listener port -# $extra_template -# Optional, append this extra template file at the end of -# the default datadog.conf template -# $skip_apt_key_trusting -# Skip trusting the apt key. Default is false. Useful if you have a -# separate way of adding keys. -# $skip_ssl_validation -# Skip SSL validation. -# $use_curl_http_client -# Uses the curl HTTP client for the forwarder -# $recent_point_threshold -# Sets the threshold for accepting points. +# @param dd_url +# The host of the Datadog intake server to send agent data to. +# Defaults to https://app.datadoghq.com. +# @param datadog_site +# The site of the Datadog intake to send Agent data to. Defaults to 'datadoghq.com', +# can be set to 'datadoghq.eu' to send data to the EU site or 'us3.datadoghq.com'. +# This option is only available with agent version >= 6.6.0. +# @param host +# Force the hostname to whatever you want. (default: auto-detected) +# @param api_key +# Your DataDog API Key. Please replace with your key value. +# @param agent_flavor +# Linux-only. The Agent flavor to install, eg: "datadog-agent" or "datadog-iot-agent". +# @param collect_ec2_tags +# Collect AWS EC2 custom tags as agent tags. +# Boolean. Default: false +# @param collect_gce_tags +# Collect Google Cloud Engine metadata as agent tags. +# Boolean. Default: false +# @param collect_instance_metadata +# The Agent will try to collect instance metadata for EC2 and GCE instances. +# Boolean. Default: true +# @param tags +# Optional array of tags. +# @param integrations +# @param hiera_integrations +# @param hiera_tags +# Boolean to grab tags from hiera to allow merging +# @param facts_to_tags +# Optional array of facts' names that you can use to define tags following the scheme: "fact_name:fact_value". +# See also trusted_facts_to_tags. +# Note: this is not for Puppet Report Tags. See report_fact_tags +# @param trusted_facts_to_tags +# Optional array of trusted facts' names that you can use to define tags following +# the scheme: "fact_name:fact_value". +# Note: this is not for Puppet Report Tags. See report_trusted_fact_tags +# @param puppet_run_reports +# Will send results from your puppet agent runs back to the datadog service. +# @param reports_url +# The URL to use when sending puppet run reports. Default: https://api.${datadog_site} +# @param puppetmaster_user +# Will chown the api key used by the report processor to this user. +# Defaults to the user the puppetmaster is configured to run as. +# @param puppet_gem_provider +# @param non_local_traffic +# Enable you to use the agent as a proxy. Defaults to false. +# See https://github.com/DataDog/dd-agent/wiki/Proxy-Configuration +# @param dogstreams +# Optional array of logs to parse and custom parsers to use. +# See https://github.com/DataDog/dd-agent/blob/ed5e698/datadog.conf.example#L149-L178 +# Specifies port for list of logstreams/modules to be used. +# String. Default: empty +# @param log_level +# Set value of 'log_level' variable. Default is 'info' as in dd-agent. +# Valid values here are: critical, debug, error, fatal, info, warn and warning. +# @param log_to_syslog +# Set value of 'log_to_syslog' variable. Default is true -> yes as in dd-agent. +# Valid values here are: true or false. +# @param service_ensure +# @param service_enable +# @param manage_repo +# Deprecated. Only works for RPM. Install datadog-agent manually and then set +# manage_install=false to achieve the same behaviour as setting this to false. +# @param manage_dogapi_gem +# When reports are enabled, ensure the dogapi gem (required) is installed. +# @param manage_install +# Boolean to indicate whether this module should attempt to install the +# Agent, or assume it will be installed by other means. Default true. +# @param hostname_extraction_regex +# Completely optional. +# Instead of reporting the puppet nodename, use this regex to extract the named +# 'hostname' captured group to report the run in Datadog. +# ex.: '^(?.*\.datadoghq\.com)(\.i-\w{8}\..*)?$' +# @param hostname_fqdn +# Make the agent use "hostname -f" on unix-based systems as a last resort +# way of determining the hostname instead of Golang "os.Hostname()" +# This will be enabled by default in version 6.6 +# More information at https://dtdg.co/flag-hostname-fqdn +# Optional: Valid values here are: true or false. +# @param dogstatsd_port +# Specifies the port to be used by dogstatsd. Must have use_dogstatsd set +# String. Default: 8125 +# @param dogstatsd_socket +# Specifies the socket file to be used by dogstatsd. Must have use_dogstatsd set +# String. Default: empty +# @param report_fact_tags +# Sets tags for report events sent to Datadog from specified facts +# @param report_trusted_fact_tags +# Sets tags for report events sent to Datadog from specified trusted facts +# @param statsd_forward_host +# Set the value of the statsd_forward_host variable. Used to forward all +# statsd metrics to another host. +# Enables forwarding of statsd packetsto host. Must have use_dogstatsd set +# String. Default: empty +# @param statsd_forward_port +# Specifies port for $statsd_forward_host. Must have use_dogstatsd set String. +# Used to forward all statsd metrics to another host. +# Default: empty +# @param statsd_histogram_percentiles +# @param proxy_host +# @param proxy_port +# @param proxy_user +# @param proxy_password +# @param graphite_listen_port +# Set graphite listener port +# @param extra_template +# Optional, append this extra template file at the end of +# the default datadog.conf template +# @param ganglia_host +# Specifies host where gmetad is running +# String. Default: empty +# @param ganglia_port +# Specifies port for $ganglia_host +# String. Default: empty +# @param skip_ssl_validation +# Skip SSL validation. +# @param skip_apt_key_trusting +# Skip trusting the apt key. Default is false. Useful if you have a +# separate way of adding keys. +# @param use_curl_http_client +# Uses the curl HTTP client for the forwarder +# @param recent_point_threshold +# Sets the threshold for accepting points. # String. Default: empty (30 second intervals) -# $listen_port -# Change the port that the agent listens on -# String. Default: empty (port 17123 in dd-agent) -# $additional_checksd -# Additional directory to look for datadog checks in -# String. Default: undef -# $bind_host -# The loopback address the forwarder and Dogstatsd will bind. -# String. Default: empty -# $use_pup -# Enables the local pup dashboard -# Boolean. Default: false -# $pup_port -# Specifies the port to be used by pup. Must have use_pup set -# String. Default: empty -# $pup_interface -# Specifies which interface pup will use. Must have use_pup set -# String. Default: empty -# $pup_url -# Specifies the URL used to access pup. Must have use_pup set -# String. Default: empty -# $use_dogstatsd -# Enables the dogstatsd server -# Boolean. Default: true -# $dogstatsd_socket -# Specifies the socket file to be used by dogstatsd. Must have use_dogstatsd set -# String. Default: empty -# $dogstatsd_port -# Specifies the port to be used by dogstatsd. Must have use_dogstatsd set -# String. Default: 8125 -# $dogstatsd_target -# Change the target to be used by dogstatsd. Must have use_dogstatsd set -# set -# String. Default: empty -# $dogstatsd_interval -# Change the dogstatsd flush period. Must have use_dogstatsd set -# String. Default: empty ( 10 second interval) -# $dogstatsd_normalize -# Enables 1 second nomralization. Must have use_dogstatsd set -# Boolean. Default: true -# $statsd_forward_host -# Enables forwarding of statsd packetsto host. Must have use_dogstatsd set -# String. Default: empty -# $statsd_forward_port -# Specifies port for $statsd_forward_host. Must have use_dogstatsd set String. -# Used to forward all statsd metrics to another host. -# Default: empty -# $device_blacklist_re -# Specifies pattern for device blacklisting. -# String. Default: empty -# $ganglia_host -# Specifies host where gmetad is running -# String. Default: empty -# $ganglia_port -# Specifies port for $ganglia_host -# String. Default: empty -# $dogstreams -# Specifies port for list of logstreams/modules to be used. -# String. Default: empty -# $custom_emitters -# Specifies a comma seperated list of non standard emitters to be used -# String. Default: empty -# $custom_emitters -# Specifies a comma seperated list of non standard emitters to be used -# String. Default: empty -# $agent_log_file -# Specifies the log file location (Agent 6 and 7 only). -# String. Default: empty -# $collector_log_file -# Specifies the log file location for the collector system -# String. Default: empty -# $forwarder_log_file -# Specifies the log file location for the forwarder system -# String. Default: empty -# $dogstatsd -# Specifies the log file location for the dogstatsd system -# String. Default: empty -# $pup_log_file -# Specifies the log file location for the pup system -# String. Default: empty -# $apm_enabled -# Boolean to enable or disable the trace agent -# Boolean. Default: false -# $apm_env -# String defining the environment for the APM traces -# String. Default: non -# $apm_non_local_traffic -# Accept non local apm traffic. Defaults to false. -# Boolean. Default: false -# $apm_analyzed_spans -# Hash defining the APM spans to analyze and their rates. -# Optional Hash. Default: undef. -# $apm_obfuscation -# Hash defining obfuscation rules for sensitive data. (Agent 6 and 7 only). -# Optional Hash. Default: undef -# $process_enabled -# String to enable the process/container agent -# Boolean. Default: false -# $scrub_args -# Boolean to enable or disable the process cmdline scrubbing by the process-agent -# Boolean. Default: true -# $custom_sensitive_words -# Array to add more words to be used on the process cdmline scrubbing by the process-agent -# Array. Default: [] -# $logs_enabled -# Boolean to enable or disable the logs agent -# Boolean. Default: false -# $logs_open_files_limit -# Integer set the max number of open files for the logs agent -# Integer. Default: 100 if undef -# $container_collect_all -# Boolean to enable logs collection for all containers -# Boolean. Default: false -# $cmd_port -# The port on which the IPC api listens -# Integer. Default: 5001 -# $agent_repo_uri -# Where to download the agent from. When undef, it uses the following defaults: -# APT: https://apt.datadoghq.com/ -# RPM: https://yum.datadoghq.com/stable/7/x86_64/ (with matching agent version and architecture) -# Windows: https://https://s3.amazonaws.com/ddagent-windows-stable/ -# String. Default: undef -# $rpm_repo_gpgcheck -# Whether or not to perform repodata signature check for RPM repositories. -# Applies to Red Hat and SUSE platforms. When set to `undef`, this is activated -# for all Agent versions other than 5 when `agent_repo_uri` is also undefinded. -# The `undef` value also translates to `false` on RHEL/CentOS 8.1 because -# of a bug in libdnf: https://bugzilla.redhat.com/show_bug.cgi?id=1792506 -# Boolean. Default: undef -# $apt_release -# The distribution channel to be used for the APT repo. Eg: 'stable' or 'beta'. -# String. Default: stable -# $windows_npm_install -# (Windows only) Boolean to install the Windows NPM driver. -# To use NPM features it is necessary to enable install through this flag, as well as -# configuring NPM through the datadog::system_probe class. -# Boolean. Default: false -# $windows_ddagentuser_name -# (Windows only) The name of Windows user to use, in the format `\`. +# @param listen_port +# Change the port that the agent listens on +# String. Default: empty (port 17123 in dd-agent) +# @param additional_checksd +# Additional directory to look for datadog checks in +# String. Default: undef +# @param bind_host +# The loopback address the forwarder and Dogstatsd will bind. +# String. Default: empty +# @param use_pup +# Enables the local pup dashboard +# Boolean. Default: false +# @param pup_port +# Specifies the port to be used by pup. Must have use_pup set +# String. Default: empty +# @param pup_interface +# Specifies which interface pup will use. Must have use_pup set +# String. Default: empty +# @param pup_url +# Specifies the URL used to access pup. Must have use_pup set +# String. Default: empty +# @param use_dogstatsd +# Enables the dogstatsd server +# Boolean. Default: true +# @param dogstatsd_target +# Change the target to be used by dogstatsd. Must have use_dogstatsd set +# set +# String. Default: empty +# @param dogstatsd_interval +# Change the dogstatsd flush period. Must have use_dogstatsd set +# String. Default: empty ( 10 second interval) +# @param dogstatsd_normalize +# Enables 1 second nomralization. Must have use_dogstatsd set +# Boolean. Default: true +# @param device_blacklist_re +# Specifies pattern for device blacklisting. +# String. Default: empty +# @param custom_emitters +# Specifies a comma seperated list of non standard emitters to be used +# String. Default: empty +# @param agent_log_file +# Specifies the log file location (Agent 6 and 7 only). +# String. Default: empty +# @param collector_log_file +# Specifies the log file location for the collector system +# String. Default: empty +# @param forwarder_log_file +# Specifies the log file location for the forwarder system +# String. Default: empty +# @param dogstatsd_log_file +# @param pup_log_file +# Specifies the log file location for the pup system +# String. Default: empty +# @param syslog_host +# @param syslog_port +# @param service_discovery_backend +# @param sd_config_backend +# @param sd_backend_host +# @param sd_backend_port +# @param sd_template_dir +# @param sd_jmx_enable +# @param consul_token +# @param cmd_port +# The port on which the IPC api listens +# Integer. Default: 5001 +# @param agent_major_version +# @param conf_dir +# @param conf_dir_purge +# @param dd_group +# @param dd_groups +# @param apm_enabled +# Boolean to enable or disable the trace agent +# Boolean. Default: false +# @param apm_env +# String defining the environment for the APM traces +# String. Default: non +# @param apm_non_local_traffic +# Accept non local apm traffic. Defaults to false. +# Boolean. Default: false +# @param apm_analyzed_spans +# Hash defining the APM spans to analyze and their rates. +# Optional Hash. Default: undef. +# @param apm_obfuscation +# Hash defining obfuscation rules for sensitive data. (Agent 6 and 7 only). +# Optional Hash. Default: undef +# @param process_enabled +# String to enable the process/container agent +# Boolean. Default: false +# @param scrub_args +# Boolean to enable or disable the process cmdline scrubbing by the process-agent +# Boolean. Default: true +# @param custom_sensitive_words +# Array to add more words to be used on the process cdmline scrubbing by the process-agent +# Array. Default: [] +# @param logs_enabled +# Boolean to enable or disable the logs agent +# Boolean. Default: false +# @param logs_open_files_limit +# Integer set the max number of open files for the logs agent +# Integer. Default: 100 if undef +# @param container_collect_all +# Boolean to enable logs collection for all containers +# Boolean. Default: false +# @param agent_extra_options +# @param agent_repo_uri +# Where to download the agent from. When undef, it uses the following defaults: +# APT: https://apt.datadoghq.com/ +# RPM: https://yum.datadoghq.com/stable/7/x86_64/ (with matching agent version and architecture) +# Windows: https://https://s3.amazonaws.com/ddagent-windows-stable/ +# String. Default: undef +# @param rpm_repo_gpgcheck +# Whether or not to perform repodata signature check for RPM repositories. +# Applies to Red Hat and SUSE platforms. When set to `undef`, this is activated +# for all Agent versions other than 5 when `agent_repo_uri` is also undefinded. +# The `undef` value also translates to `false` on RHEL/CentOS 8.1 because +# of a bug in libdnf: https://bugzilla.redhat.com/show_bug.cgi?id=1792506 +# Boolean. Default: undef +# @param use_apt_backup_keyserver +# @param apt_backup_keyserver +# @param apt_keyserver +# @param apt_release +# The distribution channel to be used for the APT repo. Eg: 'stable' or 'beta'. +# String. Default: stable +# @param win_msi_location +# @param win_ensure +# @param service_provider +# @param agent_version +# @param windows_npm_install +# (Windows only) Boolean to install the Windows NPM driver. +# To use NPM features it is necessary to enable install through this flag, as well as +# configuring NPM through the datadog::system_probe class. +# Boolean. Default: false +# @param windows_ddagentuser_name +# (Windows only) The name of Windows user to use, in the format `\`. +# @param windows_ddagentuser_password +# (Windows only) The password used to register the service`. # -# $windows_ddagentuser_password -# (Windows only) The password used to register the service`. # -# Sample Usage: +# @example +# include datadog_agent # -# include datadog_agent +# @example +# class { 'datadog_agent': +# api_key => 'your key', +# tags => ['env:production', 'linux'], +# puppet_run_reports => false, +# puppetmaster_user => puppet, +# } # -# OR # -# class { 'datadog_agent': -# api_key => 'your key', -# tags => ['env:production', 'linux'], -# puppet_run_reports => false, -# puppetmaster_user => puppet, -# } -# -# -class datadog_agent( +class datadog_agent ( + # lint:ignore:params_empty_string_assignment String $dd_url = '', String $datadog_site = $datadog_agent::params::datadog_site, String $host = '', @@ -264,8 +286,8 @@ Boolean $collect_gce_tags = false, Boolean $collect_instance_metadata = true, Array $tags = [], - $integrations = {}, - $hiera_integrations = false, + Hash $integrations = {}, + Boolean $hiera_integrations = false, Boolean $hiera_tags = false, Array $facts_to_tags = [], Array $trusted_facts_to_tags = [], @@ -277,15 +299,15 @@ Array $dogstreams = [], String $log_level = 'info', Boolean $log_to_syslog = true, - $service_ensure = 'running', - $service_enable = true, + String $service_ensure = 'running', + Boolean $service_enable = true, Boolean $manage_repo = true, Boolean $manage_dogapi_gem = true, Boolean $manage_install = true, - $hostname_extraction_regex = undef, + Optional[String] $hostname_extraction_regex = undef, Boolean $hostname_fqdn = false, Variant[Stdlib::Port, Pattern[/^\d*$/]] $dogstatsd_port = 8125, - $dogstatsd_socket = '', + String $dogstatsd_socket = '', Array $report_fact_tags = [], Array $report_trusted_fact_tags = [], String $statsd_forward_host = '', @@ -298,7 +320,7 @@ Variant[Stdlib::Port, Pattern[/^\d*$/]] $graphite_listen_port = '', String $extra_template = '', String $ganglia_host = '', - $ganglia_port = 8651, + Stdlib::Port $ganglia_port = 8651, Boolean $skip_ssl_validation = false, Boolean $skip_apt_key_trusting = false, Boolean $use_curl_http_client = false, @@ -334,8 +356,8 @@ Optional[Integer] $agent_major_version = undef, Optional[String] $conf_dir = undef, Boolean $conf_dir_purge = $datadog_agent::params::conf_dir_purge, - $dd_group = $datadog_agent::params::dd_group, - $dd_groups = $datadog_agent::params::dd_groups, + String $dd_group = $datadog_agent::params::dd_group, + Optional[String] $dd_groups = $datadog_agent::params::dd_groups, Boolean $apm_enabled = $datadog_agent::params::apm_default_enabled, String $apm_env = 'none', Boolean $apm_non_local_traffic = false, @@ -345,7 +367,7 @@ Boolean $scrub_args = $datadog_agent::params::process_default_scrub_args, Array $custom_sensitive_words = $datadog_agent::params::process_default_custom_words, Boolean $logs_enabled = $datadog_agent::params::logs_enabled, - $logs_open_files_limit = $datadog_agent::params::logs_open_files_limit, + Optional[Integer] $logs_open_files_limit = $datadog_agent::params::logs_open_files_limit, Boolean $container_collect_all = $datadog_agent::params::container_collect_all, Hash[String[1], Data] $agent_extra_options = {}, Optional[String] $agent_repo_uri = undef, @@ -357,15 +379,15 @@ Optional[String] $apt_keyserver = undef, String $apt_release = $datadog_agent::params::apt_default_release, String $win_msi_location = 'C:/Windows/temp', # Temporary directory where the msi file is downloaded, must exist - Enum['present', 'absent'] $win_ensure = 'present', #TODO: Implement uninstall also for apt and rpm install methods + Enum['present', 'absent'] $win_ensure = 'present', # TODO: Implement uninstall also for apt and rpm install methods Optional[String] $service_provider = undef, Optional[String] $agent_version = $datadog_agent::params::agent_version, Boolean $windows_npm_install = false, Optional[String] $windows_ddagentuser_name = undef, Optional[String] $windows_ddagentuser_password = undef, + # lint:endignore ) inherits datadog_agent::params { - - #In this regex, version '1:6.15.0~rc.1-1' would match as $1='1:', $2='6', $3='15', $4='0', $5='~rc.1', $6='1' + # In this regex, version '1:6.15.0~rc.1-1' would match as $1='1:', $2='6', $3='15', $4='0', $5='~rc.1', $6='1' if $agent_version != 'latest' and $agent_version =~ /([0-9]+:)?([0-9]+)\.([0-9]+)\.([0-9]+)((?:~|-)[^0-9\s-]+[^-\s]*)?(?:-([0-9]+))?/ { $_agent_major_version = 0 + $2 # Cast to integer if $agent_major_version != undef and $agent_major_version != $_agent_major_version { @@ -398,13 +420,13 @@ } if $hiera_tags { - $local_tags = lookup({ 'name' => 'datadog_agent::tags', 'merge' => 'unique', 'default_value' => []}) + $local_tags = lookup({ 'name' => 'datadog_agent::tags', 'merge' => 'unique', 'default_value' => [] }) } else { $local_tags = $tags } if $hiera_integrations { - $local_integrations = lookup({ 'name' => 'datadog_agent::integrations', 'default_value' => {}}) + $local_integrations = lookup({ 'name' => 'datadog_agent::integrations', 'default_value' => {} }) } else { $local_integrations = $integrations } @@ -465,7 +487,7 @@ ddagentuser_password => $windows_ddagentuser_password, } if ($win_ensure == absent) { - return() #Config files will remain unchanged on uninstall + return() # Config files will remain unchanged on uninstall } } 'OpenSuSE', 'SLES' : { @@ -515,13 +537,12 @@ } if $_agent_major_version == 5 { - - if ($facts['os']['name'] == 'Windows') { + if $facts['os']['name'] == 'Windows' { fail('Installation of agent 5 with puppet is not supported on Windows') } if !empty($agent_extra_options) { - notify { 'Setting agent_extra_options has no effect with Agent 5': } + notify { 'Setting agent_extra_options has no effect with Agent 5': } } file { '/etc/dd-agent': @@ -539,10 +560,10 @@ force => $conf_dir_purge, owner => $dd_user, group => $dd_group, - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } - concat {'/etc/dd-agent/datadog.conf': + concat { '/etc/dd-agent/datadog.conf': owner => $dd_user, group => $dd_group, mode => '0640', @@ -555,31 +576,31 @@ } else { $_dd_url = $dd_url } - concat::fragment{ 'datadog header': + concat::fragment { 'datadog header': target => '/etc/dd-agent/datadog.conf', content => template('datadog_agent/datadog_header.conf.erb'), order => '01', } - concat::fragment{ 'datadog tags': + concat::fragment { 'datadog tags': target => '/etc/dd-agent/datadog.conf', content => 'tags: ', order => '02', } - datadog_agent::tag5{$local_tags: } - datadog_agent::tag5{$facts_to_tags: + datadog_agent::tag5 { $local_tags: } + datadog_agent::tag5 { $facts_to_tags: lookup_fact => true, } - concat::fragment{ 'datadog footer': + concat::fragment { 'datadog footer': target => '/etc/dd-agent/datadog.conf', content => template('datadog_agent/datadog_footer.conf.erb'), order => '05', } unless $extra_template.empty { - concat::fragment{ 'datadog extra_template footer': + concat::fragment { 'datadog extra_template footer': target => '/etc/dd-agent/datadog.conf', content => template($extra_template), order => '06', @@ -587,7 +608,7 @@ } if ($apm_enabled == true) and (($apm_env != 'none') or $apm_analyzed_spans or $apm_obfuscation) { - concat::fragment{ 'datadog apm footer': + concat::fragment { 'datadog apm footer': target => '/etc/dd-agent/datadog.conf', content => template('datadog_agent/datadog_apm_footer.conf.erb'), order => '07', @@ -595,58 +616,57 @@ } if ($process_enabled == true) { - concat::fragment{ 'datadog process agent footer': + concat::fragment { 'datadog process agent footer': target => '/etc/dd-agent/datadog.conf', content => template('datadog_agent/datadog_process_footer.conf.erb'), order => '08', } } - file {'/etc/dd-agent/install_info': + file { '/etc/dd-agent/install_info': owner => $dd_user, group => $dd_group, mode => '0640', content => template('datadog_agent/install_info.erb'), require => File['/etc/dd-agent'], } - - } else { #Agent 6/7 + } else { # Agent 6/7 # notify of broken params on agent6/7 if !empty($proxy_host) { - notify { 'Setting proxy_host is only used with Agent 5. Please use agent_extra_options to set your proxy': } + notify { 'Setting proxy_host is only used with Agent 5. Please use agent_extra_options to set your proxy': } } if !empty($proxy_port) { - notify { 'Setting proxy_port is only used with Agent 5. Please use agent_extra_options to set your proxy': } + notify { 'Setting proxy_port is only used with Agent 5. Please use agent_extra_options to set your proxy': } } if !empty($proxy_user) { - notify { 'Setting proxy_user is only used with Agent 5. Please use agent_extra_options to set your proxy': } + notify { 'Setting proxy_user is only used with Agent 5. Please use agent_extra_options to set your proxy': } } if !empty($proxy_password) { - notify { 'Setting proxy_password is only used with Agent 5. Please use agent_extra_options to set your proxy': } + notify { 'Setting proxy_password is only used with Agent 5. Please use agent_extra_options to set your proxy': } } # lint:ignore:quoted_booleans $process_enabled_str = $process_enabled ? { true => 'true' , default => 'disabled' } # lint:endignore $base_extra_config = { - 'apm_config' => { - 'enabled' => $apm_enabled, - 'env' => $apm_env, - 'apm_non_local_traffic' => $apm_non_local_traffic - }, - 'process_config' => { - 'enabled' => $process_enabled_str, - 'scrub_args' => $scrub_args, - 'custom_sensitive_words' => $custom_sensitive_words, - }, - 'logs_enabled' => $logs_enabled, + 'apm_config' => { + 'enabled' => $apm_enabled, + 'env' => $apm_env, + 'apm_non_local_traffic' => $apm_non_local_traffic, + }, + 'process_config' => { + 'enabled' => $process_enabled_str, + 'scrub_args' => $scrub_args, + 'custom_sensitive_words' => $custom_sensitive_words, + }, + 'logs_enabled' => $logs_enabled, } if $logs_open_files_limit { $logs_base_config = { 'logs_config' => { 'container_collect_all' => $container_collect_all, - 'open_files_limit' => $logs_open_files_limit + 'open_files_limit' => $logs_open_files_limit, }, } } else { @@ -657,65 +677,66 @@ } } if $host.empty { - $host_config = {} + $host_config = {} } else { - $host_config = { - 'hostname' => $host, - } + $host_config = { + 'hostname' => $host, + } } if $apm_analyzed_spans { - $apm_analyzed_span_config = { - 'apm_config' => { - 'analyzed_spans' => $apm_analyzed_spans - } - } + $apm_analyzed_span_config = { + 'apm_config' => { + 'analyzed_spans' => $apm_analyzed_spans, + }, + } } else { - $apm_analyzed_span_config = {} + $apm_analyzed_span_config = {} } if $apm_obfuscation { - $apm_obfuscation_config = { - 'apm_config' => { - 'obfuscation' => $apm_obfuscation - } - } + $apm_obfuscation_config = { + 'apm_config' => { + 'obfuscation' => $apm_obfuscation, + }, + } } else { - $apm_obfuscation_config = {} + $apm_obfuscation_config = {} } if $statsd_forward_host.empty { - $statsd_forward_config = {} + $statsd_forward_config = {} } else { - if String($statsd_forward_port).empty { - $statsd_forward_config = { - 'statsd_forward_host' => $statsd_forward_host, - } - } else { - $statsd_forward_config = { - 'statsd_forward_host' => $statsd_forward_host, - 'statsd_forward_port' => $statsd_forward_port, - } + if String($statsd_forward_port).empty { + $statsd_forward_config = { + 'statsd_forward_host' => $statsd_forward_host, + } + } else { + $statsd_forward_config = { + 'statsd_forward_host' => $statsd_forward_host, + 'statsd_forward_port' => $statsd_forward_port, } + } } if $additional_checksd { - $additional_checksd_config = { - 'additional_checksd' => $additional_checksd, - } + $additional_checksd_config = { + 'additional_checksd' => $additional_checksd, + } } else { - $additional_checksd_config = {} + $additional_checksd_config = {} } $extra_config = deep_merge( - $base_extra_config, - $logs_base_config, - $agent_extra_options, - $apm_analyzed_span_config, - $apm_obfuscation_config, - $statsd_forward_config, - $host_config, - $additional_checksd_config) + $base_extra_config, + $logs_base_config, + $agent_extra_options, + $apm_analyzed_span_config, + $apm_obfuscation_config, + $statsd_forward_config, + $host_config, + $additional_checksd_config + ) file { $_conf_dir: ensure => directory, @@ -724,7 +745,7 @@ force => $conf_dir_purge, owner => $dd_user, group => $dd_group, - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $_local_tags = datadog_agent::tag6($local_tags, false, undef) @@ -751,12 +772,9 @@ $agent_config = deep_merge($_agent_config, $extra_config) - - if ($facts['os']['name'] == 'Windows') { - - + if $facts['os']['name'] == 'Windows' { file { 'C:/ProgramData/Datadog': - ensure => directory + ensure => directory, } file { 'C:/ProgramData/Datadog/datadog.yaml': @@ -776,9 +794,7 @@ content => template('datadog_agent/install_info.erb'), require => File['C:/ProgramData/Datadog'], } - } else { - file { '/etc/datadog-agent/datadog.yaml': owner => $dd_user, group => $dd_group, @@ -796,9 +812,7 @@ content => template('datadog_agent/install_info.erb'), require => File['/etc/datadog-agent'], } - } - } if $puppet_run_reports { @@ -827,5 +841,4 @@ } create_resources('datadog_agent::integration', $local_integrations) - } diff --git a/manifests/install_integration.pp b/manifests/install_integration.pp index ab661f10..98ab1a2a 100644 --- a/manifests/install_integration.pp +++ b/manifests/install_integration.pp @@ -1,14 +1,20 @@ +# @summary Install Integration +# +# +# @param ensure +# @param integration_name +# @param version +# @param third_party +# define datadog_agent::install_integration ( Enum['present', 'absent'] $ensure = 'present', String $integration_name = undef, String $version = undef, Boolean $third_party = false, -){ - - require ::datadog_agent +) { + require datadog_agent if $ensure == 'present' { - if $third_party { $install_cmd = 'install --third-party' } else { @@ -31,5 +37,4 @@ notify => Service[$datadog_agent::params::service_name], } } - } diff --git a/manifests/integration.pp b/manifests/integration.pp index 7824c94c..29218706 100644 --- a/manifests/integration.pp +++ b/manifests/integration.pp @@ -1,3 +1,13 @@ +# @summary Manage Integration +# +# +# @param instances +# @param init_config +# @param logs +# @param integration +# @param conf_file +# @param ensure +# define datadog_agent::integration ( Array $instances = [], Optional[Hash] $init_config = undef, @@ -5,13 +15,12 @@ String $integration = $title, String $conf_file = 'conf', Enum['present', 'absent'] $ensure = 'present', -){ - +) { # We can't `require ::datadog_agent` from here since this class is used by the # datadog_agent class, causing a dependency cycle. If using this class # directly, you should define datadog_agent before datadog_agent::integration. - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/${integration}.d" $dst = "${dst_dir}/${$conf_file}.yaml" if (! defined(File[$dst_dir])) { @@ -20,14 +29,14 @@ owner => $datadog_agent::dd_user, group => $datadog_agent::dd_group, mode => $datadog_agent::params::permissions_directory, - before => File[$dst] + before => File[$dst], } } } else { $dst = "${datadog_agent::params::legacy_conf_dir}/${integration}.yaml" } - $file_ensure = $ensure ? { default => file, 'absent' => absent } + $file_ensure = $ensure ? { default => 'file', 'absent' => absent } file { $dst: ensure => $file_ensure, @@ -35,7 +44,6 @@ group => $datadog_agent::dd_group, mode => $datadog_agent::params::permissions_file, content => to_instances_yaml($init_config, $instances, $logs), - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } - } diff --git a/manifests/integrations/activemq_xml.pp b/manifests/integrations/activemq_xml.pp index ac1ecbb1..fee011d0 100644 --- a/manifests/integrations/activemq_xml.pp +++ b/manifests/integrations/activemq_xml.pp @@ -1,34 +1,34 @@ -# Class: datadog_agent::integrations::activemq_xml +# @summary Install the necessary configuration for the activemq_xml integration # -# This class will install the necessary configuration for the activemq_xml integration # -# Parameters: -# $url -# ActiveMQ administration web URL to gather the activemq_xml stats from. -# $username -# Username to use for authentication - optional -# $password -# Password to use for authentication - optional -# $supress_errors -# Supress connection errors if URL is expected to be offline at times (eg. standby host) - optional -# $detailed_queues -# List of queues to monitor, required if you have more than 300 queues you wish to track, otherwise optional. -# $detailed_topics -# List of topics to monitor, required if you have more than 300 topics you wish to track, otherwise optional. -# $detailed_subscribers -# List of subscribers to monitor, required if you have more than 300 subscribers you wish to track, otherwise optional. +# @param url +# ActiveMQ administration web URL to gather the activemq_xml stats from. +# @param supress_errors +# Supress connection errors if URL is expected to be offline at times (eg. standby host) - optional +# @param username +# Username to use for authentication - optional +# @param password +# Password to use for authentication - optional +# @param detailed_queues +# List of queues to monitor, required if you have more than 300 queues you wish to track, otherwise optional. +# @param detailed_topics +# List of topics to monitor, required if you have more than 300 topics you wish to track, otherwise optional. +# @param detailed_subscribers +# List of subscribers to monitor, required if you have more than 300 subscribers you wish to track, otherwise optional. +# @param instances +# Array of Intances # -# Sample Usage: +# @example +# class { 'datadog_agent::integrations::activemq_xml' : +# url => 'http://localhost:8161', +# username => 'datadog', +# password => 'some_pass', +# supress_errors => false, +# detailed_queues => ['queue1', 'queue2', 'queue3'], +# detailed_topics => ['topic1', 'topic2', 'topic3'], +# detailed_subscribers => ['subscriber1', 'subscriber2', 'subscriber3'], +# } # -# class { 'datadog_agent::integrations::activemq_xml' : -# url => 'http://localhost:8161', -# username => 'datadog', -# password => 'some_pass', -# supress_errors => false, -# detailed_queues => ['queue1', 'queue2', 'queue3'], -# detailed_topics => ['topic1', 'topic2', 'topic3'], -# detailed_subscribers => ['subscriber1', 'subscriber2', 'subscriber3'], -# } # # Hiera Usage: # @@ -42,23 +42,23 @@ # detailed_subscribers: ['subscriber1', 'subscriber2', 'subscriber3'] # # -class datadog_agent::integrations::activemq_xml( - String $url = 'http://localhost:8161', - Boolean $supress_errors = false, - Optional[String] $username = undef, - Optional[String] $password = undef, - Optional[Array[String]] $detailed_queues = [], - Optional[Array[String]] $detailed_topics = [], - Optional[Array[String]] $detailed_subscribers = [], - Optional[Array] $instances = undef, +class datadog_agent::integrations::activemq_xml ( + String $url = 'http://localhost:8161', + Boolean $supress_errors = false, + Optional[String] $username = undef, + Optional[String] $password = undef, + Array[String] $detailed_queues = [], + Array[String] $detailed_topics = [], + Array[String] $detailed_subscribers = [], + Optional[Array] $instances = undef, ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/activemq_xml.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/activemq_xml.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -67,7 +67,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { @@ -76,15 +76,15 @@ if !$instances and $url { $_instances = [{ - 'url' => $url, - 'username' => $username, - 'password' => $password, - 'supress_errors' => $supress_errors, - 'detailed_queues' => $detailed_queues, - 'detailed_topics' => $detailed_topics, - 'detailed_subscribers' => $detailed_subscribers, + 'url' => $url, + 'username' => $username, + 'password' => $password, + 'supress_errors' => $supress_errors, + 'detailed_queues' => $detailed_queues, + 'detailed_topics' => $detailed_topics, + 'detailed_subscribers' => $detailed_subscribers, }] - } elsif !$instances{ + } elsif !$instances { $_instances = [] } else { $_instances = $instances diff --git a/manifests/integrations/apache.pp b/manifests/integrations/apache.pp index b6de7fc1..b2796a68 100644 --- a/manifests/integrations/apache.pp +++ b/manifests/integrations/apache.pp @@ -1,30 +1,28 @@ -# Class: datadog_agent::integrations::apache +# @summary Install the necessary configuration for the apache integration # -# This class will install the necessary configuration for the apache integration # -# Parameters: -# $url: -# The URL for apache status URL handled by mod-status. -# Defaults to http://localhost/server-status?auto -# $username: -# $password: -# If your service uses basic authentication, you can optionally -# specify a username and password that will be used in the check. -# Optional. -# $tags -# Optional array of tags +# @param url +# The URL for apache status URL handled by mod-status. +# Defaults to http://localhost/server-status?auto +# @param username +# @param password +# If your service uses basic authentication, you can optionally +# specify a username and password that will be used in the check. +# Optional. +# @param tags +# Optional array of tags +# @param disable_ssl_validation # -# Sample Usage: # -# include 'datadog_agent::integrations::apache' +# @example +# include 'datadog_agent::integrations::apache' # -# OR -# -# class { 'datadog_agent::integrations::apache': -# url => 'http://example.com/server-status?auto', -# username => 'status', -# password => 'hunter1', -# } +# @example +# class { 'datadog_agent::integrations::apache': +# url => 'http://example.com/server-status?auto', +# username => 'status', +# password => 'hunter1', +# } # class datadog_agent::integrations::apache ( String $url = 'http://localhost/server-status?auto', @@ -33,13 +31,13 @@ Array $tags = [], Boolean $disable_ssl_validation = false ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/apache.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/apache.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -48,7 +46,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { @@ -62,6 +60,6 @@ mode => $datadog_agent::params::permissions_protected_file, content => template('datadog_agent/agent-conf.d/apache.yaml.erb'), require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } } diff --git a/manifests/integrations/cacti.pp b/manifests/integrations/cacti.pp index 2f1ee0d4..ac65f15f 100644 --- a/manifests/integrations/cacti.pp +++ b/manifests/integrations/cacti.pp @@ -1,30 +1,28 @@ -# Class: datadog_agent::integrations::cacti +# @summary Install the necessary configuration for the cacti integration # -# This class will install the necessary configuration for the cacti integration # -# Parameters: -# $host: -# The host cacti MySQL db is running on -# $user -# The cacti MySQL password -# $password -# The cacti MySQL sb port. -# $path -# The path to the cacti rrd directory e.g. /var/lib/cacti/rra/ +# @param mysql_host +# The host cacti MySQL db is running on +# @param mysql_user +# The cacti MySQL password +# @param mysql_password +# The cacti MySQL sb port. +# @param rrd_path +# The path to the cacti rrd directory e.g. /var/lib/cacti/rra/ # -class datadog_agent::integrations::cacti( - $mysql_host = 'localhost', - $mysql_user = 'cacti', - $mysql_password = undef, - $rrd_path = '/var/lib/cacti/rra/', +class datadog_agent::integrations::cacti ( + Stdlib::Host $mysql_host = 'localhost', + String $mysql_user = 'cacti', + Optional[String] $mysql_password = undef, + Stdlib::Absolutepath $rrd_path = '/var/lib/cacti/rra/', ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/cacti.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/cacti.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -33,7 +31,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { @@ -47,6 +45,6 @@ mode => $datadog_agent::params::permissions_protected_file, content => template('datadog_agent/agent-conf.d/cacti.yaml.erb'), require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } } diff --git a/manifests/integrations/cassandra.pp b/manifests/integrations/cassandra.pp index 8f5e17a4..bcdbbc98 100644 --- a/manifests/integrations/cassandra.pp +++ b/manifests/integrations/cassandra.pp @@ -1,49 +1,46 @@ -# Class: datadog_agent::integrations::cassandra +# @summary Install the necessary configuration for the Cassandra integration # -# This class will install the necessary configuration for the Cassandra -# integration. -# -# This check has a limit of 350 metrics per instance. If you require +# This check has a limit of 350 metrics per instance. If you require # additional metrics, contact Datadog Support at https://docs.datadoghq.com/help/ # -# Parameters: -# $host: -# The hostname Cassandra is running on -# $port: -# The port to connect on -# $user -# The user for the datadog user -# $password -# The password for the datadog user -# $tags -# Optional array of tags # -# Sample Usage: +# @param host +# The hostname Cassandra is running on +# @param port +# The port to connect on +# @param user +# The user for the datadog user +# @param password +# The password for the datadog user +# @param tags +# Optional array of tags +# @param max_returned_metrics # -# class { 'datadog_agent::integrations::cassandra' : -# host => 'localhost', -# tags => { -# environment => "production", -# }, -# } # +# @example +# class { 'datadog_agent::integrations::cassandra' : +# host => 'localhost', +# tags => { +# environment => "production", +# }, +# } # -class datadog_agent::integrations::cassandra( - String $host = 'localhost', - Integer $port = 7199, - Optional[String] $user = undef, - Optional[String] $password = undef, - Optional[Hash] $tags = {}, +class datadog_agent::integrations::cassandra ( + String $host = 'localhost', + Integer $port = 7199, + Optional[String] $user = undef, + Optional[String] $password = undef, + Hash $tags = {}, Optional[Integer] $max_returned_metrics = undef, ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/cassandra.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/cassandra.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: ensure => directory, @@ -51,7 +48,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { diff --git a/manifests/integrations/ceph.pp b/manifests/integrations/ceph.pp index 174c8ba3..474b4189 100644 --- a/manifests/integrations/ceph.pp +++ b/manifests/integrations/ceph.pp @@ -1,33 +1,31 @@ -# Class: datadog_agent::integrations::ceph +# @summary Install the necessary configuration for the ceph integration # -# This class will install the necessary configuration for the ceph integration # -# Parameters: -# $tags +# @param tags # Optional array of tags -# $ceph_cmd +# @param ceph_cmd # Optional ceph cmd - -# Sample Usage: # -# class { 'datadog_agent::integrations::ceph' : -# } # -class datadog_agent::integrations::ceph( - Array $tags = [ 'name:ceph_cluster' ], +# @example +# class { 'datadog_agent::integrations::ceph' : +# } +# +class datadog_agent::integrations::ceph ( + Array $tags = ['name:ceph_cluster'], String $ceph_cmd = '/usr/bin/ceph', ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent file { '/etc/sudoers.d/datadog_ceph': - content => "# This file is required for dd ceph \ndd-agent ALL=(ALL) NOPASSWD:/usr/bin/ceph\n" + content => "# This file is required for dd ceph \ndd-agent ALL=(ALL) NOPASSWD:/usr/bin/ceph\n", } $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/ceph.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/ceph.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -36,7 +34,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { @@ -50,6 +48,6 @@ mode => $datadog_agent::params::permissions_protected_file, content => template('datadog_agent/agent-conf.d/ceph.yaml.erb'), require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } } diff --git a/manifests/integrations/consul.pp b/manifests/integrations/consul.pp index d999d0e8..57f63225 100644 --- a/manifests/integrations/consul.pp +++ b/manifests/integrations/consul.pp @@ -1,45 +1,44 @@ -# Class: datadog_agent::integrations::consul +# @summary Install the necessary configuration for the consul integration # -# This class will install the necessary configuration for the consul integration # -# Parameters: -# $url: -# The URL for consul -# $catalog_checks: -# Whether to perform checks against the Consul service Catalog -# Optional. -# $new_leader_checks: -# Whether to enable new leader checks from this agent -# Note: if this is set on multiple agents in the same cluster -# you will receive one event per leader change per agent -# $service_whitelist -# Services to restrict catalog querying to -# The default settings query up to 50 services. So if you have more than -# this many in your Consul service catalog, you will want to fill in the -# whitelist +# @param url +# The URL for consul +# @param catalog_checks +# Whether to perform checks against the Consul service Catalog +# Optional. +# @param network_latency_checks +# @param new_leader_checks +# Whether to enable new leader checks from this agent +# Note: if this is set on multiple agents in the same cluster +# you will receive one event per leader change per agent +# @param service_whitelist +# Services to restrict catalog querying to +# The default settings query up to 50 services. So if you have more than +# this many in your Consul service catalog, you will want to fill in the +# whitelist # -# Sample Usage: # +# @example # class { 'datadog_agent::integrations::consul' : # url => "http://localhost:8500" # catalog_checks => true, # new_leader_checks => false, # } # -class datadog_agent::integrations::consul( - String $url = 'http://localhost:8500', - Boolean $catalog_checks = true, - Boolean $network_latency_checks = true, - Boolean $new_leader_checks = true, - Optional[Array] $service_whitelist = [] +class datadog_agent::integrations::consul ( + String $url = 'http://localhost:8500', + Boolean $catalog_checks = true, + Boolean $network_latency_checks = true, + Boolean $new_leader_checks = true, + Array $service_whitelist = [] ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/consul.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/consul.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -48,7 +47,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { @@ -62,6 +61,6 @@ mode => $datadog_agent::params::permissions_file, content => template('datadog_agent/agent-conf.d/consul.yaml.erb'), require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } } diff --git a/manifests/integrations/directory.pp b/manifests/integrations/directory.pp index ca1b20cf..4a881abc 100644 --- a/manifests/integrations/directory.pp +++ b/manifests/integrations/directory.pp @@ -1,60 +1,55 @@ -# Class: datadog_agent::integrations::directory +# @summary Install the necessary config to hook the directory in the agent # -# This class will install the necessary config to hook the directory in the agent # -# Parameters: -# directory -# (Required) - string, the directory path to monitor -# This will be included as a tag: name:. +# @param directory +# (Required) - string, the directory path to monitor +# This will be included as a tag: name:. +# @param filegauges +# (Optional) - boolean, when true stats will be an individual gauge per file +# (max. 20 files!) and not a histogram of the whole directory. default False +# @param recursive +# (Optional) - boolean, when true the stats will recurse into directories. +# default False +# @param countonly +# (Optional) - boolean, when true the stats will only count the number of files +# matching the pattern. Useful for very large directories. +# @param nametag +# @param dirtagname +# (Optional) - string, the name of the key for the tag used for the directory, +# the value will be the value of "name" (see above). The resulting tag will be ":". defaults to "name" +# @param filetagname +# (Optional) - string, the name of the key for the tag used for each file, +# the value will be the filename. The resulting tag will be ":". +# defaults to "filename" +# @param pattern +# (Optional) - string, the `fnmatch` pattern to use when reading the "directory"'s files. +# The pattern will be matched against the files' absolute paths and relative paths in "directory". default "*" +# @param instances # -# name -# (Optional) - string, tag metrics with specified name. defaults to the "directory" # -# dirtagname -# (Optional) - string, the name of the key for the tag used for the directory, the value will be the value of "name" (see above). The resulting tag will be ":". defaults to "name" +# @example Add a class for each check instance: +# class { 'datadog_agent::integrations::directory': +# directory => '/opt/ftp_data', +# recursive => true, +# countonly => true, +# } # -# filetagname -# (Optional) - string, the name of the key for the tag used for each file, the value will be the filename. The resulting tag will be ":". defaults to "filename" +# @example Add multiple instances in one class declaration: +# class { 'datadog_agent::integrations::directory': +# instances => [{ +# 'directory' => '/opt/ftp_data', +# 'recursive' => true, +# 'countonly' => true, +# }, +# 'directory' => '/opt/ftp_data-staging', +# 'recursive' => true, +# 'countonly' => true, +# }, +# ] +# } # -# filegauges -# (Optional) - boolean, when true stats will be an individual gauge per file (max. 20 files!) and not a histogram of the whole directory. default False -# -# pattern -# (Optional) - string, the `fnmatch` pattern to use when reading the "directory"'s files. The pattern will be matched against the files' absolute paths and relative paths in "directory". default "*" -# -# recursive -# (Optional) - boolean, when true the stats will recurse into directories. default False -# -# countonly -# (Optional) - boolean, when true the stats will only count the number of files matching the pattern. Useful for very large directories. -# -# -# Sample Usage: -# -# Add a class for each check instance: -# -# class { 'datadog_agent::integrations::directory': -# directory => '/opt/ftp_data', -# recursive => true, -# countonly => true, -# } -# -# Add multiple instances in one class declaration: -# -# class { 'datadog_agent::integrations::directory': -# instances => [{ -# 'directory' => '/opt/ftp_data', -# 'recursive' => true, -# 'countonly' => true, -# }, -# 'directory' => '/opt/ftp_data-staging', -# 'recursive' => true, -# 'countonly' => true, -# }, -# ] -# } - class datadog_agent::integrations::directory ( + # lint:ignore:params_empty_string_assignment String $directory = '', Boolean $filegauges = false, Boolean $recursive = true, @@ -64,8 +59,9 @@ String $filetagname = '', String $pattern = '', Optional[Array] $instances = undef, + # lint:endignore ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent if !$instances and $directory == '' { fail('bad directory argument and no instances hash provided') @@ -73,26 +69,26 @@ if !$instances and $directory { $_instances = [{ - 'directory' => $directory, - 'filegauges' => $filegauges, - 'recursive' => $recursive, - 'countonly' => $countonly, - 'name' => $nametag, - 'dirtagname' => $dirtagname, - 'filetagname' => $filetagname, - 'pattern' => $pattern, + 'directory' => $directory, + 'filegauges' => $filegauges, + 'recursive' => $recursive, + 'countonly' => $countonly, + 'name' => $nametag, + 'dirtagname' => $dirtagname, + 'filetagname' => $filetagname, + 'pattern' => $pattern, }] - } elsif !$instances{ + } elsif !$instances { $_instances = [] } else { $_instances = $instances } $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/directory.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/directory.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -101,7 +97,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { @@ -115,6 +111,6 @@ mode => $datadog_agent::params::permissions_protected_file, content => template('datadog_agent/agent-conf.d/directory.yaml.erb'), require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } } diff --git a/manifests/integrations/disk.pp b/manifests/integrations/disk.pp index 30565739..bd52c3b4 100644 --- a/manifests/integrations/disk.pp +++ b/manifests/integrations/disk.pp @@ -1,99 +1,95 @@ -# Class: datadog_agent::integrations::disk +# @summary Install the necessary config to hook the disk check # -# This class will install the necessary config to hook the disk check # -# Parameters: -# $use_mount -# The use_mount parameter will instruct the check to collect disk -# and fs metrics using mount points instead of volumes. -# (values: yes, no) -# $all_partitions -# The (optional) all_partitions parameter will instruct the check to -# get metrics for all partitions. use_mount should be set to yes (to avoid -# collecting empty device names) when using this option. (values: yes, no) -# $tag_by_filesystem -# The (optional) tag_by_filesystem parameter will instruct the check to -# tag all disks with their filesystem (for ex: filesystem:nfs) -# (values: yes, no) -# $filesystem_exclude -# The (optional) filesystems you wish to exclude, example: tmpfs, run, -# dev (string or array) -# $device_exclude -# The (optional) devices you wish to exclude, example: /dev/sda (string or array) -# $mountpoint_exclude -# The (optional) mountpoints you wish to exclude, example: /tmp, -# /mnt/somebody-elses-problem (string or array) -# $filesystem_include -# Specify (optional) filesystems, to only collect from them (string or array) -# $device_include -# Specify (optional) devices, to only collect from them (string or array) -# $mountpoint_include -# Specify (optional) mountpoints, to only collect from them (string or array) -# $filesystem_blacklist (DEPRECATED in agent version>7.24, use $filesystem_exclude instead) -# The (optional) filesystems you wish to exclude, example: tmpfs, run, -# dev (string or array) -# $device_blacklist (DEPRECATED in agent version>7.24, use $device_exclude instead) -# The (optional) devices you wish to exclude, example: /dev/sda (string or array) -# $mountpoint_blacklist (DEPRECATED in agent version>7.24, use $mountpoint_exclude instead) -# The (optional) mountpoints you wish to exclude, example: /tmp, -# /mnt/somebody-elses-problem (string or array) -# $filesystem_whitelist DEPRECATED in agent version>7.24, use $device_include instead) -# Specify (optional) filesystems, to only collect from them (string or array) -# $device_whitelist (DEPRECATED in agent version>7.24, use $device_include instead) -# Specify (optional) devices, to only collect from them (string or array) -# $mountpoint_whitelist (DEPRECATED in agent version>7.24, use $mountpoint_include instead) -# Specify (optional) mountpoints, to only collect from them (string or array) -# $excluded_filesystems (DEPRECATED in agent version>6.9, use $filesystem_exclude instead) -# The filesystems you wish to exclude, example: tmpfs, run (string or array) -# $excluded_disks (DEPRECATED in agent version>6.9, use $device_exclude instead) -# The disks you (optional) -# $excluded_disk_re (DEPRECATED in agent version>6.9, use $device_exclude instead) -# Regular expression (optional) to exclude disks, eg: /dev/sde.* -# $excluded_mountpoint_re (DEPRECATED in agent version>6.9, use $mountpoint_exclude instead) -# Regular expression (optional) to exclude , eg: /mnt/somebody-elses-problem.* - +# @param use_mount +# The use_mount parameter will instruct the check to collect disk +# and fs metrics using mount points instead of volumes. +# (values: yes, no) +# @param all_partitions +# The (optional) all_partitions parameter will instruct the check to +# get metrics for all partitions. use_mount should be set to yes (to avoid +# collecting empty device names) when using this option. (values: yes, no) +# @param tag_by_filesystem +# The (optional) tag_by_filesystem parameter will instruct the check to +# tag all disks with their filesystem (for ex: filesystem:nfs) +# (values: yes, no) +# @param filesystem_exclude +# The (optional) filesystems you wish to exclude, example: tmpfs, run, +# dev (string or array) +# @param device_exclude +# The (optional) devices you wish to exclude, example: /dev/sda (string or array) +# @param mountpoint_exclude +# The (optional) mountpoints you wish to exclude, example: /tmp, +# /mnt/somebody-elses-problem (string or array) +# @param filesystem_include +# Specify (optional) filesystems, to only collect from them (string or array) +# @param device_include +# Specify (optional) devices, to only collect from them (string or array) +# @param mountpoint_include +# Specify (optional) mountpoints, to only collect from them (string or array) +# @param filesystem_blacklist +# The (optional) filesystems you wish to exclude, example: tmpfs, run, +# dev (string or array) +# @param device_blacklist +# The (optional) devices you wish to exclude, example: /dev/sda (string or array) +# @param mountpoint_blacklist +# The (optional) mountpoints you wish to exclude, example: /tmp, +# /mnt/somebody-elses-problem (string or array) +# @param filesystem_whitelist +# Specify (optional) filesystems, to only collect from them (string or array) +# @param device_whitelist +# Specify (optional) devices, to only collect from them (string or array) +# @param mountpoint_whitelist +# Specify (optional) mountpoints, to only collect from them (string or array) +# @param excluded_filesystems +# The filesystems you wish to exclude, example: tmpfs, run (string or array) +# @param excluded_disks +# The disks you (optional) +# @param excluded_disk_re +# Regular expression (optional) to exclude disks, eg: /dev/sde.* +# @param excluded_mountpoint_re +# Regular expression (optional) to exclude , eg: /mnt/somebody-elses-problem.* +# # -# Sample Usage: +# @example +# class { 'datadog_agent::integrations::disk' : +# use_mount => 'yes', +# excluded_filesystems => '/dev/tmpfs', +# excluded_disk_re => '/dev/sd[e-z]*' +# } # -# class { 'datadog_agent::integrations::disk' : -# use_mount => 'yes', -# excluded_filesystems => '/dev/tmpfs', -# excluded_disk_re => '/dev/sd[e-z]*' -# } class datadog_agent::integrations::disk ( - String $use_mount = 'no', - $all_partitions = undef, - $tag_by_filesystem = undef, - Optional[Array[String]] $filesystem_exclude = undef, - Optional[Array[String]] $device_exclude = undef, - Optional[Array[String]] $mountpoint_exclude = undef, - Optional[Array[String]] $filesystem_include = undef, - Optional[Array[String]] $device_include = undef, - Optional[Array[String]] $mountpoint_include = undef, - Optional[Array[String]] $filesystem_blacklist = undef, # deprecated in agent version >7.24 - Optional[Array[String]] $device_blacklist = undef, # deprecated in agent version >7.24 - Optional[Array[String]] $mountpoint_blacklist = undef, # deprecated in agent version >7.24 - Optional[Array[String]] $filesystem_whitelist = undef, # deprecated in agent version >7.24 - Optional[Array[String]] $device_whitelist = undef, # deprecated in agent version >7.24 - Optional[Array[String]] $mountpoint_whitelist = undef, # deprecated in agent version >7.24 - Optional[Variant[String, Array[String]]] $excluded_filesystems = undef, # deprecated in agent versions >6.9 - Optional[Variant[String, Array[String]]] $excluded_disks = undef, # deprecated in agent versions >6.9 - Optional[String] $excluded_disk_re = undef, # deprecated in agent versions >6.9 - Optional[String] $excluded_mountpoint_re = undef, # deprecated in agent versions >6.9 + String $use_mount = 'no', + Optional[Pattern[/^(no|yes)$/]] $all_partitions = undef, + Optional[Pattern[/^(no|yes)$/]] $tag_by_filesystem = undef, + Optional[Array[String]] $filesystem_exclude = undef, + Optional[Array[String]] $device_exclude = undef, + Optional[Array[String]] $mountpoint_exclude = undef, + Optional[Array[String]] $filesystem_include = undef, + Optional[Array[String]] $device_include = undef, + Optional[Array[String]] $mountpoint_include = undef, + Optional[Array[String]] $filesystem_blacklist = undef, # deprecated in agent version >7.24 + Optional[Array[String]] $device_blacklist = undef, # deprecated in agent version >7.24 + Optional[Array[String]] $mountpoint_blacklist = undef, # deprecated in agent version >7.24 + Optional[Array[String]] $filesystem_whitelist = undef, # deprecated in agent version >7.24 + Optional[Array[String]] $device_whitelist = undef, # deprecated in agent version >7.24 + Optional[Array[String]] $mountpoint_whitelist = undef, # deprecated in agent version >7.24 + Optional[Variant[String, Array[String]]] $excluded_filesystems = undef, # deprecated in agent versions >6.9 + Optional[Variant[String, Array[String]]] $excluded_disks = undef, # deprecated in agent versions >6.9 + Optional[String] $excluded_disk_re = undef, # deprecated in agent versions >6.9 + Optional[String] $excluded_mountpoint_re = undef, # deprecated in agent versions >6.9 ) inherits datadog_agent::params { - require ::datadog_agent - - validate_legacy('Optional[String]', 'validate_re', $all_partitions, '^(no|yes)$') + require datadog_agent if $use_mount !~ '^(no|yes)$' { fail('error during compilation') } $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/disk.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/disk.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -102,7 +98,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { @@ -116,6 +112,6 @@ mode => $datadog_agent::params::permissions_protected_file, content => template('datadog_agent/agent-conf.d/disk.yaml.erb'), require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } } diff --git a/manifests/integrations/dns_check.pp b/manifests/integrations/dns_check.pp index 6b6bc7de..3cd2a7bf 100644 --- a/manifests/integrations/dns_check.pp +++ b/manifests/integrations/dns_check.pp @@ -1,28 +1,27 @@ -# Class: datadog_agent::integrations::dns_check +# @summary Install the necessary configuration for the DNS check integration # -# This class will install the necessary configuration for the DNS check -# integration. # -# Parameters: -# $hostname: +# @param checks +# An Array of Hashes containing these Keys: +# +# hostname: # Domain or IP you wish to check the availability of. -# $nameserver +# nameserver # The nameserver you wish to use to check the hostname # availability. -# $timeout +# timeout # Time in seconds to wait before terminating the request. # -# Sample Usage: -# -# class { 'datadog_agent::integrations::dns_check': -# checks => [ -# { -# 'hostname' => 'example.com', -# 'nameserver' => '8.8.8.8', -# 'timeout' => 5, -# } -# ] -# } +# @example +# class { 'datadog_agent::integrations::dns_check': +# checks => [ +# { +# 'hostname' => 'example.com', +# 'nameserver' => '8.8.8.8', +# 'timeout' => 5, +# } +# ] +# } # class datadog_agent::integrations::dns_check ( Array $checks = [ @@ -30,16 +29,16 @@ 'hostname' => 'google.com', 'nameserver' => '8.8.8.8', 'timeout' => 5, - } + }, ] ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/dns_check.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/dns_check.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -48,7 +47,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { diff --git a/manifests/integrations/docker_daemon.pp b/manifests/integrations/docker_daemon.pp index 3852b319..595badc8 100644 --- a/manifests/integrations/docker_daemon.pp +++ b/manifests/integrations/docker_daemon.pp @@ -1,70 +1,93 @@ -# Class: datadog_agent::integrations::docker_daemon +# @summary Install the necessary configuration for the docker integration # -# This class will install the necessary configuration for the docker integration # -# Parameters: -# $url: -# The URL for docker API +# @param group +# optional name of docker group to add dd-agent user too +# @param docker_root +# @param timeout +# @param api_version +# @param tls +# @param tls_client_cert +# @param tls_client_key +# @param tls_cacert +# @param tls_verify +# @param init_retry_interval +# @param init_retries +# @param url +# The URL for docker API +# @param collect_events +# @param filtered_event_types +# @param collect_container_size +# @param custom_cgroups +# @param health_service_check_whitelist +# @param collect_container_count +# @param collect_volume_count +# @param collect_images_stats +# @param collect_image_size +# @param collect_disk_stats +# @param collect_exit_codes +# @param exclude +# @param include +# @param tags +# optional array of tags +# @param ecs_tags +# @param performance_tags +# @param container_tags +# @param collect_labels_as_tags +# @param event_attributes_as_tags # -# $tags: -# optional array of tags -# -# $group: -# optional name of docker group to add dd-agent user too -# -# -# Sample Usage: # +# @example # class { 'datadog_agent::integrations::docker_daemon' : # url => 'unix://var/run/docker.sock', # } # -class datadog_agent::integrations::docker_daemon( - $group = 'docker', - $docker_root = '/', - $timeout = 10, - $api_version = 'auto', - $tls = false, - $tls_client_cert = '/path/to/client-cert.pem', - $tls_client_key = '/path/to/client-key.pem', - $tls_cacert = '/path/to/ca.pem', - $tls_verify = true, - $init_retry_interval = 0, - $init_retries = 0, - $url = 'unix://var/run/docker.sock', - $collect_events = true, - $filtered_event_types = [], - $collect_container_size = false, - $custom_cgroups = false, - $health_service_check_whitelist = [], - $collect_container_count = false, - $collect_volume_count = false, - $collect_images_stats = false, - $collect_image_size = false, - $collect_disk_stats = false, - $collect_exit_codes = false, - $exclude = [], - $include = [], - $tags = [], - $ecs_tags = true, +class datadog_agent::integrations::docker_daemon ( + String $group = 'docker', + Stdlib::Absolutepath $docker_root = '/', + Integer $timeout = 10, + String $api_version = 'auto', + Boolean $tls = false, + Stdlib::Absolutepath $tls_client_cert = '/path/to/client-cert.pem', + Stdlib::Absolutepath $tls_client_key = '/path/to/client-key.pem', + Stdlib::Absolutepath $tls_cacert = '/path/to/ca.pem', + Boolean $tls_verify = true, + Integer $init_retry_interval = 0, + Integer $init_retries = 0, + String $url = 'unix://var/run/docker.sock', + Boolean $collect_events = true, + Array $filtered_event_types = [], + Boolean $collect_container_size = false, + Boolean $custom_cgroups = false, + Array $health_service_check_whitelist = [], + Boolean $collect_container_count = false, + Boolean $collect_volume_count = false, + Boolean $collect_images_stats = false, + Boolean $collect_image_size = false, + Boolean $collect_disk_stats = false, + Boolean $collect_exit_codes = false, + Array $exclude = [], + Array $include = [], + Array $tags = [], + Boolean $ecs_tags = true, # Possible values: "container_name", "image_name", "image_tag", "docker_image" - $performance_tags = [], + Array $performance_tags = [], # Possible values: "image_name", "image_tag", "docker_image" - $container_tags = [], + Array $container_tags = [], # Ex. "com.docker.compose.service", "com.docker.compose.project" - $collect_labels_as_tags = [], - $event_attributes_as_tags = [], + Array $collect_labels_as_tags = [], + Array $event_attributes_as_tags = [], ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent exec { 'dd-agent-should-be-in-docker-group': command => "/usr/sbin/usermod -aG ${group} ${datadog_agent::dd_user}", unless => "/bin/cat /etc/group | grep '^${group}:' | grep -qw ${datadog_agent::dd_user}", require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $legacy_dir = "${datadog_agent::params::conf_dir}/docker_daemon.d" file { $legacy_dir: @@ -73,7 +96,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $legacy_conf = "${legacy_dir}/conf.yaml" } else { @@ -81,10 +104,10 @@ } file { $legacy_conf: - ensure => 'absent' + ensure => 'absent', } - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/docker.d" file { $dst_dir: @@ -93,7 +116,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { @@ -107,6 +130,6 @@ mode => $datadog_agent::params::permissions_file, content => template('datadog_agent/agent-conf.d/docker_daemon.yaml.erb'), require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } } diff --git a/manifests/integrations/elasticsearch.pp b/manifests/integrations/elasticsearch.pp index 05383f7b..e248e545 100644 --- a/manifests/integrations/elasticsearch.pp +++ b/manifests/integrations/elasticsearch.pp @@ -1,13 +1,22 @@ -# Class: datadog_agent::integrations::elasticsearch +# @summary Install the necessary configuration for the elasticsearch integration # -# This class will install the necessary configuration for the elasticsearch integration # -# Parameters: -# $url: -# The URL for Elasticsearch +# @param cluster_stats +# @param index_stats +# @param password +# @param pending_task_stats +# @param pshard_stats +# @param ssl_cert +# @param ssl_key +# @param ssl_verify +# @param tags +# @param url +# The URL for Elasticsearch +# @param username +# @param instances # -# Sample Usage: # +# @example # class { 'datadog_agent::integrations::elasticsearch' : # instances => [{ # url => "http://localhost:9201" @@ -17,13 +26,12 @@ # }] # } # -# Or for a single instance: -# -# class { 'datadog_agent::integrations::elasticsearch' : -# url => "http://localhost:9201" -# } +# @example for a single instance: +# class { 'datadog_agent::integrations::elasticsearch' : +# url => "http://localhost:9201" +# } # -class datadog_agent::integrations::elasticsearch( +class datadog_agent::integrations::elasticsearch ( Boolean $cluster_stats = false, Boolean $index_stats = false, Optional[String] $password = undef, @@ -37,27 +45,27 @@ Optional[String] $username = undef, Optional[Array] $instances = undef ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent # $ssl_verify can be a bool or a string # https://github.com/DataDog/dd-agent/blob/master/checks.d/elastic.py#L454-L455 - if validate_legacy('Variant[Boolean, String]', 'is_string', $ssl_verify){ + if validate_legacy('Variant[Boolean, String]', 'is_string', $ssl_verify) { validate_absolute_path($ssl_verify) } if !$instances and $url { $_instances = [{ - 'cluster_stats' => $cluster_stats, - 'index_stats' => $index_stats, - 'password' => $password, - 'pending_task_stats' => $pending_task_stats, - 'pshard_stats' => $pshard_stats, - 'ssl_cert' => $ssl_cert, - 'ssl_key' => $ssl_key, - 'ssl_verify' => $ssl_verify, - 'tags' => $tags, - 'url' => $url, - 'username' => $username + 'cluster_stats' => $cluster_stats, + 'index_stats' => $index_stats, + 'password' => $password, + 'pending_task_stats' => $pending_task_stats, + 'pshard_stats' => $pshard_stats, + 'ssl_cert' => $ssl_cert, + 'ssl_key' => $ssl_key, + 'ssl_verify' => $ssl_verify, + 'tags' => $tags, + 'url' => $url, + 'username' => $username }] } elsif !$instances { $_instances = [] @@ -66,10 +74,10 @@ } $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/elastic.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/elastic.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -78,7 +86,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { @@ -92,6 +100,6 @@ mode => $datadog_agent::params::permissions_file, content => template('datadog_agent/agent-conf.d/elastic.yaml.erb'), require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } } diff --git a/manifests/integrations/fluentd.pp b/manifests/integrations/fluentd.pp index bcbf3c21..553c5ebd 100644 --- a/manifests/integrations/fluentd.pp +++ b/manifests/integrations/fluentd.pp @@ -1,33 +1,31 @@ -# Class: datadog_agent::integrations::fluentd +# @summary Install the fluentd integration # -# This class will install the fluentd integration # -# Parameters: -# $monitor_agent_url -# The url fluentd lists it's plugins on +# @param monitor_agent_url +# The url fluentd lists it's plugins on +# @param plugin_ids # -# Sample Usage: # -# class { 'datadog_agent::integrations::fluentd' : -# monitor_agent_url => 'http://localhost:24220/api/plugins.json', -# plugin_ids => [ -# 'elasticsearch_out', -# 'rsyslog_in', -# ], -# } +# @example +# class { 'datadog_agent::integrations::fluentd' : +# monitor_agent_url => 'http://localhost:24220/api/plugins.json', +# plugin_ids => [ +# 'elasticsearch_out', +# 'rsyslog_in', +# ], +# } # -# -class datadog_agent::integrations::fluentd( - $monitor_agent_url = 'http://localhost:24220/api/plugins.json', - Optional[Array] $plugin_ids = [], +class datadog_agent::integrations::fluentd ( + Stdlib::HTTPUrl $monitor_agent_url = 'http://localhost:24220/api/plugins.json', + Array $plugin_ids = [], ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/fluentd.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/fluentd.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -36,7 +34,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { diff --git a/manifests/integrations/generic.pp b/manifests/integrations/generic.pp index c5e23d19..ccbc596f 100644 --- a/manifests/integrations/generic.pp +++ b/manifests/integrations/generic.pp @@ -1,33 +1,31 @@ -# Class: datadog_agent::integrations::generic +# @summary Install a configuration file for an integration # -# This class will install a configuration file for an integration # -# Parameters: -# $integration_name: -# This will be used to build the filename. It must correspond to an -# integration that is supported by dd-agent, see the dd-agent for -# a current list. -# $integration_contents: -# String containing a rendered template. +# @param integration_name +# This will be used to build the filename. It must correspond to an +# integration that is supported by dd-agent, see the dd-agent for +# a current list. +# @param integration_contents +# String containing a rendered template. # -# Sample Usage: # -# class { 'datadog_agent::integrations::generic': -# integration_name => 'custom', -# integration_contents => template(my_custom_template), -# } +# @example +# class { 'datadog_agent::integrations::generic': +# integration_name => 'custom', +# integration_contents => template(my_custom_template), +# } # -class datadog_agent::integrations::generic( +class datadog_agent::integrations::generic ( Optional[String] $integration_name = undef, Optional[String] $integration_contents = undef, ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/${integration_name}.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/${integration_name}.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -36,7 +34,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { @@ -50,6 +48,6 @@ mode => $datadog_agent::params::permissions_protected_file, content => $integration_contents, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } } diff --git a/manifests/integrations/haproxy.pp b/manifests/integrations/haproxy.pp index ee8728b2..7643e9f1 100644 --- a/manifests/integrations/haproxy.pp +++ b/manifests/integrations/haproxy.pp @@ -1,13 +1,14 @@ -# Class: datadog_agent::integrations::haproxy +# @summary Install the necessary configuration for the haproxy integration # -# This class will install the necessary configuration for the haproxy integration # -# Parameters: -# $url: -# The URL for haproxy +# @param creds +# @param url +# The URL for haproxy +# @param options +# @param instances # -# Sample Usage: # +# @example # class { 'datadog_agent::integrations::haproxy' : # url => 'http://localhost:8080', # creds => { username => 'admin', @@ -16,19 +17,19 @@ # options => { collect_aggregates_only => 'False' }, # } # -class datadog_agent::integrations::haproxy( - $creds = {}, - $url = "http://${facts['networking']['ip']}:8080", - $options = {}, +class datadog_agent::integrations::haproxy ( + Hash $creds = {}, + Stdlib::HTTPUrl $url = "http://${facts['networking']['ip']}:8080", + Hash $options = {}, Optional[Array] $instances = undef ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent if !$instances and $url { $_instances = [{ - 'creds' => $creds, - 'url' => $url, - 'options' => $options, + 'creds' => $creds, + 'url' => $url, + 'options' => $options, }] } elsif !$instances { $_instances = [] @@ -37,10 +38,10 @@ } $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/haproxy.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/haproxy.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -49,7 +50,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { @@ -57,12 +58,12 @@ } file { $dst: - ensure => file, - owner => $datadog_agent::dd_user, - group => $datadog_agent::params::dd_group, - mode => $datadog_agent::params::permissions_file, - content => template('datadog_agent/agent-conf.d/haproxy.yaml.erb'), - require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + ensure => file, + owner => $datadog_agent::dd_user, + group => $datadog_agent::params::dd_group, + mode => $datadog_agent::params::permissions_file, + content => template('datadog_agent/agent-conf.d/haproxy.yaml.erb'), + require => Package[$datadog_agent::params::package_name], + notify => Service[$datadog_agent::params::service_name], } } diff --git a/manifests/integrations/http_check.pp b/manifests/integrations/http_check.pp index a5964bb4..051d364b 100644 --- a/manifests/integrations/http_check.pp +++ b/manifests/integrations/http_check.pp @@ -1,45 +1,42 @@ -# Class: datadog_agent::integrations::http_check +# @summary Install the necessary config to hook the http_check in the agent # -# This class will install the necessary config to hook the http_check in the agent # -# Parameters: -# sitename +# @param sitename # (Required) The name of the instance. # -# url +# @param url # (Required) The url to check. # -# timeout +# @param username +# +# @param password +# If your service uses basic authentication, you can optionally +# specify a username and password that will be used in the check. +# +# @param timeout # The (optional) timeout in seconds. # -# method +# @param method # The (optional) HTTP method. This setting defaults to GET, though many # other HTTP methods are supported, including POST and PUT. -# min_collection_interval +# +# @param min_collection_interval # The (optional) collection interval of the check. # default: 15 # https://docs.datadoghq.com/developers/write_agent_check/#collection-interval -# data +# +# @param data # The (optional) data option. Data should be a string or an array of # 'key: value' pairs and will be sent in the body of the request. # -# username -# password -# If your service uses basic authentication, you can optionally -# specify a username and password that will be used in the check. +# @param threshold # -# threshold -# window +# @param window # The (optional) window and threshold parameters allow you to trigger # alerts only if the check fails x times within the last y attempts # where x is the threshold and y is the window. # -# reverse_content_match -# When (optional) true, reverses the behavior of the content_match option, -# i.e. the HTTP check will report as DOWN if the string or expression -# in content_match IS found. (default is false) -# -# content_match +# @param content_match # The (optional) content_match parameter will allow the check # to look for a particular string within the response. The check # will report as DOWN if the string is not found. @@ -48,50 +45,54 @@ # a backslash (\) if you're trying to match them in your content: # . ^ $ * + ? { } [ ] \ | ( ) # -# include_content +# @param reverse_content_match +# When (optional) true, reverses the behavior of the content_match option, +# i.e. the HTTP check will report as DOWN if the string or expression +# in content_match IS found. (default is false) +# +# @param include_content # When (optional) true, includes the first 200 characters of the HTTP # response body in notifications. (default is false) # -# http_response_status_code +# @param http_response_status_code # The (optional) http_response_status_code parameter will instruct the check # to look for a particular HTTP response status code or a Regex identifying # a set of possible status codes. # The check will report as DOWN if status code returned differs. # This defaults to 1xx, 2xx and 3xx HTTP status code: (1|2|3)\d\d. # -# collect_response_time +# @param collect_response_time # The (optional) collect_response_time parameter will instruct the # check to create a metric 'network.http.response_time', tagged with # the url, reporting the response time in seconds. # -# ca_certs -# An optional string representing the path to CA certificates. -# -# disable_ssl_validation +# @param disable_ssl_validation # The setting disable_ssl_validation parameter to true will instruct # the http client to accept self signed, expired and otherwise # problematic SSL server certificates. To maintain backwards # compatibility this defaults to false. # -# ignore_ssl_warning +# @param ignore_ssl_warning # When SSL certificate validation is enabled (see setting above), this # setting will allow you to disable security warnings. # -# skip_event +# @param skip_event # The (optional) skip_event parameter will instruct the check to not # create any event to avoid duplicates with a server side service check. # This defaults to True because this is being deprecated. # (See https://github.com/DataDog/dd-agent/blob/master/checks/network_checks.py#L178-L180) # -# no_proxy +# @param no_proxy # The (optional) no_proxy parameter would bypass any proxy settings enabled # and attempt to reach the the URL directly. # If no proxy is defined at any level, this flag bears no effect. # Defaults to False. # -# check_certificate_expiration -# days_warning -# days_critical +# @param check_certificate_expiration +# +# @param days_warning +# +# @param days_critical # The (optional) check_certificate_expiration will instruct the check # to create a service check that checks the expiration of the # ssl certificate. Allow for a warning to occur when x days are @@ -100,7 +101,11 @@ # The SSL certificate will always be validated for this additional # service check regardless of the value of disable_ssl_validation # -# headers +# @param check_hostname +# +# @param ssl_server_name +# +# @param headers # The (optional) headers parameter allows you to send extra headers with # the request. Specify them like 'header-name: content'. This is useful for # explicitly specifying the 'host' header or for authorisation purposes. @@ -110,140 +115,142 @@ # but may be problematic with some HTTP servers # (See: https://code.google.com/p/httplib2/issues/detail?id=169) # -# allow_redirects +# @param allow_redirects # The (optional) allow_redirects parameter can enable redirection. # Defaults to True. # -# contact +# @param tags +# The (optional) tags to add to the check instance. +# +# @param contact # For service-specific notifications, you can optionally specify # a list of users to notify within the service configuration. # -# tags -# The (optional) tags to add to the check instance. +# @param instances +# +# @param ca_certs +# An optional string representing the path to CA certificates. +# +# +# @example Add a class for each check instance: +# class { 'datadog_agent::integrations::http_check': +# sitename => 'google', +# url => 'http://www.google.com/', +# } +# +# @example +# class { 'datadog_agent::integrations::http_check': +# sitename => 'local', +# url => 'http://localhost/', +# headers => ['Host: stan.borbat.com', 'DNT: true'], +# tags => ['production', 'wordpress'], +# } +# +# @example +# class { 'datadog_agent::integrations::http_check': +# sitename => 'localhost-9001', +# url => 'http://localhost:9001/', +# timeout => 5, +# threshold => 1, +# window => 1, +# content_match => '^(Bread|Apples) float(s)? in water' +# include_content => true, +# collect_response_time => true, +# contact => 'pagerduty', +# tags => 'production', +# } +# +# @example Add multiple instances in one class declaration: +# class { 'datadog_agent::integrations::http_check': +# instances => [{ +# 'sitename' => 'google', +# 'url' => 'http://www.google.com', +# }, +# { +# 'sitename' => 'local', +# 'url' => 'http://localhost/', +# 'headers' => ['Host: stan.borbat.com', 'DNT: true'], +# 'tags' => ['production', 'wordpress'] +# }] +# } # -# Sample Usage: -# -# Add a class for each check instance: -# -# class { 'datadog_agent::integrations::http_check': -# sitename => 'google', -# url => 'http://www.google.com/', -# } -# -# class { 'datadog_agent::integrations::http_check': -# sitename => 'local', -# url => 'http://localhost/', -# headers => ['Host: stan.borbat.com', 'DNT: true'], -# tags => ['production', 'wordpress'], -# } -# -# class { 'datadog_agent::integrations::http_check': -# sitename => 'localhost-9001', -# url => 'http://localhost:9001/', -# timeout => 5, -# threshold => 1, -# window => 1, -# content_match => '^(Bread|Apples) float(s)? in water' -# include_content => true, -# collect_response_time => true, -# contact => 'pagerduty', -# tags => 'production', -# } -# -# -# Add multiple instances in one class declaration: -# -# class { 'datadog_agent::integrations::http_check': -# instances => [{ -# 'sitename' => 'google', -# 'url' => 'http://www.google.com', -# }, -# { -# 'sitename' => 'local', -# 'url' => 'http://localhost/', -# 'headers' => ['Host: stan.borbat.com', 'DNT: true'], -# 'tags' => ['production', 'wordpress'] -# }] -# } - - class datadog_agent::integrations::http_check ( - $sitename = undef, - $url = undef, - $username = undef, - $password = undef, - $timeout = 1, - $method = 'get', - $min_collection_interval = undef, - $data = undef, - $threshold = undef, - $window = undef, - $content_match = undef, - $reverse_content_match = false, - $include_content = false, - $http_response_status_code = undef, - $collect_response_time = true, - $disable_ssl_validation = false, - $ignore_ssl_warning = false, - $skip_event = true, - $no_proxy = false, - $check_certificate_expiration = true, - $days_warning = undef, - $days_critical = undef, - Optional[Boolean] $check_hostname = undef, - Optional[String] $ssl_server_name = undef, - $headers = [], - $allow_redirects = true, - $tags = [], - $contact = [], - Optional[Array] $instances = undef, - $ca_certs = undef, + Optional[String] $sitename = undef, + Optional[String] $url = undef, + Optional[String] $username = undef, + Optional[String] $password = undef, + Integer $timeout = 1, + Enum['get', 'post'] $method = 'get', + Optional[Integer] $min_collection_interval = undef, + Optional[Any] $data = undef, + Optional[Integer] $threshold = undef, + Optional[Any] $window = undef, + Optional[Any] $content_match = undef, + Boolean $reverse_content_match = false, + Boolean $include_content = false, + Optional[Integer] $http_response_status_code = undef, + Boolean $collect_response_time = true, + Boolean $disable_ssl_validation = false, + Boolean $ignore_ssl_warning = false, + Boolean $skip_event = true, + Boolean $no_proxy = false, + Boolean $check_certificate_expiration = true, + Optional[Integer] $days_warning = undef, + Optional[Integer] $days_critical = undef, + Optional[Boolean] $check_hostname = undef, + Optional[String] $ssl_server_name = undef, + Array $headers = [], + Boolean $allow_redirects = true, + Array $tags = [], + Array $contact = [], + Optional[Array] $instances = undef, + Optional[Any] $ca_certs = undef, ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent if !$instances and $url { $_instances = [{ - 'sitename' => $sitename, - 'url' => $url, - 'username' => $username, - 'password' => $password, - 'timeout' => $timeout, - 'method' => $method, - 'min_collection_interval' => $min_collection_interval, - 'data' => $data, - 'threshold' => $threshold, - 'window' => $window, - 'content_match' => $content_match, - 'reverse_content_match' => $reverse_content_match, - 'include_content' => $include_content, - 'http_response_status_code' => $http_response_status_code, - 'collect_response_time' => $collect_response_time, - 'disable_ssl_validation' => $disable_ssl_validation, - 'ignore_ssl_warning' => $ignore_ssl_warning, - 'skip_event' => $skip_event, - 'no_proxy' => $no_proxy, - 'check_certificate_expiration' => $check_certificate_expiration, - 'days_warning' => $days_warning, - 'days_critical' => $days_critical, - 'check_hostname' => $check_hostname, - 'ssl_server_name' => $ssl_server_name, - 'headers' => $headers, - 'allow_redirects' => $allow_redirects, - 'tags' => $tags, - 'contact' => $contact, - 'ca_certs' => $ca_certs, + 'sitename' => $sitename, + 'url' => $url, + 'username' => $username, + 'password' => $password, + 'timeout' => $timeout, + 'method' => $method, + 'min_collection_interval' => $min_collection_interval, + 'data' => $data, + 'threshold' => $threshold, + 'window' => $window, + 'content_match' => $content_match, + 'reverse_content_match' => $reverse_content_match, + 'include_content' => $include_content, + 'http_response_status_code' => $http_response_status_code, + 'collect_response_time' => $collect_response_time, + 'disable_ssl_validation' => $disable_ssl_validation, + 'ignore_ssl_warning' => $ignore_ssl_warning, + 'skip_event' => $skip_event, + 'no_proxy' => $no_proxy, + 'check_certificate_expiration' => $check_certificate_expiration, + 'days_warning' => $days_warning, + 'days_critical' => $days_critical, + 'check_hostname' => $check_hostname, + 'ssl_server_name' => $ssl_server_name, + 'headers' => $headers, + 'allow_redirects' => $allow_redirects, + 'tags' => $tags, + 'contact' => $contact, + 'ca_certs' => $ca_certs, }] - } elsif !$instances{ + } elsif !$instances { $_instances = [] } else { $_instances = $instances } $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/http_check.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/http_check.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -252,7 +259,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { @@ -266,6 +273,6 @@ mode => $datadog_agent::params::permissions_protected_file, content => template('datadog_agent/agent-conf.d/http_check.yaml.erb'), require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } } diff --git a/manifests/integrations/jenkins.pp b/manifests/integrations/jenkins.pp index c3fe39bc..bc62d474 100644 --- a/manifests/integrations/jenkins.pp +++ b/manifests/integrations/jenkins.pp @@ -1,28 +1,24 @@ -# Class: datadog_agent::integrations::jenkins +# @summary Install the necessary configuration for the jenkins integration # -# This class will install the necessary configuration for the jenkins integration # -# Parameters: -# $path: -# Jenkins path. Defaults to '/var/lib/jenkins' +# @param path +# Jenkins path. Defaults to '/var/lib/jenkins' # -# Sample Usage: +# @example +# class { 'datadog_agent::integrations::jenkins' : +# path => '/var/lib/jenkins', +# } # -# class { 'datadog_agent::integrations::jenkins' : -# path => '/var/lib/jenkins', -# } -# -# -class datadog_agent::integrations::jenkins( - $path = '/var/lib/jenkins' +class datadog_agent::integrations::jenkins ( + Stdlib::Absolutepath $path = '/var/lib/jenkins' ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/jenkins.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/jenkins.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -31,7 +27,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { @@ -45,6 +41,6 @@ mode => $datadog_agent::params::permissions_protected_file, content => template('datadog_agent/agent-conf.d/jenkins.yaml.erb'), require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } } diff --git a/manifests/integrations/jmx.pp b/manifests/integrations/jmx.pp index e32f3ec9..ad865d91 100644 --- a/manifests/integrations/jmx.pp +++ b/manifests/integrations/jmx.pp @@ -1,16 +1,14 @@ -# Class: datadog_agent::integrations::jmx +# @summary Install the necessary configuration for the jmx integration # -# This class will install the necessary configuration for the jmx integration # -# Parameters: -# $init_config: -# Hash of inital configuration, consisting of the following keys: +# @param init_config +# Hash of inital configuration, consisting of the following keys: # # custom_jar_paths: # Array of paths to jars. Optional. # -# $instances: -# Array of instance hashes, consisting of the following keys: +# @param instances +# Array of instance hashes, consisting of the following keys: # # name: # Used in conjunction with jmx_url. Optional. @@ -46,7 +44,7 @@ # Array of include/exclude hash pairs. Optional. # Read http://docs.datadoghq.com/integrations/java/ to learn how to customize it. # -# Sample Usage: +# @example # # class { 'datadog_agent::integrations::jmx': # init_config => { @@ -61,17 +59,17 @@ # }], # } # -class datadog_agent::integrations::jmx( - $init_config = {}, - $instances = [], +class datadog_agent::integrations::jmx ( + Hash $init_config = {}, + Array $instances = [], ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/jmx.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/jmx.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -80,7 +78,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { @@ -94,7 +92,6 @@ mode => $datadog_agent::params::permissions_protected_file, content => template('datadog_agent/agent-conf.d/jmx.yaml.erb'), require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } - } diff --git a/manifests/integrations/kafka.pp b/manifests/integrations/kafka.pp index 2f575e76..f4df7ba3 100644 --- a/manifests/integrations/kafka.pp +++ b/manifests/integrations/kafka.pp @@ -1,96 +1,93 @@ -# Class: datadog_agent::integrations::kafka +# @summary Install the necessary configuration for the kafka integration # -# This class will install the necessary configuration for the kafka integration # -# Parameters: -# $host: -# The host kafka is running on. Defaults to 'localhost' -# $username -# Optionally specify username for connection -# $password -# Optionally specify password for connection -# $port -# The port kafka is running on. Defaults to 9999 -# $name -# Name given to kafka instance -# $process_name_regex -# Instead of specifying a host, and port. The agent can connect using the attach api. -# $tools_jar_path -# Path to tools jar needs to be set when process_name_regex is set -# $java_bin_path -# Path to java binary, should be set if agent cant find your java executable -# $trust_store_path -# Path to the trust store, should be set if ssl is enabled -# $trust_store_password -# Password to the trust store -# $tags -# Optional array of tags +# @param host +# The host kafka is running on. Defaults to 'localhost' +# @param port +# The port kafka is running on. Defaults to 9999 +# @param username +# Optionally specify username for connection +# @param password +# Optionally specify password for connection +# @param process_name_regex +# Instead of specifying a host, and port. The agent can connect using the attach api. +# @param tools_jar_path +# Path to tools jar needs to be set when process_name_regex is set +# @param java_bin_path +# Path to java binary, should be set if agent cant find your java executable +# @param trust_store_path +# Path to the trust store, should be set if ssl is enabled +# @param trust_store_password +# Password to the trust store +# @param tags +# Optional array of tags +# @param instances +# An Array of Hashes # # -# Sample Usage: +# @example +# class { 'datadog_agent::integrations::kafka' : +# servers => [ +# { +# 'host' => 'localhost', +# 'username' => 'kafka_username', +# 'password' => 'kafka_password', +# 'port' => '9999', +# 'name' => 'kafka_instance', +# 'process_name_regex' => '.*process_name.*', +# 'tools_jar_path' => '/usr/lib/jvm/java-7-openjdk-amd64/lib/tools.jar', +# 'java_bin_path' => '/path/to/java', +# 'trust_store_path' => '/path/to/trustStore.jks', +# 'trust_store_password' => 'password', +# 'tags' => ['env: test', 'sometag: someinfo'], +# }, +# { +# 'host' => 'localhost', +# 'port' => '9999', +# 'tags' => [], +# }, +# ] +# } # -# class { 'datadog_agent::integrations::kafka' : -# servers => [ -# { -# 'host' => 'localhost', -# 'username' => 'kafka_username', -# 'password' => 'kafka_password', -# 'port' => '9999', -# 'name' => 'kafka_instance', -# 'process_name_regex' => '.*process_name.*', -# 'tools_jar_path' => '/usr/lib/jvm/java-7-openjdk-amd64/lib/tools.jar', -# 'java_bin_path' => '/path/to/java', -# 'trust_store_path' => '/path/to/trustStore.jks', -# 'trust_store_password' => 'password', -# 'tags' => ['env: test', 'sometag: someinfo'], -# }, -# { -# 'host' => 'localhost', -# 'port' => '9999', -# 'tags' => [], -# }, -# ] -# } -# -class datadog_agent::integrations::kafka( - $host = 'localhost', - Variant[String[1], Integer] $port = 9999, - Optional[String[1]] $username = undef, - Optional[String[1]] $password = undef, - Optional[String[1]] $process_name_regex = undef, - Optional[String[1]] $tools_jar_path = undef, - Optional[String[1]] $java_bin_path = undef, - Optional[String[1]] $trust_store_path = undef, - Optional[String[1]] $trust_store_password = undef, - Optional[Hash[String[1], String[1]]] $tags = undef, - Optional[Array[Hash[String[1], Data]]] $instances = undef, +class datadog_agent::integrations::kafka ( + Stdlib::Host $host = 'localhost', + Variant[String[1], Integer] $port = 9999, + Optional[String[1]] $username = undef, + Optional[String[1]] $password = undef, + Optional[String[1]] $process_name_regex = undef, + Optional[String[1]] $tools_jar_path = undef, + Optional[String[1]] $java_bin_path = undef, + Optional[String[1]] $trust_store_path = undef, + Optional[String[1]] $trust_store_password = undef, + Optional[Hash[String[1], String[1]]] $tags = undef, + Optional[Array[Hash[String[1], Data]]] $instances = undef, ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent if !$instances and $host and $port { $servers = [{ - 'host' => $host, - 'port' => $port, - 'username' => $username, - 'password' => $password, - 'process_name_regex' => $process_name_regex, - 'tools_jar_path' => $tools_jar_path, - 'java_bin_path' => $java_bin_path, - 'trust_store_path' => $trust_store_path, - 'trust_store_password' => $trust_store_password, - 'tags' => $tags, + 'host' => $host, + 'port' => $port, + 'username' => $username, + 'password' => $password, + 'process_name_regex' => $process_name_regex, + 'tools_jar_path' => $tools_jar_path, + 'java_bin_path' => $java_bin_path, + 'trust_store_path' => $trust_store_path, + 'trust_store_password' => $trust_store_password, + 'tags' => $tags, }] - } elsif !$instances{ + } elsif !$instances { $servers = [] } else { $servers = $instances } $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/kafka.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/kafka.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -99,7 +96,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { diff --git a/manifests/integrations/kong.pp b/manifests/integrations/kong.pp index 15a17d92..ea288cea 100644 --- a/manifests/integrations/kong.pp +++ b/manifests/integrations/kong.pp @@ -1,17 +1,15 @@ -# Class: datadog_agent::integrations::kong -# -# This class will install the necessary configuration for the Kong integration +# @summary Install the necessary configuration for the Kong integration # # Note: if you're Cassandra data-store is large in size the `/status` page may # take a long time to return. # # -# Parameters: -# $instances: -# Array of hashes for all Kong instances and associated tags. See example # -# Sample Usage: +# @param instances +# Array of hashes for all Kong instances and associated tags. See example +# # +# @example # class { 'datadog_agent::integrations::kong': # instances => [ # { @@ -25,20 +23,20 @@ # } # class datadog_agent::integrations::kong ( - $instances = [ + Array[Hash] $instances = [ { 'status_url' => 'http://localhost:8001/status/', 'tags' => [] } ] ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/kong.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/kong.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -47,7 +45,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { @@ -61,6 +59,6 @@ mode => $datadog_agent::params::permissions_file, content => template('datadog_agent/agent-conf.d/kong.yaml.erb'), require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } } diff --git a/manifests/integrations/kubernetes.pp b/manifests/integrations/kubernetes.pp index b984191c..d4f89712 100644 --- a/manifests/integrations/kubernetes.pp +++ b/manifests/integrations/kubernetes.pp @@ -1,18 +1,17 @@ -# Class: datadog_agent::integrations::kubernetes +# @summary Install the necessary configuration for the kubernetes integration # -# This class will install the necessary configuration for the kubernetes integration # -# Parameters: -# $url: -# The URL for kubernetes API +# @param api_server_url +# The URL for kubernetes API +# @param apiserver_client_crt +# @param apiserver_client_key +# @param kubelet_client_crt +# @param kubelet_client_key +# @param tags +# optional array of tags # -# $tags: -# optional array of tags -# -# -# -# Sample Usage: # +# @example # class { 'datadog_agent::integrations::kubernetes' : # api_server_url => 'https://kubernetes:443', # apiserver_client_crt => '/etc/ssl/certs/crt', @@ -21,22 +20,21 @@ # kubelet_client_key => '/etc/ssl/private/key', # } # -class datadog_agent::integrations::kubernetes( - $api_server_url = 'Enter_Your_API_url', - $apiserver_client_crt = '/path/to/crt', - $apiserver_client_key = '/path/to/key', - $kubelet_client_crt = '/path/to/crt', - $kubelet_client_key = '/path/to/key', - $tags = [], - +class datadog_agent::integrations::kubernetes ( + String $api_server_url = 'Enter_Your_API_url', + Stdlib::Absolutepath $apiserver_client_crt = '/path/to/crt', + Stdlib::Absolutepath $apiserver_client_key = '/path/to/key', + Stdlib::Absolutepath $kubelet_client_crt = '/path/to/crt', + Stdlib::Absolutepath $kubelet_client_key = '/path/to/key', + Array $tags = [], ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/kubernetes.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/kubernetes.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -45,7 +43,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { diff --git a/manifests/integrations/kubernetes_state.pp b/manifests/integrations/kubernetes_state.pp index 10fe409c..6a869088 100644 --- a/manifests/integrations/kubernetes_state.pp +++ b/manifests/integrations/kubernetes_state.pp @@ -1,34 +1,28 @@ -# Class: datadog_agent::integrations::kubernetes +# @summary Install the necessary configuration for the kubernetes integration # -# This class will install the necessary configuration for the kubernetes integration # -# Parameters: -# $url: -# The URL for kubernetes metrics +# @param url +# The URL for kubernetes metrics +# @param tags +# optional array of tags # -# $tags: -# optional array of tags -# -# -# -# Sample Usage: # +# @example # class { 'datadog_agent::integrations::kubernetes_state' : # url => 'http://kubernetes.com:8080/metrics', # } # -class datadog_agent::integrations::kubernetes_state( - $url = 'Enter_State_URL', - $tags = [], - +class datadog_agent::integrations::kubernetes_state ( + String $url = 'Enter_State_URL', + Array $tags = [], ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/kubernetes_state.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/kubernetes_state.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -37,7 +31,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { diff --git a/manifests/integrations/linux_proc_extras.pp b/manifests/integrations/linux_proc_extras.pp index 9a93c006..56cada36 100644 --- a/manifests/integrations/linux_proc_extras.pp +++ b/manifests/integrations/linux_proc_extras.pp @@ -1,28 +1,25 @@ -# Class: datadog_agent::integrations::system_core +# @summary Install the necessary configuration for the CPU cores integration # -# This class will install the necessary configuration for the CPU cores integration # -# Parameters: +# @param tags +# The (optional) tags to add to the check instance. # -# tags -# The (optional) tags to add to the check instance. # -# Sample Usage: +# @example +# class { 'datadog_agent::integrations::linux_proc_extras': +# tags => [ 'env:production' ], +# } # -# class { 'datadog_agent::integrations::linux_proc_extras': -# tags => [ 'env:production' ], -# } - -class datadog_agent::integrations::linux_proc_extras( - $tags = [], +class datadog_agent::integrations::linux_proc_extras ( + Array $tags = [], ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/linux_proc_extras.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/linux_proc_extras.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -31,7 +28,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { @@ -45,7 +42,6 @@ mode => $datadog_agent::params::permissions_protected_file, content => template('datadog_agent/agent-conf.d/linux_proc_extras.yaml.erb'), require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } - } diff --git a/manifests/integrations/logs.pp b/manifests/integrations/logs.pp index a71e0e19..f53aea3e 100644 --- a/manifests/integrations/logs.pp +++ b/manifests/integrations/logs.pp @@ -1,10 +1,8 @@ -# Class: datadog_agent::integrations::logs +# @summary Install the necessary configuration for the logs integration. # -# This class will install the necessary configuration for the logs integration. # -# Parameters: -# $logs: -# array of log sources. +# @param logs +# array of log sources # # Log Source: # $type @@ -18,29 +16,28 @@ # $log_processing_rules # Optional array of processing rules. # -# Sample Usage: # -# class { 'datadog_agent::integrations::logs' : -# logs => [ -# { -# 'type' => 'file', -# 'path' => '/var/log/afile.log', -# }, -# { -# 'type' => 'docker', -# }, -# ], -# } +# @example +# class { 'datadog_agent::integrations::logs' : +# logs => [ +# { +# 'type' => 'file', +# 'path' => '/var/log/afile.log', +# }, +# { +# 'type' => 'docker', +# }, +# ], +# } # # Documentation: # https://docs.datadoghq.com/logs/log_collection # - -class datadog_agent::integrations::logs( +class datadog_agent::integrations::logs ( Array $logs = [], ) inherits datadog_agent::params { - unless $::datadog_agent::_agent_major_version == 5 { - require ::datadog_agent + unless $datadog_agent::_agent_major_version == 5 { + require datadog_agent file { "${datadog_agent::params::conf_dir}/logs.yaml": ensure => file, @@ -49,7 +46,7 @@ mode => $datadog_agent::params::permissions_protected_file, content => template('datadog_agent/agent-conf.d/logs.yaml.erb'), require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } } } diff --git a/manifests/integrations/marathon.pp b/manifests/integrations/marathon.pp index cf147156..7d55a408 100644 --- a/manifests/integrations/marathon.pp +++ b/manifests/integrations/marathon.pp @@ -1,28 +1,27 @@ -# Class: datadog_agent::integrations::marathon +# @summary Install the necessary configuration for the Marathon integration # -# This class will install the necessary configuration for the Marathon integration # -# Parameters: -# $url: -# The URL for Marathon +# @param marathon_timeout +# @param url +# The URL for Marathon # -# Sample Usage: # +# @example # class { 'datadog_agent::integrations::marathon' : # url => "http://localhost:8080" # } # -class datadog_agent::integrations::marathon( - $marathon_timeout = 5, - $url = 'http://localhost:8080' +class datadog_agent::integrations::marathon ( + Integer $marathon_timeout = 5, + Stdlib::HTTPUrl $url = 'http://localhost:8080' ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/marathon.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/marathon.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -31,7 +30,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { @@ -45,6 +44,6 @@ mode => $datadog_agent::params::permissions_file, content => template('datadog_agent/agent-conf.d/marathon.yaml.erb'), require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } } diff --git a/manifests/integrations/memcache.pp b/manifests/integrations/memcache.pp index 985da7c9..a0c14986 100644 --- a/manifests/integrations/memcache.pp +++ b/manifests/integrations/memcache.pp @@ -1,34 +1,34 @@ -# Class: datadog_agent::integrations::memcache +# @summary Install the necessary configuration for the memcache integration # -# This class will install the necessary configuration for the memcache integration # -# Parameters: -# $url: -# url used to connect to the memcached instance -# $port: -# $tags -# Optional array of tags +# @param url +# url used to connect to the memcached instance +# @param port +# @param tags +# Optional array of tags +# @param items +# @param slabs +# @param instances # -# Sample Usage: # -# include 'datadog_agent::integrations::memcache' +# @example +# include 'datadog_agent::integrations::memcache' # -# OR +# @example +# class { 'datadog_agent::integrations::memcache': +# url => 'localhost', +# } # -# class { 'datadog_agent::integrations::memcache': -# url => 'localhost', -# } # -# -# Sample Usage (Instance): -# class { 'datadog_agent::integrations::memcache' : -# instances => [{ -# url => 'localhost', -# port => '11211', -# items => false, -# slabs => false, -# }] -# } +# @example +# class { 'datadog_agent::integrations::memcache' : +# instances => [{ +# url => 'localhost', +# port => '11211', +# items => false, +# slabs => false, +# }] +# } # class datadog_agent::integrations::memcache ( String $url = 'localhost', @@ -38,27 +38,27 @@ Variant[Boolean, String] $slabs = false, Optional[Array] $instances = undef, ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent if !$instances and $url { $_instances = [{ - 'url' => $url, - 'port' => $port, - 'tags' => $tags, - 'items' => $items, - 'slabs' => $slabs, + 'url' => $url, + 'port' => $port, + 'tags' => $tags, + 'items' => $items, + 'slabs' => $slabs, }] - } elsif !$instances{ + } elsif !$instances { $_instances = [] } else { $_instances = $instances } $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/mcache.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/mcache.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -67,7 +67,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { @@ -81,6 +81,6 @@ mode => $datadog_agent::params::permissions_protected_file, content => template('datadog_agent/agent-conf.d/mcache.yaml.erb'), require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } } diff --git a/manifests/integrations/mesos_master.pp b/manifests/integrations/mesos_master.pp index 065fe8d9..fd80ce60 100644 --- a/manifests/integrations/mesos_master.pp +++ b/manifests/integrations/mesos_master.pp @@ -1,24 +1,23 @@ -# Class: datadog_agent::integrations::mesos_master +# @summary Install the necessary configuration for the mesos integration # -# This class will install the necessary configuration for the mesos integration # -# Parameters: -# $url: -# The URL for Mesos master +# @param mesos_timeout +# @param url +# The URL for Mesos master # -# Sample Usage: # +# @example # class { 'datadog_agent::integrations::mesos' : # url => "http://localhost:5050" # } # -class datadog_agent::integrations::mesos_master( - $mesos_timeout = 10, - $url = 'http://localhost:5050' +class datadog_agent::integrations::mesos_master ( + Integer $mesos_timeout = 10, + Stdlib::HTTPUrl $url = 'http://localhost:5050' ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/mesos.d" file { $dst_dir: @@ -27,7 +26,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { @@ -35,14 +34,14 @@ } file { $dst: - ensure => 'absent' + ensure => 'absent', } $legacy_dst_master = "${datadog_agent::params::legacy_conf_dir}/mesos_master.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_master_dir = "${datadog_agent::params::conf_dir}/mesos_master.d" file { $legacy_dst_master: - ensure => 'absent' + ensure => 'absent', } file { $dst_master_dir: @@ -51,7 +50,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst_master = "${dst_master_dir}/conf.yaml" } else { @@ -65,6 +64,6 @@ mode => $datadog_agent::params::permissions_file, content => template('datadog_agent/agent-conf.d/mesos_master.yaml.erb'), require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } } diff --git a/manifests/integrations/mesos_slave.pp b/manifests/integrations/mesos_slave.pp index 9860cf71..92987183 100644 --- a/manifests/integrations/mesos_slave.pp +++ b/manifests/integrations/mesos_slave.pp @@ -1,27 +1,25 @@ -# Class: datadog_agent::integrations::mesos_slave +# @summary Install the necessary configuration for the mesos slave integration # -# This class will install the necessary configuration for the mesos slave integration # -# Parameters: -# $url: -# The URL for Mesos slave +# @param mesos_timeout +# @param url +# The URL for Mesos slave # -# Sample Usage: # +# @example # class { 'datadog_agent::integrations::mesos' : # url => "http://localhost:5051" # } # -class datadog_agent::integrations::mesos_slave( - $mesos_timeout = 10, - $url = 'http://localhost:5051' +class datadog_agent::integrations::mesos_slave ( + Integer $mesos_timeout = 10, + Stdlib::HTTPUrl $url = 'http://localhost:5051' ) inherits datadog_agent::params { - $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/mesos_slave.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/mesos_slave.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -30,7 +28,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { @@ -44,6 +42,6 @@ mode => $datadog_agent::params::permissions_file, content => template('datadog_agent/agent-conf.d/mesos_slave.yaml.erb'), require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } } diff --git a/manifests/integrations/mongo.pp b/manifests/integrations/mongo.pp index ff87c3f9..cad146c9 100644 --- a/manifests/integrations/mongo.pp +++ b/manifests/integrations/mongo.pp @@ -1,108 +1,107 @@ -# Class: datadog_agent::integrations::mongo -# -# This class will install the necessary configuration for the mongo integration +# @summary Install the necessary configuration for the mongo integration # # NOTE: In newer versions of the Datadog Agent, the ssl parameters will be deprecated in favor the tls variants # -# Parameters: -# $additional_metrics +# +# @param servers +# an Array of Hashes, containing these Keys +# +# additional_metrics # Optional array of additional metrics -# $database +# database # Optionally specify database to query. Defaults to 'admin' -# $host: +# host: # The host mongo is running on. Defaults to '127.0.0.1' -# $password +# password # Optionally specify password for connection -# $port +# port # The port mongo is running on. Defaults to 27017 -# $ssl +# ssl # Optionally enable SSL for connection -# $ssl_ca_certs +# ssl_ca_certs # Optionally specify path to SSL Certificate Authority certificates -# $ssl_cert_reqs +# ssl_cert_reqs # Optionally require SSL client certificate for connection -# $ssl_certfile +# ssl_certfile # Optionally specify path to SSL certificate for connection -# $ssl_keyfile +# ssl_keyfile # Optionally specify path to SSL private key for connection -# $tls +# tls # Optionally enable TLS for connection -# $tls_ca_file +# tls_ca_file # Optionally specify path to SSL/TLS Certificate Authority certificates -# $tls_allow_invalid_certificates +# tls_allow_invalid_certificates # Optionally require SSL/TLS client certificate for connection -# $tls_certificate_key_file +# tls_certificate_key_file # Optionally specify path to combined SSL/TLS key and certificate for connection -# $tags +# tags # Optional array of tags -# $username +# username # Optionally specify username for connection # -# Sample Usage (Older Agent Versions): -# -# class { 'datadog_agent::integrations::mongo' : -# servers => [ -# { -# 'additional_metrics' => ['top'], -# 'database' => 'database_name', -# 'host' => 'localhost', -# 'password' => 'mongo_password', -# 'port' => '27017', -# 'ssl' => true, -# 'ssl_ca_certs' => '/path/to/ca.pem', -# 'ssl_cert_reqs' => 'CERT_REQUIRED', -# 'ssl_certfile' => '/path/to/client.pem', -# 'ssl_keyfile' => '/path/to/key.pem', -# 'tags' => ['optional_tag1', 'optional_tag2'], -# 'username' => 'mongo_username', -# }, -# { -# 'host' => 'localhost', -# 'port' => '27018', -# 'tags' => [], -# 'additional_metrics' => [], -# 'collections' => [], -# }, -# ] -# } -# -# Sample Usage (Newer Agent Versions): +# @example +# class { 'datadog_agent::integrations::mongo' : +# servers => [ +# { +# 'additional_metrics' => ['top'], +# 'database' => 'database_name', +# 'host' => 'localhost', +# 'password' => 'mongo_password', +# 'port' => '27017', +# 'ssl' => true, +# 'ssl_ca_certs' => '/path/to/ca.pem', +# 'ssl_cert_reqs' => 'CERT_REQUIRED', +# 'ssl_certfile' => '/path/to/client.pem', +# 'ssl_keyfile' => '/path/to/key.pem', +# 'tags' => ['optional_tag1', 'optional_tag2'], +# 'username' => 'mongo_username', +# }, +# { +# 'host' => 'localhost', +# 'port' => '27018', +# 'tags' => [], +# 'additional_metrics' => [], +# 'collections' => [], +# }, +# ] +# } # -# class { 'datadog_agent::integrations::mongo' : -# servers => [ -# { -# 'additional_metrics' => ['top'], -# 'database' => 'database_name', -# 'host' => 'localhost', -# 'password' => 'mongo_password', -# 'port' => '27017', -# 'tls' => true, -# 'tls_ca_file' => '/path/to/ca.pem', -# 'tls_allow_invalid_certificates' => false, -# 'tls_certificate_key_file' => '/path/to/combined.pem', -# 'tags' => ['optional_tag1', 'optional_tag2'], -# 'username' => 'mongo_username', -# }, -# { -# 'host' => 'localhost', -# 'port' => '27018', -# 'tags' => [], -# 'additional_metrics' => [], -# 'collections' => [], -# }, -# ] -# } +# @example (Newer Agent Versions) +# class { 'datadog_agent::integrations::mongo' : +# servers => [ +# { +# 'additional_metrics' => ['top'], +# 'database' => 'database_name', +# 'host' => 'localhost', +# 'password' => 'mongo_password', +# 'port' => '27017', +# 'tls' => true, +# 'tls_ca_file' => '/path/to/ca.pem', +# 'tls_allow_invalid_certificates' => false, +# 'tls_certificate_key_file' => '/path/to/combined.pem', +# 'tags' => ['optional_tag1', 'optional_tag2'], +# 'username' => 'mongo_username', +# }, +# { +# 'host' => 'localhost', +# 'port' => '27018', +# 'tags' => [], +# 'additional_metrics' => [], +# 'collections' => [], +# }, +# ] +# } # -class datadog_agent::integrations::mongo( - Array $servers = [{'host' => 'localhost', 'port' => '27017'}] +class datadog_agent::integrations::mongo ( + Array $servers = [{ 'host' => 'localhost', 'port' => '27017' }] ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/mongo.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/mongo.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -111,7 +110,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { @@ -125,6 +124,6 @@ mode => $datadog_agent::params::permissions_protected_file, content => template('datadog_agent/agent-conf.d/mongo.yaml.erb'), require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } } diff --git a/manifests/integrations/mysql.pp b/manifests/integrations/mysql.pp index 26106e13..788185a6 100644 --- a/manifests/integrations/mysql.pp +++ b/manifests/integrations/mysql.pp @@ -1,126 +1,127 @@ -# Class: datadog_agent::integrations::mysql +# @summary Install the necessary configuration for the mysql integration # -# This class will install the necessary configuration for the mysql integration # -# Parameters: -# $password -# The mysql password for the datadog user -# $host: +# @param host # The host mysql is running on -# $user +# @param user # The mysql user for the datadog user -# $sock +# @param port +# @param password +# The mysql password for the datadog user +# @param sock # Connect mysql via unix socket -# $tags +# @param tags # Optional array of tags -# $replication +# @param replication # replication option -# $galera_cluster +# @param galera_cluster # galera cluster option -# $extra_status_metrics +# @param extra_status_metrics # extra status metrics -# $extra_innodb_metrics +# @param extra_innodb_metrics # extra innodb metrics -# $extra_performance_metrics +# @param extra_performance_metrics # extra performance metrics, query run time, 95th precentile avg -# $schema_size_metrics +# @param schema_size_metrics # schema size metrics -# $disable_innodb_metrics +# @param disable_innodb_metrics # disable innodb metrics, used with older versions of MySQL without innodb engine support. -# $dbm +# @param dbm # Database Monitoring for Application Performance Monitoring (APM) -# $queries +# @param queries # Custom metrics based on MySQL query -# Sample Usage: +# @param instances +# @param logs # -# class { 'datadog_agent::integrations::mysql' : -# host => 'localhost', -# password => 'some_pass', -# user => 'datadog' -# } -# Sample Usage (Instance): -# class { 'datadog_agent::integrations::mysql' : -# instances => [{ -# host => 'localhost', -# password => 'mypassword', -# user => 'datadog', -# port => '3306', -# tags => ['instance:mysql1'], -# replication => '0', -# galera_cluster => '0', -# extra_status_metrics => 'true', -# extra_innodb_metrics => 'true', -# extra_performance_metrics => 'true', -# schema_size_metrics => 'true', -# disable_innodb_metrics => 'false', -# dbm => 'false', -# queries => [ -# { -# query => 'SELECT TIMESTAMPDIFF(second,MAX(create_time),NOW()) as last_accessed FROM requests', -# metric => 'app.seconds_since_last_request', -# type => 'gauge', -# field => 'last_accessed', -# }, -# ], -# } -# } # +# @example +# class { 'datadog_agent::integrations::mysql' : +# host => 'localhost', +# password => 'some_pass', +# user => 'datadog' +# } # -class datadog_agent::integrations::mysql( +# @example +# class { 'datadog_agent::integrations::mysql' : +# instances => [{ +# host => 'localhost', +# password => 'mypassword', +# user => 'datadog', +# port => '3306', +# tags => ['instance:mysql1'], +# replication => '0', +# galera_cluster => '0', +# extra_status_metrics => 'true', +# extra_innodb_metrics => 'true', +# extra_performance_metrics => 'true', +# schema_size_metrics => 'true', +# disable_innodb_metrics => 'false', +# dbm => 'false', +# queries => [ +# { +# query => 'SELECT TIMESTAMPDIFF(second,MAX(create_time),NOW()) as last_accessed FROM requests', +# metric => 'app.seconds_since_last_request', +# type => 'gauge', +# field => 'last_accessed', +# }, +# ], +# } +# } +# +class datadog_agent::integrations::mysql ( String $host = 'localhost', - Optional[String] $user = 'datadog', - Optional[Variant[String, Integer]] $port = 3306, + String $user = 'datadog', + Variant[String, Integer] $port = 3306, Optional[String] $password = undef, Optional[String] $sock = undef, Array $tags = [], - $replication = '0', - $galera_cluster = '0', + String $replication = '0', + String $galera_cluster = '0', Boolean $extra_status_metrics = false, Boolean $extra_innodb_metrics = false, Boolean $extra_performance_metrics = false, Boolean $schema_size_metrics = false, Boolean $disable_innodb_metrics = false, Optional[Boolean] $dbm = undef, - Optional[Array] $queries = [], + Array $queries = [], Optional[Array] $instances = undef, - Optional[Array] $logs = [], - ) inherits datadog_agent::params { - require ::datadog_agent + Array $logs = [], +) inherits datadog_agent::params { + require datadog_agent - if ($host == undef and $sock == undef) or - ($host != undef and $port == undef and $sock == undef) { + if ($host == undef and $sock == undef) or ($host != undef and $port == undef and $sock == undef) { fail('invalid MySQL configuration') } if !$instances and $host { $_instances = [{ - 'host' => $host, - 'password' => $password, - 'user' => $user, - 'port' => $port, - 'sock' => $sock, - 'tags' => $tags, - 'replication' => $replication, - 'galera_cluster' => $galera_cluster, - 'extra_status_metrics' => $extra_status_metrics, - 'extra_innodb_metrics' => $extra_innodb_metrics, - 'extra_performance_metrics' => $extra_performance_metrics, - 'schema_size_metrics' => $schema_size_metrics, - 'disable_innodb_metrics' => $disable_innodb_metrics, - 'dbm' => $dbm, - 'queries' => $queries, + 'host' => $host, + 'password' => $password, + 'user' => $user, + 'port' => $port, + 'sock' => $sock, + 'tags' => $tags, + 'replication' => $replication, + 'galera_cluster' => $galera_cluster, + 'extra_status_metrics' => $extra_status_metrics, + 'extra_innodb_metrics' => $extra_innodb_metrics, + 'extra_performance_metrics' => $extra_performance_metrics, + 'schema_size_metrics' => $schema_size_metrics, + 'disable_innodb_metrics' => $disable_innodb_metrics, + 'dbm' => $dbm, + 'queries' => $queries, }] - } elsif !$instances{ + } elsif !$instances { $_instances = [] } else { $_instances = $instances } $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/mysql.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/mysql.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -129,7 +130,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { @@ -146,4 +147,3 @@ notify => Service[$datadog_agent::params::service_name], } } - diff --git a/manifests/integrations/network.pp b/manifests/integrations/network.pp index 3b409d63..d1790bf7 100644 --- a/manifests/integrations/network.pp +++ b/manifests/integrations/network.pp @@ -1,25 +1,40 @@ -# Class: datadog_agent::integrations::network +# @summary Install the network integration # -# This class will install the network integration # -# Parameters: -# $collect_connection_state -# Enable TCP connection state counts +# @param collect_connection_state +# Enable TCP connection state counts +# @param collect_connection_queues +# @param excluded_interfaces +# @param excluded_interface_re +# @param combine_connection_states +# @param collect_rate_metrics +# @param collect_count_metrics +# @param conntrack_path +# @param use_sudo_conntrack +# @param whitelist_conntrack_metrics +# @param blacklist_conntrack_metrics +# @param collect_aws_ena_metrics +# @param tags +# @param service +# @param min_collection_interval +# @param empty_default_hostname +# @param metric_patterns_include +# @param metric_patterns_exclude # -# Sample Usage: # -# class { 'datadog_agent::integrations::network' : -# collect_connection_state => false, -# excluded_interfaces => [ -# 'lo0', -# 'lo', -# ], -# excluded_interface_re = 'eth1.*', -# combine_connection_states => true -# } +# @example +# class { 'datadog_agent::integrations::network' : +# collect_connection_state => false, +# excluded_interfaces => [ +# 'lo0', +# 'lo', +# ], +# excluded_interface_re = 'eth1.*', +# combine_connection_states => true +# } # -# -class datadog_agent::integrations::network( +class datadog_agent::integrations::network ( + # lint:ignore:params_empty_string_assignment Boolean $collect_connection_state = false, Boolean $collect_connection_queues = false, Array[String] $excluded_interfaces = [], @@ -38,14 +53,15 @@ Boolean $empty_default_hostname = false, Array[String] $metric_patterns_include = [], Array[String] $metric_patterns_exclude = [], + # lint:endignore ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/network.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/network.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -54,7 +70,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { diff --git a/manifests/integrations/nginx.pp b/manifests/integrations/nginx.pp index 20853a77..bf003d9d 100644 --- a/manifests/integrations/nginx.pp +++ b/manifests/integrations/nginx.pp @@ -1,16 +1,15 @@ -# Class: datadog_agent::integrations::nginx +# @summary Install the necessary configuration for the nginx integration # -# This class will install the necessary configuration for the nginx integration # -# Parameters: -# $instances: -# Array of hashes for all nginx urls and associates tags. See example -# $logs: -# (optional) log collection configuration, in the format described here: -# https://docs.datadoghq.com/integrations/nginx/ +# @param instances +# Array of hashes for all nginx urls and associates tags. See example # -# Sample Usage: +# @param logs +# (optional) log collection configuration, in the format described here: +# https://docs.datadoghq.com/integrations/nginx/ # +# +# @example # class { 'datadog_agent::integrations::nginx': # instances => [ # { @@ -58,18 +57,18 @@ # source: nginx # sourcecategory: 'http_web_access' # - -class datadog_agent::integrations::nginx( +# +class datadog_agent::integrations::nginx ( Array $instances = [], Optional[Array] $logs = undef, ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/nginx.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/nginx.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -78,7 +77,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { @@ -92,6 +91,6 @@ mode => $datadog_agent::params::permissions_protected_file, content => template('datadog_agent/agent-conf.d/nginx.yaml.erb'), require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } } diff --git a/manifests/integrations/ntp.pp b/manifests/integrations/ntp.pp index 14251377..1f6c066c 100644 --- a/manifests/integrations/ntp.pp +++ b/manifests/integrations/ntp.pp @@ -1,42 +1,36 @@ -# Class: datadog_agent::integrations::ntp +# @summary Enable ntp check # -# This class will enable ntp check # -# Parameters: -# $offset_threshold: -# Offset threshold for a critical alert. Defaults to 600. +# @param offset_threshold +# Offset threshold for a critical alert. Defaults to 600. +# @param host +# ntp server to use for ntp check +# @param port +# @param version +# @param timeout # -# $host: -# ntp server to use for ntp check # -# $port # -# $version +# @example +# class { 'datadog_agent::integrations::ntp' : +# offset_threshold => 60, +# host => 'pool.ntp.org', +# } # -# $timeout -# -# Sample Usage: -# -# class { 'datadog_agent::integrations::ntp' : -# offset_threshold => 60, -# host => 'pool.ntp.org', -# } -# - -class datadog_agent::integrations::ntp( - $offset_threshold = 60, - $host = undef, - $port = undef, - $version = undef, - $timeout = undef, +class datadog_agent::integrations::ntp ( + Integer $offset_threshold = 60, + Optional[Stdlib::Host] $host = undef, + Optional[Stdlib::Port] $port = undef, + Optional[String] $version = undef, + Optional[Integer] $timeout = undef, ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/ntp.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/ntp.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -45,7 +39,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { @@ -59,6 +53,6 @@ mode => $datadog_agent::params::permissions_protected_file, content => template('datadog_agent/agent-conf.d/ntp.yaml.erb'), require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } } diff --git a/manifests/integrations/oom_kill.pp b/manifests/integrations/oom_kill.pp index 62bb44a8..d15df900 100644 --- a/manifests/integrations/oom_kill.pp +++ b/manifests/integrations/oom_kill.pp @@ -1,14 +1,13 @@ -# Class: datadog_agent::integrations::oom_kill +# @summary Install the necessary configuration for the oom_kill integration # -# This class will install the necessary configuration for the oom_kill integration # For it to work you also need to enable the system-probe with enable_oom_kill set to true. # -# Parameters: -# $instances: -# Array of hashes for all oom_kill configs and associates tags. See example # -# Sample Usage: +# @param instances +# Array of hashes for all oom_kill configs and associates tags. See example # +# +# @example # class { 'datadog_agent::integrations::oom_kill': # instances => [ # { @@ -18,11 +17,11 @@ # ], # } # - -class datadog_agent::integrations::oom_kill( +# +class datadog_agent::integrations::oom_kill ( Array $instances = [], ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent $dst_dir = "${datadog_agent::params::conf_dir}/oom_kill.d" file { $dst_dir: @@ -31,7 +30,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" @@ -42,6 +41,6 @@ mode => $datadog_agent::params::permissions_protected_file, content => template('datadog_agent/agent-conf.d/oom_kill.yaml.erb'), require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } } diff --git a/manifests/integrations/pgbouncer.pp b/manifests/integrations/pgbouncer.pp index 1d9681d0..f470215f 100644 --- a/manifests/integrations/pgbouncer.pp +++ b/manifests/integrations/pgbouncer.pp @@ -1,63 +1,64 @@ -# Class: datadog_agent::integrations::pgbouncer +# @summary Install the necessary configuration for the pgbouncer integration # -# This class will install the necessary configuration for the pgbouncer integration # -# Parameters: -# $password: -# The password for the datadog user -# $host: -# The host pgbouncer is listening on -# $port: -# The pgbouncer port number -# $username: -# The username for the datadog user -# $tags: -# Optional array of tags -# $pgbouncers: -# Optional array of pgbouncer hashes. See example +# @param password +# The password for the datadog user +# @param host +# The host pgbouncer is listening on +# @param port +# The pgbouncer port number +# @param username +# The username for the datadog user +# @param tags +# Optional array of tags +# @param pgbouncers +# Optional array of pgbouncer hashes. See example # -# Sample Usage: # -# class { 'datadog_agent::integrations::pgbouncer' : -# host => 'localhost', -# username => 'datadog', -# port => '6432', -# password => 'some_pass', -# } +# @example +# class { 'datadog_agent::integrations::pgbouncer' : +# host => 'localhost', +# username => 'datadog', +# port => '6432', +# password => 'some_pass', +# } # -# class { 'datadog_agent::integrations::pgbouncer' : -# pgbouncers => [ -# { -# 'host' => 'localhost', -# 'username' => 'datadog', -# 'port' => '6432', -# 'password' => 'some_pass', -# 'tags' => ['instance:one'], -# }, -# { -# 'host' => 'localhost', -# 'username' => 'datadog2', -# 'port' => '6433', -# 'password' => 'some_pass2', -# }, -# ], -# } +# @example +# class { 'datadog_agent::integrations::pgbouncer' : +# pgbouncers => [ +# { +# 'host' => 'localhost', +# 'username' => 'datadog', +# 'port' => '6432', +# 'password' => 'some_pass', +# 'tags' => ['instance:one'], +# }, +# { +# 'host' => 'localhost', +# 'username' => 'datadog2', +# 'port' => '6433', +# 'password' => 'some_pass2', +# }, +# ], +# } # -class datadog_agent::integrations::pgbouncer( +class datadog_agent::integrations::pgbouncer ( + # lint:ignore:params_empty_string_assignment String $password = '', String $host = 'localhost', Variant[String, Integer] $port = '6432', String $username = 'datadog', Array $tags = [], Array $pgbouncers = [], + # lint:endignore ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/pgbouncer.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/pgbouncer.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -66,7 +67,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { diff --git a/manifests/integrations/php_fpm.pp b/manifests/integrations/php_fpm.pp index 01fd401d..ffced040 100644 --- a/manifests/integrations/php_fpm.pp +++ b/manifests/integrations/php_fpm.pp @@ -1,60 +1,55 @@ -# Class: datadog_agent::integrations::php_fpm +# @summary Set-up PHP FPM monitoring # -# This class will set-up PHP FPM monitoring # -# Parameters: -# $status_url -# URL to fetch FPM metrics. Default: http://localhost/status +# @param status_url +# URL to fetch FPM metrics. Default: http://localhost/status +# @param ping_url +# URL to get a reliable check of the FPM pool. Default: http://localhost/ping +# @param ping_reply +# Expected response from ping_url. Default: pong +# @param http_host +# @param tags +# Optional array of tags +# @param instances +# @param use_fastcgi +# Use fastcgi to get stats. Default: false # -# $ping_url -# URL to get a reliable check of the FPM pool. Default: http://localhost/ping # -# $ping_reply -# Expected response from ping_url. Default: pong +# @example +# class { 'datadog_agent::integrations::php_fpm' : +# status_url => 'http://localhost/fpm_status', +# ping_url => 'http://localhost/fpm_ping' +# } # -# $tags -# Optional array of tags -# -# $use_fastcgi -# Use fastcgi to get stats. Default: false -# -# Sample Usage: -# -# class { 'datadog_agent::integrations::php_fpm' : -# status_url => 'http://localhost/fpm_status', -# ping_url => 'http://localhost/fpm_ping' -# } -# - -class datadog_agent::integrations::php_fpm( - $status_url = 'http://localhost/status', - $ping_url = 'http://localhost/ping', - $ping_reply = 'pong', - $http_host = undef, - $tags = [], - $instances = undef, - $use_fastcgi = 'false' +class datadog_agent::integrations::php_fpm ( + Stdlib::HTTPUrl $status_url = 'http://localhost/status', + Stdlib::HTTPUrl $ping_url = 'http://localhost/ping', + String $ping_reply = 'pong', + Optional[Stdlib::Host] $http_host = undef, + Array $tags = [], + Optional[Hash] $instances = undef, + Enum['true', 'false'] $use_fastcgi = 'false' ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent if !$instances { $_instances = [{ - 'http_host' => $http_host, - 'status_url' => $status_url, - 'ping_url' => $ping_url, - 'ping_reply' => $ping_reply, - 'tags' => $tags, - 'use_fastcgi' => $use_fastcgi, + 'http_host' => $http_host, + 'status_url' => $status_url, + 'ping_url' => $ping_url, + 'ping_reply' => $ping_reply, + 'tags' => $tags, + 'use_fastcgi' => $use_fastcgi, }] } else { $_instances = $instances } $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/php_fpm.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/php_fpm.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -63,7 +58,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { @@ -77,6 +72,6 @@ mode => $datadog_agent::params::permissions_protected_file, content => template('datadog_agent/agent-conf.d/php_fpm.yaml.erb'), require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } } diff --git a/manifests/integrations/postfix.pp b/manifests/integrations/postfix.pp index 1226b8dd..e18ccfa3 100644 --- a/manifests/integrations/postfix.pp +++ b/manifests/integrations/postfix.pp @@ -1,58 +1,54 @@ -# Class: datadog_agent::integrations::postfix +# @summary Install the necessary configuration for the Postfix integration # -# This class will install the necessary configuration for the Postfix integration # -# Parameters: -# $url: -# url used to connect to the Postfixd instance -# $port: -# $tags -# Optional array of tags +# @param directory +# @param queues +# @param tags +# Optional array of tags +# @param instances # -# Sample Usage: # -# include 'datadog_agent::integrations::postfix' +# @example +# include 'datadog_agent::integrations::postfix' # -# OR +# @example +# class { 'datadog_agent::integrations::postfix': +# directory => '/var/spool/postfix-2' +# } # -# class { 'datadog_agent::integrations::postfix': -# directory => '/var/spool/postfix-2' -# } -# -# -# Sample Usage (Instance): -# class { 'datadog_agent::integrations::postfix' : -# instances => [{ -# directory => '/var/spool/postfix-2', -# queues => [ 'active', 'deferred' ] -# }] -# } +# @example +# class { 'datadog_agent::integrations::postfix' : +# instances => [{ +# directory => '/var/spool/postfix-2', +# queues => [ 'active', 'deferred' ] +# }] +# } # class datadog_agent::integrations::postfix ( - String $directory = '/var/spool/postfix', - Array $queues = [ 'active', 'deferred', 'incoming' ], - Optional[Array] $tags = [], + String $directory = '/var/spool/postfix', + Array $queues = ['active', 'deferred', 'incoming'], + Array $tags = [], Optional[Array] $instances = undef, ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent if !$instances and $directory { $_instances = [{ - 'directory' => $directory, - 'queues' => $queues, - 'tags' => $tags + 'directory' => $directory, + 'queues' => $queues, + 'tags' => $tags }] - } elsif !$instances{ + } elsif !$instances { $_instances = [] } else { $_instances = $instances } $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/postfix.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/postfix.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -61,7 +57,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { @@ -75,6 +71,6 @@ mode => $datadog_agent::params::permissions_protected_file, content => template('datadog_agent/agent-conf.d/postfix.yaml.erb'), require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } } diff --git a/manifests/integrations/postgres.pp b/manifests/integrations/postgres.pp index 00f3f22f..ef009176 100644 --- a/manifests/integrations/postgres.pp +++ b/manifests/integrations/postgres.pp @@ -1,69 +1,67 @@ -# Class: datadog_agent::integrations::postgres +# @summary Install the necessary configuration for the postgres integration # -# This class will install the necessary configuration for the postgres integration # -# Parameters: -# $password -# The password for the datadog user -# $host -# The host postgres is running on -# $dbname -# The postgres database name -# $port -# The postgres port number -# $username -# The username for the datadog user -# $ssl -# Boolean to enable SSL -# $use_psycopg2 -# Boolean to flag connecting to postgres with psycopg2 instead of pg8000. -# Warning, psycopg2 doesn't support ssl mode. -# $collect_function_metrics -# Boolean to enable collecting metrics regarding PL/pgSQL functions from pg_stat_user_functions. -# $collect_count_metrics -# Boolean to enable collecting count metrics, default value is True for backward compatibility but they might be slow, -# suggested value is False. -# $collect_activity_metrics -# Boolean to enable collecting metrics regarding transactions from pg_stat_activity, default value is False. -# Please make sure the user has sufficient privileges to read from pg_stat_activity before enabling this option. -# $collect_database_size_metrics -# Boolean to enable collecting database size metrics. Default value is True but they might be slow with large databases -# $collect_default_database -# Boolean to enable collecting statistics from the default database 'postgres' in the check metrics, default to false -# $tags -# Optional array of tags -# $tables -# Track per relation/table metrics. Array of strings. -# Warning: this can collect lots of metrics per relation -# (10 + 10 per index) -# $tags -# Optional array of tags -# $custom_metrics -# A hash of custom metrics with the following keys - query, metrics, -# relation, descriptors. Refer to this guide for details on those fields: -# https://help.datadoghq.com/hc/en-us/articles/208385813-Postgres-custom-metric-collection-explained +# @param password +# The password for the datadog user +# @param host +# The host postgres is running on +# @param dbname +# The postgres database name +# @param port +# The postgres port number +# @param username +# The username for the datadog user +# @param ssl +# Boolean to enable SSL +# @param use_psycopg2 +# Boolean to flag connecting to postgres with psycopg2 instead of pg8000. +# Warning, psycopg2 doesn't support ssl mode. +# @param collect_function_metrics +# Boolean to enable collecting metrics regarding PL/pgSQL functions from pg_stat_user_functions. +# @param collect_count_metrics +# Boolean to enable collecting count metrics, default value is True for backward compatibility but they might be slow, +# suggested value is False. +# @param collect_activity_metrics +# Boolean to enable collecting metrics regarding transactions from pg_stat_activity, default value is False. +# Please make sure the user has sufficient privileges to read from pg_stat_activity before enabling this option. +# @param collect_database_size_metrics +# Boolean to enable collecting database size metrics. Default value is True but they might be slow with large databases +# @param collect_default_database +# Boolean to enable collecting statistics from the default database 'postgres' in the check metrics, default to false +# @param tags +# Optional array of tags +# @param tables +# Track per relation/table metrics. Array of strings. +# Warning: this can collect lots of metrics per relation +# (10 + 10 per index) +# @param custom_metrics +# A hash of custom metrics with the following keys - query, metrics, +# relation, descriptors. Refer to this guide for details on those fields: +# https://help.datadoghq.com/hc/en-us/articles/208385813-Postgres-custom-metric-collection-explained +# @param instances +# Array of Hashes # -# Sample Usage: # -# class { 'datadog_agent::integrations::postgres' : -# host => 'localhost', -# dbname => 'postgres', -# username => 'datadog', -# password => 'some_pass', -# ssl => false, -# custom_metrics => { -# a_custom_query => { -# query => "select tag_column, %s from table", -# relation => false, -# metrics => { -# value_column => ["value_column.datadog.tag", "GAUGE"] -# }, -# descriptors => [ -# ["tag_column", "tag_column.datadog.tag"] -# ] -# } -# } -# } +# @example +# class { 'datadog_agent::integrations::postgres' : +# host => 'localhost', +# dbname => 'postgres', +# username => 'datadog', +# password => 'some_pass', +# ssl => false, +# custom_metrics => { +# a_custom_query => { +# query => "select tag_column, %s from table", +# relation => false, +# metrics => { +# value_column => ["value_column.datadog.tag", "GAUGE"] +# }, +# descriptors => [ +# ["tag_column", "tag_column.datadog.tag"] +# ] +# } +# } +# } # # Hiera Usage: # @@ -82,7 +80,7 @@ # descriptors: # - ["tag_column", "tag_column.datadog.tag"] # -class datadog_agent::integrations::postgres( +class datadog_agent::integrations::postgres ( Optional[String] $password = undef, String $host = 'localhost', String $dbname = 'postgres', @@ -100,13 +98,13 @@ Hash $custom_metrics = {}, Optional[Array] $instances = undef, ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/postgres.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/postgres.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -115,7 +113,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { @@ -124,23 +122,23 @@ if !$instances and $host { $_instances = [{ - 'host' => $host, - 'password' => $password, - 'dbname' => $dbname, - 'port' => $port, - 'username' => $username, - 'ssl' => $ssl, - 'use_psycopg2' => $use_psycopg2, - 'tags' => $tags, - 'tables' => $tables, - 'custom_metrics' => $custom_metrics, - 'collect_function_metrics' => $collect_function_metrics, - 'collect_count_metrics' => $collect_count_metrics, - 'collect_activity_metrics' => $collect_activity_metrics, - 'collect_database_size_metrics' => $collect_database_size_metrics, - 'collect_default_database' => $collect_default_database, + 'host' => $host, + 'password' => $password, + 'dbname' => $dbname, + 'port' => $port, + 'username' => $username, + 'ssl' => $ssl, + 'use_psycopg2' => $use_psycopg2, + 'tags' => $tags, + 'tables' => $tables, + 'custom_metrics' => $custom_metrics, + 'collect_function_metrics' => $collect_function_metrics, + 'collect_count_metrics' => $collect_count_metrics, + 'collect_activity_metrics' => $collect_activity_metrics, + 'collect_database_size_metrics' => $collect_database_size_metrics, + 'collect_default_database' => $collect_default_database, }] - } elsif !$instances{ + } elsif !$instances { $_instances = [] } else { $_instances = $instances diff --git a/manifests/integrations/postgres_custom_metric.pp b/manifests/integrations/postgres_custom_metric.pp index 91a7b913..76ab858c 100644 --- a/manifests/integrations/postgres_custom_metric.pp +++ b/manifests/integrations/postgres_custom_metric.pp @@ -1,27 +1,25 @@ -## +# @summary Handle the Postgres-Custom-Metric-File +# # The postgres_custom_metric defines a custom sql metric. # https://help.datadoghq.com/hc/en-us/articles/208385813-Postgres-custom-metric-collection-explained # -# $query: -# The custom metric SQL query. It must contain a '%s' for defining the metrics. # -# $metrics: +# @param query +# The custom metric SQL query. It must contain a '%s' for defining the metrics. +# @param metrics # a hash of column name to metric definition. a metric definition is an array # consisting of two columns -- the datadog metric name and the metric type. -# -# $relation: -# ? -# -# $descriptor: +# @param relation +# @param descriptors # an array that maps an sql column's to a tag. Each descriptor consists of two # fields -- column name, and datadog tag. -define datadog_agent::integrations::postgres_custom_metric( +# +define datadog_agent::integrations::postgres_custom_metric ( String $query, Hash $metrics, Boolean $relation = false, Array $descriptors = [], ) { - if $query !~ '^.*%s.*$' { fail('custom_metrics require %s for metric substitution') } diff --git a/manifests/integrations/process.pp b/manifests/integrations/process.pp index c69a3505..e7de3662 100644 --- a/manifests/integrations/process.pp +++ b/manifests/integrations/process.pp @@ -1,14 +1,12 @@ -# Class: datadog_agent::integrations::process +# @summary Install the necessary configuration for the process integration # -# This class will install the necessary configuration for the process integration # -# Parameters: -# $processes: -# Array of process hashes. See example -# $hiera_processes: -# Boolean to grab processes from hiera to allow merging +# @param hiera_processes +# Boolean to grab processes from hiera to allow merging +# @param init_config +# @param processes +# Array of process hashes, containing these Keys # -# Process hash keys: # search_strings # LIST OF STRINGS If one of the element in the list matches, # return the counter of all the processes that contain the string @@ -21,43 +19,47 @@ # CPU percent check interval: 0.1 - 1.0 sec. More time - more precise # Optional # -# Sample Usage: -# -# class { 'datadog_agent::integrations::process': -# processes => [ -# { -# 'name' => 'puppetmaster', -# 'search_string' => ['puppet master'], -# 'exact_match' => false, -# }, -# { -# 'name' => 'sshd', -# 'search_string' => ['/usr/sbin/sshd'], -# 'exact_match' => true, -# }, -# ], -# } - # +# @example +# class { 'datadog_agent::integrations::process': +# processes => [ +# { +# 'name' => 'puppetmaster', +# 'search_string' => ['puppet master'], +# 'exact_match' => false, +# }, +# { +# 'name' => 'sshd', +# 'search_string' => ['/usr/sbin/sshd'], +# 'exact_match' => true, +# }, +# ], +# } # -class datadog_agent::integrations::process( +class datadog_agent::integrations::process ( Boolean $hiera_processes = false, - $init_config = {}, - Array $processes = [], - ) inherits datadog_agent::params { - require ::datadog_agent + Hash $init_config = {}, + Array $processes = [], +) inherits datadog_agent::params { + require datadog_agent if $hiera_processes { - $local_processes = lookup({ 'name' => 'datadog_agent::integrations::process::processes', 'merge' => 'unique', 'default_value' => $processes }) + $local_processes = lookup( + { + 'name' => 'datadog_agent::integrations::process::processes', + 'merge' => 'unique', + 'default_value' => $processes, + } + ) } else { $local_processes = $processes } $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/process.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/process.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -66,7 +68,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { @@ -74,12 +76,12 @@ } file { $dst: - ensure => $local_processes.length ? { 0 => absent, default => file}, + ensure => $local_processes.length ? { 0 => 'absent', default => file }, owner => $datadog_agent::dd_user, group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_protected_file, content => template('datadog_agent/agent-conf.d/process.yaml.erb'), require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } } diff --git a/manifests/integrations/rabbitmq.pp b/manifests/integrations/rabbitmq.pp index 66313f84..9d480268 100644 --- a/manifests/integrations/rabbitmq.pp +++ b/manifests/integrations/rabbitmq.pp @@ -1,77 +1,70 @@ -# Class: datadog_agent::integrations::rabbitmq +# @summary Install the necessary config to hook the rabbitmq in the agent # -# This class will install the necessary config to hook the rabbitmq in the agent # -# Parameters: -# $url -# Required. URL pointing to the RabbitMQ Managment Plugin -# (http://www.rabbitmq.com/management.html) -# $username -# $password -# If your service uses basic authentication, you can optionally -# specify a username and password that will be used in the check. -# (it's set to guest/guest by RabbitMQ on setup) -# $tag_families -# Tag queues "families" based on regex match -# $ssl_verify -# Skip verification of the RabbitMQ management web endpoint -# SSL certificate -# $nodes -# $nodes_regexes -# Specify the nodes to collect metrics on (up to 100 nodes). -# If you have less than 100 nodes, metrics will be collected on all nodes -# by default. -# $queues -# $queues_regexes -# Specify the queues to collect metrics on (up to 200 queues). +# @param url +# Required. URL pointing to the RabbitMQ Managment Plugin +# (http://www.rabbitmq.com/management.html) +# @param username +# @param password +# If your service uses basic authentication, you can optionally +# specify a username and password that will be used in the check. +# (it's set to guest/guest by RabbitMQ on setup) +# @param ssl_verify +# Skip verification of the RabbitMQ management web endpoint +# SSL certificate +# @param tag_families +# Tag queues "families" based on regex match +# @param nodes +# @param nodes_regexes +# Specify the nodes to collect metrics on (up to 100 nodes). +# If you have less than 100 nodes, metrics will be collected on all nodes +# by default. +# @param queues +# @param queues_regexes +# Specify the queues to collect metrics on (up to 200 queues). +# If you have less than 200 queues, metrics will be collected on all queues +# by default. +# If vhosts are set, set queue names as `vhost_name/queue_name` +# If `tag families` are enabled, the first capture group in the regex will +# be used as the queue_family tag +# @param vhosts +# List of vhosts to monitor with service checks. By default, a list of all +# vhosts is fetched and each one will be checked using the aliveness API. +# @param exchanges +# @param exchanges_regexes +# Specify the exchanges to collect metrics on (up to 50 queues). +# If you have less than 50 queues, metrics will be collected on all exchanges +# by default. # -# If you have less than 200 queues, metrics will be collected on all queues -# by default. # -# If vhosts are set, set queue names as `vhost_name/queue_name` +# @example +# class { 'datadog_agent::integrations::rabbitmq': +# url => 'http://localhost:15672/api/', +# username => 'guest', +# password => 'guest', +# } # -# If `tag families` are enabled, the first capture group in the regex will -# be used as the queue_family tag -# $exchanges -# $exchanges_regexes -# Specify the exchanges to collect metrics on (up to 50 queues). -# If you have less than 50 queues, metrics will be collected on all exchanges -# by default. -# $vhosts -# List of vhosts to monitor with service checks. By default, a list of all -# vhosts is fetched and each one will be checked using the aliveness API. -# -# Sample Usage: -# -# class { 'datadog_agent::integrations::rabbitmq': -# url => 'http://localhost:15672/api/', -# username => 'guest', -# password => 'guest', -# } -# - class datadog_agent::integrations::rabbitmq ( - Optional[String] $url = undef, - Optional[String] $username = 'guest', - Optional[String] $password = 'guest', - Boolean $ssl_verify = true, - Boolean $tag_families = false, - Array $nodes = [], - Array $nodes_regexes = [], - Array $queues = [], - Array $queues_regexes = [], - Array $vhosts = [], - Array $exchanges = [], - Array $exchanges_regexes = [], + Optional[String] $url = undef, + String $username = 'guest', + String $password = 'guest', + Boolean $ssl_verify = true, + Boolean $tag_families = false, + Array $nodes = [], + Array $nodes_regexes = [], + Array $queues = [], + Array $queues_regexes = [], + Array $vhosts = [], + Array $exchanges = [], + Array $exchanges_regexes = [], ) inherits datadog_agent::params { - - require ::datadog_agent + require datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/rabbitmq.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/rabbitmq.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -80,7 +73,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { diff --git a/manifests/integrations/redis.pp b/manifests/integrations/redis.pp index b3c27760..4deeaea7 100644 --- a/manifests/integrations/redis.pp +++ b/manifests/integrations/redis.pp @@ -1,34 +1,33 @@ -# Class: datadog_agent::integrations::redis +# @summary Install the necessary configuration for the redis integration # -# This class will install the necessary configuration for the redis integration # -# Parameters: -# $host: -# The host redis is running on -# $password -# The redis password (optional) -# $port -# The main redis port. -# $ports -# Array of redis ports: overrides port (optional) -# $slowlog_max_len -# The max length of the slow-query log (optional) -# $tags -# Optional array of tags -# $keys -# Optional array of keys to check length -# $command_stats -# Collect INFO COMMANDSTATS output as metrics -# $instances -# Optional array of hashes should you wish to specify multiple instances. -# If this option is specified all other parameters will be overriden. -# This parameter may also be used to specify instances with hiera. +# @param host +# The host redis is running on +# @param password +# The redis password (optional) +# @param port +# The main redis port. +# @param ports +# Array of redis ports: overrides port (optional) +# @param slowlog_max_len +# The max length of the slow-query log (optional) +# @param tags +# Optional array of tags +# @param keys +# Optional array of keys to check length +# @param warn_on_missing_keys +# @param command_stats +# Collect INFO COMMANDSTATS output as metrics +# @param instances +# Optional array of hashes should you wish to specify multiple instances. +# If this option is specified all other parameters will be overriden. +# This parameter may also be used to specify instances with hiera. # -# Sample Usage: # -# class { 'datadog_agent::integrations::redis' : -# host => 'localhost', -# } +# @example +# class { 'datadog_agent::integrations::redis' : +# host => 'localhost', +# } # # Hiera Usage: # @@ -40,7 +39,8 @@ # warn_on_missing_keys: true # command_stats: false # -class datadog_agent::integrations::redis( +class datadog_agent::integrations::redis ( + # lint:ignore:params_empty_string_assignment String $host = 'localhost', String $password = '', Variant[String, Integer] $port = '6379', @@ -51,12 +51,12 @@ Boolean $warn_on_missing_keys = true, Boolean $command_stats = false, Optional[Array] $instances = undef, - + # lint:endignore ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent if $ports == undef { - $_ports = [ $port ] + $_ports = [$port] } else { $_ports = $ports } @@ -75,10 +75,10 @@ } $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/redisdb.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/redisdb.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -87,7 +87,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { @@ -96,7 +96,7 @@ if !$instances and $host { $_instances = $_port_instances - } elsif !$instances{ + } elsif !$instances { $_instances = [] } else { $_instances = $instances @@ -109,6 +109,6 @@ mode => $datadog_agent::params::permissions_protected_file, content => template('datadog_agent/agent-conf.d/redisdb.yaml.erb'), require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } } diff --git a/manifests/integrations/riak.pp b/manifests/integrations/riak.pp index 5d5ab753..eaf607ef 100644 --- a/manifests/integrations/riak.pp +++ b/manifests/integrations/riak.pp @@ -1,34 +1,31 @@ -# Class: datadog_agent::integrations::riak +# @summary Install the necessary configuration for the riak integration # -# This class will install the necessary configuration for the riak integration # -# Parameters: -# $url: -# The URL for riak -# $tags -# Optional array of tags +# @param url +# The URL for riak +# @param tags +# Optional array of tags # -# Sample Usage: # +# @example # include 'datadog_agent::integrations::riak' # -# OR -# +# @example # class { 'datadog_agent::integrations::riak' : # url => 'http://localhost:8098/stats', # } # -class datadog_agent::integrations::riak( +class datadog_agent::integrations::riak ( String $url = 'http://localhost:8098/stats', Array $tags = [], ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/riak.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/riak.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -37,7 +34,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { @@ -52,6 +49,6 @@ mode => $datadog_agent::params::permissions_file, content => template('datadog_agent/agent-conf.d/riak.yaml.erb'), require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } } diff --git a/manifests/integrations/snmp.pp b/manifests/integrations/snmp.pp index 6527859d..f529c6b6 100755 --- a/manifests/integrations/snmp.pp +++ b/manifests/integrations/snmp.pp @@ -1,22 +1,23 @@ -# Class: datadog_agent::integrations::snmp +# @summary Enable snmp check # -# This class will enable snmp check # -# Parameters: -# $init_config: -# Optional hash (see snmp.yaml.example for reference) +# @param mibs_folder +# (Deprecated in favor of $init_config) +# @param ignore_nonincreasing_oid +# (Deprecated in favor of $init_config) +# @param init_config +# Optional hash (see snmp.yaml.example for reference) +# @param instances +# Array of hashes containing snmp instance configuration (see snmp.yaml.example for reference) +# @param snmp_v1_instances +# (Deprecated in favor of $instances) +# @param snmp_v2_instances +# (Deprecated in favor of $instances) +# @param snmp_v3_instances +# (Deprecated in favor of $instances) # -# $instances: -# Array of hashes containing snmp instance configuration (see snmp.yaml.example for reference) -# -# $mibs_folder: (Deprecated in favor of $init_config) -# $ignore_nonincreasing_oid: (Deprecated in favor of $init_config) -# $snmp_v1_instances: (Deprecated in favor of $instances) -# $snmp_v2_instances: (Deprecated in favor of $instances) -# $snmp_v3_instances: (Deprecated in favor of $instances) -# -# Sample Usage: # +# @example # class { 'datadog_agent::integrations::snmp': # instances => [ # { @@ -49,18 +50,17 @@ # } # ], # } - - +# class datadog_agent::integrations::snmp ( - $mibs_folder = undef, - $ignore_nonincreasing_oid = false, - $init_config = {}, - $instances = [], - $snmp_v1_instances = [], - $snmp_v2_instances = [], - $snmp_v3_instances = [], + Optional[Any] $mibs_folder = undef, + Boolean $ignore_nonincreasing_oid = false, + Hash $init_config = {}, + Array $instances = [], + Array $snmp_v1_instances = [], + Array $snmp_v2_instances = [], + Array $snmp_v3_instances = [], ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent $versioned_instances = { 1 => $snmp_v1_instances, @@ -69,10 +69,10 @@ } $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/snmp.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/snmp.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -81,7 +81,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { @@ -95,6 +95,6 @@ mode => $datadog_agent::params::permissions_protected_file, content => template('datadog_agent/agent-conf.d/snmp.yaml.erb'), require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } } diff --git a/manifests/integrations/solr.pp b/manifests/integrations/solr.pp index 4c6db020..8acd3dfe 100644 --- a/manifests/integrations/solr.pp +++ b/manifests/integrations/solr.pp @@ -1,48 +1,46 @@ -# Class: datadog_agent::integrations::solr +# @summary Install the necessary configuration for the solr integration # -# This class will install the necessary configuration for the solr integration # -# Parameters: -# $hostname: -# The host solr is running on. Defaults to 'localhost' -# $port -# The JMX port. -# $username -# The username for connecting to the running JVM. Optional. -# $password -# The password for connecting to the running JVM. Optional. -# $java_bin_path -# The path to the Java binary. Should be set if the agent cannot find your java executable. Optional. -# $trust_store_path -# The path to the trust store. Should be set if ssl is enabled. Optional. -# $trust_store_password -# The trust store password. Should be set if ssl is enabled. Optional. -# $tags -# Optional hash of tags { env => 'prod' }. +# @param hostname +# The host solr is running on. Defaults to 'localhost' +# @param port +# The JMX port. +# @param username +# The username for connecting to the running JVM. Optional. +# @param password +# The password for connecting to the running JVM. Optional. +# @param java_bin_path +# The path to the Java binary. Should be set if the agent cannot find your java executable. Optional. +# @param trust_store_path +# The path to the trust store. Should be set if ssl is enabled. Optional. +# @param trust_store_password +# The trust store password. Should be set if ssl is enabled. Optional. +# @param tags +# Optional hash of tags { env => 'prod' }. # -# Sample Usage: # -# class { 'datadog_agent::integrations::solr': -# port => 8081, -# } +# @example +# class { 'datadog_agent::integrations::solr': +# port => 8081, +# } # -class datadog_agent::integrations::solr( - $hostname = 'localhost', - $port = 7199, - $username = undef, - $password = undef, - $java_bin_path = undef, - $trust_store_path = undef, - $trust_store_password = undef, - $tags = {}, +class datadog_agent::integrations::solr ( + Stdlib::Host $hostname = 'localhost', + Stdlib::Port $port = 7199, + Optional[String] $username = undef, + Optional[String] $password = undef, + Optional[Stdlib::Absolutepath] $java_bin_path = undef, + Optional[Stdlib::Absolutepath] $trust_store_path = undef, + Optional[String] $trust_store_password = undef, + Hash $tags = {}, ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/solr.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/solr.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -51,7 +49,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { @@ -65,7 +63,6 @@ mode => $datadog_agent::params::permissions_protected_file, content => template('datadog_agent/agent-conf.d/solr.yaml.erb'), require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } - } diff --git a/manifests/integrations/ssh.pp b/manifests/integrations/ssh.pp index 697497bc..b03bbce4 100644 --- a/manifests/integrations/ssh.pp +++ b/manifests/integrations/ssh.pp @@ -1,47 +1,38 @@ -# Class: datadog_agent::integrations::ssh -# -# This class will enable ssh check -# -# Parameters: -# $host: -# ssh server to use for ssh check -# -# $port -# -# $username -# -# $password -# -# $sftp_check -# -# $private_key_file -# -# $add_missing_keys -# -# Sample Usage: -# -# class { 'datadog_agent::integrations::ssh' : -# host => 'localhost', -# private_key_file => '/opt/super_secret_key', -# } -# - -class datadog_agent::integrations::ssh( - $host = $trusted['certname'], - $port = 22, - $username = $datadog_agent::dd_user, - $password = undef, - $sftp_check = true, - $private_key_file = undef, - $add_missing_keys = true, +# @summary Enable ssh check +# +# +# @param host +# ssh server to use for ssh check +# @param port +# @param username +# @param password +# @param sftp_check +# @param private_key_file +# @param add_missing_keys +# +# +# @example +# class { 'datadog_agent::integrations::ssh' : +# host => 'localhost', +# private_key_file => '/opt/super_secret_key', +# } +# +class datadog_agent::integrations::ssh ( + Stdlib::Host $host = $trusted['certname'], + Stdlib::Port $port = 22, + String $username = $datadog_agent::dd_user, + Optional[String] $password = undef, + Boolean $sftp_check = true, + Optional[Stdlib::Absolutepath] $private_key_file = undef, + Boolean $add_missing_keys = true, ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/ssh.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/ssh_check.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -50,7 +41,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { @@ -64,6 +55,6 @@ mode => $datadog_agent::params::permissions_protected_file, content => template('datadog_agent/agent-conf.d/ssh.yaml.erb'), require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } } diff --git a/manifests/integrations/supervisord.pp b/manifests/integrations/supervisord.pp index 6ad15166..7b9d839e 100644 --- a/manifests/integrations/supervisord.pp +++ b/manifests/integrations/supervisord.pp @@ -1,8 +1,9 @@ -# Class: datadog_agent::integrations::supervisord +# @summary Install the necessary configuration for the supervisord integration # -# This class will install the necessary configuration for the supervisord integration # -# Parameters: +# @param instances +# an Array of Hashes, containing these Keys: +# # servername # socket # Optional. The socket on which supervisor listen for HTTP/XML-RPC requests. @@ -21,36 +22,32 @@ # Optional. Service check for connections to supervisord server. # # -# Sample Usage: -# -# class { 'datadog_agent::integrations::supervisord': -# instances => [ -# { -# servername => 'server0', -# socket => 'unix:///var/run//supervisor.sock', -# }, -# { -# servername => 'server1', -# hostname => 'localhost', -# port => '9001', -# proc_names => ['java', 'apache2'], -# }, -# ], -# } -# +# @example +# class { 'datadog_agent::integrations::supervisord': +# instances => [ +# { +# servername => 'server0', +# socket => 'unix:///var/run//supervisor.sock', +# }, +# { +# servername => 'server1', +# hostname => 'localhost', +# port => '9001', +# proc_names => ['java', 'apache2'], +# }, +# ], +# } # -# - class datadog_agent::integrations::supervisord ( - $instances = [{'servername' => 'server0', 'hostname' => 'localhost', 'port' => '9001'}], + Array[Hash] $instances = [{ 'servername' => 'server0', 'hostname' => 'localhost', 'port' => '9001' }], ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/supervisord.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/supervisord.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -59,7 +56,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { @@ -73,6 +70,6 @@ mode => $datadog_agent::params::permissions_protected_file, content => template('datadog_agent/agent-conf.d/supervisord.yaml.erb'), require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } } diff --git a/manifests/integrations/system_core.pp b/manifests/integrations/system_core.pp index 19a0a4e2..da7a90a4 100644 --- a/manifests/integrations/system_core.pp +++ b/manifests/integrations/system_core.pp @@ -1,19 +1,18 @@ -# Class: datadog_agent::integrations::system_core +# @summary Install the necessary configuration for the system_core integration # -# This class will install the necessary configuration for the system_core integration # -# Sample Usage: +# @example # include 'datadog_agent::integrations::system_core' # # class datadog_agent::integrations::system_core inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/system_core.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/system_core.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -22,7 +21,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { @@ -30,12 +29,12 @@ } file { $dst: - ensure => file, - owner => $datadog_agent::dd_user, - group => $datadog_agent::params::dd_group, - mode => $datadog_agent::params::permissions_file, - content => template('datadog_agent/agent-conf.d/system_core.yaml.erb'), - require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + ensure => file, + owner => $datadog_agent::dd_user, + group => $datadog_agent::params::dd_group, + mode => $datadog_agent::params::permissions_file, + content => template('datadog_agent/agent-conf.d/system_core.yaml.erb'), + require => Package[$datadog_agent::params::package_name], + notify => Service[$datadog_agent::params::service_name], } } diff --git a/manifests/integrations/tcp_check.pp b/manifests/integrations/tcp_check.pp index bd5be538..5d9aea98 100644 --- a/manifests/integrations/tcp_check.pp +++ b/manifests/integrations/tcp_check.pp @@ -1,127 +1,117 @@ -# Class: datadog_agent::integrations::tcp_check +# @summary Install the necessary config to hook the tcp_check in the agent # -# This class will install the necessary config to hook the tcp_check in the agent # -# Parameters: -# check_name -# (Required) - Name of the service. +# @param check_name +# (Required) - Name of the service. # This will be included as a tag: instance:. +# @param host +# (Required) - Host to be checked. +# This will be included as a tag: url::. +# @param port +# (Required) - Port to be checked. +# This will be included as a tag: url::. +# @param timeout +# (Optional) - Timeout for the check. Defaults to 10 seconds. +# @param threshold +# (Optional) - Used in conjunction with window. An alert will +# trigger if the check fails times in attempts. +# @param window +# (Optional) - Refer to threshold. +# @param collect_response_time +# (Optional) - Defaults to false. If this is not set to true, no +# response time metric will be collected. If it is set to true, the +# metric returned is network.tcp.response_time. +# @param skip_event +# The (optional) skip_event parameter will instruct the check to not +# create any event to avoid duplicates with a server side service check. +# This default to False. +# @param tags +# The (optional) tags to add to the check instance. +# @param instances +# An Array of Hashes +# +# +# @example Add a class for each check instance: +# class { 'datadog_agent::integrations::tcp_check': +# check_name => 'localhost-ftp', +# host => 'ftp.example.com', +# port => '21', +# } +# +# @example +# class { 'datadog_agent::integrations::tcp_check': +# check_name => 'localhost-ssh', +# host => '127.0.0.1', +# port => '22', +# threshold => 1, +# window => 1, +# tags => ['production', 'ssh access'], +# } +# +# @example +# class { 'datadog_agent::integrations::tcp_check': +# name => 'localhost-web-response', +# host => '127.0.0.1', +# port => '80', +# timeout => '8', +# threshold => 1, +# window => 1, +# collect_response_time => 1, +# skip_event => 1, +# tags => ['production', 'webserver response time'], +# } +# +# @example Add multiple instances in one class declaration: +# class { 'datadog_agent::integrations::tcp_check': +# instances => [{ +# 'check_name' => 'www.example.com-http', +# 'host' => 'www.example.com', +# 'port' => '80', +# }, +# { +# 'check_name' => 'www.example.com-https', +# 'host' => 'www.example.com', +# 'port' => '443', +# }] +# } # -# host -# (Required) - Host to be checked. -# This will be included as a tag: url::. -# -# port -# (Required) - Port to be checked. -# This will be included as a tag: url::. -# -# timeout -# (Optional) - Timeout for the check. Defaults to 10 seconds. -# -# threshold -# (Optional) - Used in conjunction with window. An alert will -# trigger if the check fails times in attempts. -# -# window -# (Optional) - Refer to threshold. -# -# collect_response_time -# (Optional) - Defaults to false. If this is not set to true, no -# response time metric will be collected. If it is set to true, the -# metric returned is network.tcp.response_time. -# -# skip_event -# The (optional) skip_event parameter will instruct the check to not -# create any event to avoid duplicates with a server side service check. -# This default to False. -# -# tags -# The (optional) tags to add to the check instance. -# -# Sample Usage: -# -# Add a class for each check instance: -# -# class { 'datadog_agent::integrations::tcp_check': -# check_name => 'localhost-ftp', -# host => 'ftp.example.com', -# port => '21', -# } -# -# class { 'datadog_agent::integrations::tcp_check': -# check_name => 'localhost-ssh', -# host => '127.0.0.1', -# port => '22', -# threshold => 1, -# window => 1, -# tags => ['production', 'ssh access'], -# } -# -# class { 'datadog_agent::integrations::tcp_check': -# name => 'localhost-web-response', -# host => '127.0.0.1', -# port => '80', -# timeout => '8', -# threshold => 1, -# window => 1, -# collect_response_time => 1, -# skip_event => 1, -# tags => ['production', 'webserver response time'], -# } -# -# Add multiple instances in one class declaration: -# -# class { 'datadog_agent::integrations::tcp_check': -# instances => [{ -# 'check_name' => 'www.example.com-http', -# 'host' => 'www.example.com', -# 'port' => '80', -# }, -# { -# 'check_name' => 'www.example.com-https', -# 'host' => 'www.example.com', -# 'port' => '443', -# }] -# } - - class datadog_agent::integrations::tcp_check ( - $check_name = undef, - $host = undef, - $port = undef, - Integer $timeout = 10, - $threshold = undef, - $window = undef, - $collect_response_time = undef, - $skip_event = undef, - Array $tags = [], - Optional[Array] $instances = undef, + Optional[String] $check_name = undef, + Optional[Stdlib::Host] $host = undef, + Optional[Stdlib::Port] $port = undef, + Integer $timeout = 10, + Optional[Integer] $threshold = undef, + Optional[Any] $window = undef, + Optional[Integer] $collect_response_time = undef, + Optional[Any] $skip_event = undef, + Array $tags = [], + Optional[Array] $instances = undef, ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent if !$instances and $host { $_instances = [{ - 'check_name' => $check_name, - 'host' => $host, - 'port' => $port, - 'timeout' => $timeout, - 'threshold' => $threshold, - 'window' => $window, - 'collect_response_time' => $collect_response_time, - 'skip_event' => $skip_event, - 'tags' => $tags, + 'check_name' => $check_name, + 'host' => $host, + 'port' => $port, + 'timeout' => $timeout, + 'threshold' => $threshold, + 'window' => $window, + 'collect_response_time' => $collect_response_time, + 'skip_event' => $skip_event, + 'tags' => $tags, }] - } elsif !$instances{ + } elsif !$instances { $_instances = [] } else { $_instances = $instances } $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/tcp_check.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/tcp_check.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -130,7 +120,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { @@ -144,6 +134,6 @@ mode => $datadog_agent::params::permissions_protected_file, content => template('datadog_agent/agent-conf.d/tcp_check.yaml.erb'), require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } } diff --git a/manifests/integrations/tomcat.pp b/manifests/integrations/tomcat.pp index 5092603f..2798cb1d 100644 --- a/manifests/integrations/tomcat.pp +++ b/manifests/integrations/tomcat.pp @@ -1,52 +1,49 @@ -# Class: datadog_agent::integrations::tomcat +# @@summary Install the necessary configuration for the tomcat integration # -# This class will install the necessary configuration for the tomcat integration # -# Parameters: -# $hostname: -# The host tomcat is running on. Defaults to 'localhost' -# $port -# The JMX port. -# $jmx_url -# The JMX URL. -# $username -# The username for connecting to the running JVM. Optional. -# $password -# The password for connecting to the running JVM. Optional. -# $java_bin_path -# The path to the Java binary. Should be set if the agent cannot find your java executable. Optional. -# $trust_store_path -# The path to the trust store. Should be set if ssl is enabled. Optional. -# $trust_store_password -# The trust store password. Should be set if ssl is enabled. Optional. -# $tags -# Optional hash of tags { env => 'prod' }. +# @param hostname +# The host tomcat is running on. Defaults to 'localhost' +# @param port +# The JMX port. +# @param jmx_url +# The JMX URL. +# @param username +# The username for connecting to the running JVM. Optional. +# @param password +# The password for connecting to the running JVM. Optional. +# @param java_bin_path +# The path to the Java binary. Should be set if the agent cannot find your java executable. Optional. +# @param trust_store_path +# The path to the trust store. Should be set if ssl is enabled. Optional. +# @param trust_store_password +# The trust store password. Should be set if ssl is enabled. Optional. +# @param tags +# Optional hash of tags { env => 'prod' }. # -# Sample Usage: # -# class { 'datadog_agent::integrations::tomcat': -# port => 8081, -# } +# @example +# class { 'datadog_agent::integrations::tomcat': +# port => 8081, +# } # -class datadog_agent::integrations::tomcat( - $hostname = 'localhost', - $port = 7199, - $jmx_url = undef, - $username = undef, - $password = undef, - $java_bin_path = undef, - $trust_store_path = undef, - $trust_store_password = undef, - $tags = {}, +class datadog_agent::integrations::tomcat ( + Stdlib::Host $hostname = 'localhost', + Stdlib::Port $port = 7199, + Optional[String] $jmx_url = undef, + Optional[String] $username = undef, + Optional[String] $password = undef, + Optional[Stdlib::Absolutepath] $java_bin_path = undef, + Optional[Stdlib::Absolutepath] $trust_store_path = undef, + Optional[String] $trust_store_password = undef, + Hash $tags = {}, ) inherits datadog_agent::params { - require ::datadog_agent - + require datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/tomcat.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/tomcat.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -55,7 +52,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { @@ -69,7 +66,6 @@ mode => $datadog_agent::params::permissions_protected_file, content => template('datadog_agent/agent-conf.d/tomcat.yaml.erb'), require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } - } diff --git a/manifests/integrations/twemproxy.pp b/manifests/integrations/twemproxy.pp index f5f065c2..6119b5a0 100644 --- a/manifests/integrations/twemproxy.pp +++ b/manifests/integrations/twemproxy.pp @@ -1,51 +1,50 @@ -# Class: datadog_agent::integrations::twemproxy +# @summary Install the necessary configuration for the twemproxy aka nutcracker integration # -# This class will install the necessary configuration for the twemproxy aka nutcracker integration # -# Parameters: -# $host: -# The host twemproxy is running on. Defaults to '127.0.0.1' -# $port -# The twemproxy password for the datadog user. Defaults to 22222 +# @param host +# The host twemproxy is running on. Defaults to '127.0.0.1' +# @param port +# The twemproxy password for the datadog user. Defaults to 22222 +# @param instances # -# Sample Usage: # -# class { 'datadog_agent::integrations::twemproxy' : -# instances => [ -# { -# 'host' => 'localhost', -# 'port' => '22222', -# }, -# { -# 'host' => 'localhost', -# 'port' => '22223', -# }, -# ] -# } +# @example +# class { 'datadog_agent::integrations::twemproxy' : +# instances => [ +# { +# 'host' => 'localhost', +# 'port' => '22222', +# }, +# { +# 'host' => 'localhost', +# 'port' => '22223', +# }, +# ] +# } # -class datadog_agent::integrations::twemproxy( - $host = 'localhost', - $port = '22222', - $instances = undef, +class datadog_agent::integrations::twemproxy ( + Stdlib::Host $host = 'localhost', + Stdlib::Port $port = 22222, + Optional[Hash] $instances = undef, ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent if !$instances and $host { $_instances = [{ - 'host' => $host, - 'port' => $port, + 'host' => $host, + 'port' => $port, }] - } elsif !$instances{ + } elsif !$instances { $_instances = [] } else { $_instances = $instances } $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/twemproxy.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/twemproxy.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -54,7 +53,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { @@ -68,6 +67,6 @@ mode => $datadog_agent::params::permissions_protected_file, content => template('datadog_agent/agent-conf.d/twemproxy.yaml.erb'), require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } } diff --git a/manifests/integrations/varnish.pp b/manifests/integrations/varnish.pp index 95e31e8a..2f69f86f 100644 --- a/manifests/integrations/varnish.pp +++ b/manifests/integrations/varnish.pp @@ -1,38 +1,35 @@ -# Class: datadog_agent::integrations::varnish +# @summary Install the necessary configuration for the varnish integration # -# This class will install the necessary configuration for the varnish integration # -# Parameters: -# varnishstat -# Path to the varnishstat binary +# @param varnishstat +# Path to the varnishstat binary +# @param instance_name +# Used in the varnishstat command for the -n argument +# @param tags +# DataDog tags # -# instance_name -# Used in the varnishstat command for the -n argument # -# tags -# DataDog tags +# @example +# include 'datadog_agent::integrations::varnish' # -# Sample usage: -# -# include 'datadog_agent::integrations::varnish' -# -# class { 'datadog_agent::integrations::varnish': -# url => '/usr/bin/varnishstat', -# tags => ['env:production'], -# } +# @example +# class { 'datadog_agent::integrations::varnish': +# url => '/usr/bin/varnishstat', +# tags => ['env:production'], +# } # class datadog_agent::integrations::varnish ( - $varnishstat = '/usr/bin/varnishstat', - $instance_name = undef, - $tags = [], + Stdlib::Absolutepath $varnishstat = '/usr/bin/varnishstat', + Optional[Strin] $instance_name = undef, + Array $tags = [], ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/varnish.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/varnish.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -41,7 +38,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { @@ -55,6 +52,6 @@ mode => $datadog_agent::params::permissions_protected_file, content => template('datadog_agent/agent-conf.d/varnish.yaml.erb'), require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } } diff --git a/manifests/integrations/zk.pp b/manifests/integrations/zk.pp index 0e3fad09..95a3f453 100644 --- a/manifests/integrations/zk.pp +++ b/manifests/integrations/zk.pp @@ -1,42 +1,42 @@ -# Class: datadog_agent::integrations::zk +# @summary Install the necessary configuration for the zk integration # -# This class will install the necessary configuration for the zk integration # -# Parameters: -# $host: +# @param servers +# an Array of Hashes containing these Keys: +# host: # The host zk is running on. Defaults to '127.0.0.1' -# $port +# port # The port zk is running on. Defaults to 2181 -# $tags +# tags # Optional array of tags # -# Sample Usage: # -# class { 'datadog_agent::integrations::zk' : -# servers => [ -# { -# 'host' => 'localhost', -# 'port' => '2181', -# 'tags' => [], -# }, -# { -# 'host' => 'localhost', -# 'port' => '2182', -# 'tags' => [], -# }, -# ] -# } +# @example +# class { 'datadog_agent::integrations::zk' : +# servers => [ +# { +# 'host' => 'localhost', +# 'port' => '2181', +# 'tags' => [], +# }, +# { +# 'host' => 'localhost', +# 'port' => '2182', +# 'tags' => [], +# }, +# ] +# } # class datadog_agent::integrations::zk ( - $servers = [{'host' => 'localhost', 'port' => '2181'}] + Array[Hash] $servers = [{ 'host' => 'localhost', 'port' => '2181' }] ) inherits datadog_agent::params { - require ::datadog_agent + require datadog_agent $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/zk.yaml" - if $::datadog_agent::_agent_major_version > 5 { + if $datadog_agent::_agent_major_version > 5 { $dst_dir = "${datadog_agent::params::conf_dir}/zk.d" file { $legacy_dst: - ensure => 'absent' + ensure => 'absent', } file { $dst_dir: @@ -45,7 +45,7 @@ group => $datadog_agent::params::dd_group, mode => $datadog_agent::params::permissions_directory, require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } $dst = "${dst_dir}/conf.yaml" } else { @@ -59,6 +59,6 @@ mode => $datadog_agent::params::permissions_protected_file, content => template('datadog_agent/agent-conf.d/zk.yaml.erb'), require => Package[$datadog_agent::params::package_name], - notify => Service[$datadog_agent::params::service_name] + notify => Service[$datadog_agent::params::service_name], } } diff --git a/manifests/params.pp b/manifests/params.pp index 26297f4b..36116136 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -1,8 +1,6 @@ -# Class: datadog_agent::params +# @summary Contains the parameters for the Datadog module # -# This class contains the parameters for the Datadog module # - class datadog_agent::params { $datadog_site = 'datadoghq.com' $dd_groups = undef @@ -26,7 +24,7 @@ case $facts['os']['name'] { 'Ubuntu','Debian','Raspbian' : { $rubydev_package = 'ruby-dev' - case $::operatingsystemrelease{ + case $facts['os']['release']['full'] { '14.04': { # Specific ruby/rubygems package name for Ubuntu 14.04 $ruby_package = 'ruby' @@ -71,19 +69,24 @@ $agent_binary = '/opt/datadog-agent/bin/agent/agent' } 'Windows': { - $legacy_conf_dir = 'C:/ProgramData/Datadog/agent5' # Not a real path, but integrations use it to ensure => absent so it needs to be a valid path + # Not a real path, but integrations use it to ensure => absent so it needs to be a valid path + $legacy_conf_dir = 'C:/ProgramData/Datadog/agent5' $conf_dir = 'C:/ProgramData/Datadog/conf.d' $dd_user = 'ddagentuser' - $dd_group = 'S-1-5-32-544' # Administrators group, passed as SID so it works on localized Windows versions + # Administrators group, passed as SID so it works on localized Windows versions + $dd_group = 'S-1-5-32-544' $service_name = 'datadogagent' $agent_log_file = 'C:/ProgramData/Datadog/logs/agent.log' - $package_name = 'Datadog Agent' # Must be the app's DisplayName. https://puppet.com/docs/puppet/latest/resources_package_windows.html - $permissions_directory = '0775' # On Windows, the Administrators group needs to maintain access, - $permissions_file = '0664' # otherwise puppet itself won't be able to access the file. Reported - $permissions_protected_file = '0660' # as bug in: https://tickets.puppetlabs.com/browse/PA-2877 + # Must be the app's DisplayName. https://puppet.com/docs/puppet/latest/resources_package_windows.html + $package_name = 'Datadog Agent' + # On Windows, the Administrators group needs to maintain access, + # otherwise puppet itself won't be able to access the file. Reported + # as bug in: https://tickets.puppetlabs.com/browse/PA-2877 + $permissions_directory = '0775' + $permissions_file = '0664' + $permissions_protected_file = '0660' $agent_binary = 'C:/Program Files/Datadog/Datadog Agent/embedded/agent.exe' } default: { fail("Class[datadog_agent]: Unsupported operatingsystem: ${facts['os']['name']}") } } - } diff --git a/manifests/redhat.pp b/manifests/redhat.pp index 40237990..c358c134 100644 --- a/manifests/redhat.pp +++ b/manifests/redhat.pp @@ -1,9 +1,14 @@ -# Class: datadog_agent::redhat +# @summary Contains the DataDog agent installation mechanism for Red Hat derivatives # -# This class contains the DataDog agent installation mechanism for Red Hat derivatives # - -class datadog_agent::redhat( +# @param agent_major_version +# @param agent_repo_uri +# @param manage_repo +# @param agent_version +# @param agent_flavor +# @param rpm_repo_gpgcheck +# +class datadog_agent::redhat ( Integer $agent_major_version = $datadog_agent::params::default_agent_major_version, Optional[String] $agent_repo_uri = undef, Boolean $manage_repo = true, @@ -11,14 +16,12 @@ String $agent_flavor = $datadog_agent::params::package_name, Optional[Boolean] $rpm_repo_gpgcheck = undef, ) inherits datadog_agent::params { - if $manage_repo { - $keys = [ - 'https://keys.datadoghq.com/DATADOG_RPM_KEY_CURRENT.public', - 'https://keys.datadoghq.com/DATADOG_RPM_KEY_E09422B3.public', - 'https://keys.datadoghq.com/DATADOG_RPM_KEY_FD4BF915.public', - 'https://keys.datadoghq.com/DATADOG_RPM_KEY_B01082D3.public', + 'https://keys.datadoghq.com/DATADOG_RPM_KEY_CURRENT.public', + 'https://keys.datadoghq.com/DATADOG_RPM_KEY_E09422B3.public', + 'https://keys.datadoghq.com/DATADOG_RPM_KEY_FD4BF915.public', + 'https://keys.datadoghq.com/DATADOG_RPM_KEY_B01082D3.public', ] if ($rpm_repo_gpgcheck != undef) { @@ -41,7 +44,6 @@ } else { $repo_gpgcheck = false } - } case $agent_major_version { @@ -75,15 +77,15 @@ ensure => absent, } - yumrepo {'datadog5': + yumrepo { 'datadog5': ensure => absent, } - yumrepo {'datadog6': + yumrepo { 'datadog6': ensure => absent, } - yumrepo {'datadog': + yumrepo { 'datadog': enabled => 1, gpgcheck => 1, gpgkey => join($gpgkeys, "\n "), diff --git a/manifests/reports.pp b/manifests/reports.pp index ad3fb119..ac9a71ef 100644 --- a/manifests/reports.pp +++ b/manifests/reports.pp @@ -1,67 +1,63 @@ -# Class: datadog_agent::reports +# @summary Configure the puppetmaster for reporting back to the datadog service # -# This class configures the puppetmaster for reporting back to -# the datadog service. # -# Parameters: -# $api_key: -# Your DataDog API Key. Please replace with your key value -# $datadog_site: -# URL to use to talk to the Datadog API +# @param api_key +# Your DataDog API Key. Please replace with your key value +# @param puppetmaster_user +# @param dogapi_version +# @param manage_dogapi_gem +# @param hostname_extraction_regex +# @param proxy_http +# @param proxy_https +# @param report_fact_tags +# @param report_trusted_fact_tags +# @param datadog_site +# URL to use to talk to the Datadog API +# @param puppet_gem_provider # -# Actions: -# -# Requires: -# -# Sample Usage: -# -class datadog_agent::reports( - $api_key, - $puppetmaster_user, - $dogapi_version, - $manage_dogapi_gem = true, - $hostname_extraction_regex = undef, - $proxy_http = undef, - $proxy_https = undef, - $report_fact_tags = [], - $report_trusted_fact_tags = [], - $datadog_site = 'https://api.datadoghq.com', - $puppet_gem_provider = $datadog_agent::params::gem_provider, +class datadog_agent::reports ( + String $api_key, + String $puppetmaster_user, + String $dogapi_version, + Boolean $manage_dogapi_gem = true, + Optional[String] $hostname_extraction_regex = undef, + Optional[String] $proxy_http = undef, + Optional[String] $proxy_https = undef, + Array $report_fact_tags = [], + Array $report_trusted_fact_tags = [], + Stdlib::HTTPUrl $datadog_site = 'https://api.datadoghq.com', + String $puppet_gem_provider = $datadog_agent::params::gem_provider, ) inherits datadog_agent::params { - - if ($facts['os']['name'] == 'Windows') { - + if $facts['os']['name'] == 'Windows' { fail('Reporting is not yet supported from a Windows host') - } else { - - require ::datadog_agent + require datadog_agent if $manage_dogapi_gem { $rubydev_package = $datadog_agent::params::rubydev_package # check to make sure that you're not installing rubydev somewhere else if ! defined(Package[$rubydev_package]) { - package {$rubydev_package: + package { $rubydev_package: ensure => installed, - before => Package['dogapi'] + before => Package['dogapi'], } } if (! defined(Package['rubygems'])) { package { 'ruby': ensure => 'installed', - name => $datadog_agent::params::ruby_package + name => $datadog_agent::params::ruby_package, } package { 'rubygems': ensure => 'installed', name => $datadog_agent::params::rubygems_package, - require => Package['ruby'] + require => Package['ruby'], } } - package{ 'dogapi': + package { 'dogapi': ensure => $dogapi_version, provider => $puppet_gem_provider, } @@ -75,6 +71,5 @@ mode => '0640', require => File['/etc/datadog-agent'], } - } } diff --git a/manifests/security_agent.pp b/manifests/security_agent.pp index eceb1203..c44d20b8 100644 --- a/manifests/security_agent.pp +++ b/manifests/security_agent.pp @@ -1,22 +1,27 @@ -class datadog_agent::security_agent( +# @summary Security-Agent +# +# +# @param enabled +# @param socket +# @param service_enable +# @param service_ensure +# @param service_provider +# +class datadog_agent::security_agent ( Boolean $enabled = false, Optional[String] $socket = undef, - Boolean $service_enable = true, String $service_ensure = 'running', Optional[String] $service_provider = undef, - ) inherits datadog_agent::params { - $securityagent_config = { 'runtime_security_config' => { 'enabled' => $enabled, - 'socket' => $socket, + 'socket' => $socket, }, } if $facts['os']['name'] == 'Windows' { - file { 'C:/ProgramData/Datadog/security-agent.yaml': owner => $datadog_agent::params::dd_user, group => $datadog_agent::params::dd_group, @@ -24,9 +29,7 @@ content => template('datadog_agent/security-agent.yaml.erb'), require => File['C:/ProgramData/Datadog'], } - } else { - if $service_provider { service { $datadog_agent::params::securityagent_service_name: ensure => $service_ensure, @@ -55,5 +58,4 @@ require => File['/etc/datadog-agent'], } } - } diff --git a/manifests/service.pp b/manifests/service.pp index fbd74eef..26e1fbe1 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -1,22 +1,23 @@ -# Class: datadog_agent::service +# @summary Declare the datadog-agent service # -# This class declares the datadog-agent service +# @param service_ensure +# @param service_enable +# @param service_provider +# @param agent_flavor # - -class datadog_agent::service( - $service_ensure = 'running', - Variant[Boolean, Enum['manual', 'mask', 'delayed']] $service_enable = true, - Optional[String] $service_provider = undef, - String $agent_flavor = $datadog_agent::params::package_name, +class datadog_agent::service ( + String $service_ensure = 'running', + Variant[Boolean, Enum['manual', 'mask', 'delayed']] $service_enable = true, + Optional[String] $service_provider = undef, + String $agent_flavor = $datadog_agent::params::package_name, ) inherits datadog_agent::params { - if ($facts['os']['name'] == 'Windows') { - service { $datadog_agent::params::service_name: - ensure => $service_ensure, - enable => $service_enable, - restart => ['powershell', '-Command', 'Restart-Service -Force DatadogAgent'], # Force restarts dependent services - require => Package[$datadog_agent::params::package_name] - } + service { $datadog_agent::params::service_name: + ensure => $service_ensure, + enable => $service_enable, + restart => ['powershell', '-Command', 'Restart-Service -Force DatadogAgent'], # Force restarts dependent services + require => Package[$datadog_agent::params::package_name], + } } else { if $service_provider { service { $datadog_agent::params::service_name: @@ -37,6 +38,4 @@ } } } - - } diff --git a/manifests/suse.pp b/manifests/suse.pp index 554d801a..f047f348 100644 --- a/manifests/suse.pp +++ b/manifests/suse.pp @@ -1,9 +1,14 @@ -# Class: datadog_agent::suse +# @summary Contains the DataDog agent installation mechanism for SUSE distributions # -# This class contains the DataDog agent installation mechanism for SUSE distributions # - -class datadog_agent::suse( +# @param agent_major_version +# @param agent_version +# @param release +# @param agent_repo_uri +# @param agent_flavor +# @param rpm_repo_gpgcheck +# +class datadog_agent::suse ( Integer $agent_major_version = $datadog_agent::params::default_agent_major_version, String $agent_version = $datadog_agent::params::agent_version, String $release = $datadog_agent::params::apt_default_release, @@ -11,7 +16,6 @@ String $agent_flavor = $datadog_agent::params::package_name, Optional[Boolean] $rpm_repo_gpgcheck = undef, ) inherits datadog_agent::params { - $current_key = 'https://keys.datadoghq.com/DATADOG_RPM_KEY_CURRENT.public' $all_keys = [ $current_key, @@ -31,10 +35,10 @@ } case $agent_major_version { - 5 : { fail('Agent v5 package not available in SUSE') } - 6 : { $gpgkeys = $all_keys } - 7 : { $gpgkeys = $all_keys } - default: { fail('invalid agent_major_version') } + 5 : { fail('Agent v5 package not available in SUSE') } + 6 : { $gpgkeys = $all_keys } + 7 : { $gpgkeys = $all_keys } + default: { fail('invalid agent_major_version') } } if ($agent_repo_uri != undef) { @@ -91,5 +95,4 @@ package { $agent_flavor: ensure => $agent_version, } - } diff --git a/manifests/system_probe.pp b/manifests/system_probe.pp index df0443a5..455ecae0 100644 --- a/manifests/system_probe.pp +++ b/manifests/system_probe.pp @@ -1,25 +1,32 @@ -# Class: datadog_agent::system_probe +# @summary Contains the Datadog agent system probe (NPM) configuration # -# This class contains the Datadog agent system probe (NPM) configuration. # On Windows, install the NPM driver by setting 'windows_npm_install' # to 'true on the datadog_agent class. # - -class datadog_agent::system_probe( - Boolean $enabled = false, - Boolean $network_enabled = false, - Boolean $service_monitoring_enabled = false, - Optional[String] $log_file = undef, - Optional[String] $sysprobe_socket = undef, - Optional[Boolean] $enable_oom_kill = false, - Optional[Hash] $runtime_security_config = undef, - - Boolean $service_enable = true, - String $service_ensure = 'running', - Optional[String] $service_provider = undef, +# +# @param enabled +# @param network_enabled +# @param service_monitoring_enabled +# @param log_file +# @param sysprobe_socket +# @param enable_oom_kill +# @param runtime_security_config +# @param service_enable +# @param service_ensure +# @param service_provider +# +class datadog_agent::system_probe ( + Boolean $enabled = false, + Boolean $network_enabled = false, + Boolean $service_monitoring_enabled = false, + Optional[String] $log_file = undef, + Optional[String] $sysprobe_socket = undef, + Boolean $enable_oom_kill = false, + Optional[Hash] $runtime_security_config = undef, + Boolean $service_enable = true, + String $service_ensure = 'running', + Optional[String] $service_provider = undef, ) inherits datadog_agent::params { - - $sysprobe_config = { 'system_probe_config' => { 'enabled' => $enabled, @@ -45,9 +52,7 @@ require => File['C:/ProgramData/Datadog'], notify => Service[$datadog_agent::params::service_name], } - } else { - if $service_provider { service { $datadog_agent::params::sysprobe_service_name: ensure => $service_ensure, @@ -76,5 +81,4 @@ require => File['/etc/datadog-agent'], } } - } diff --git a/manifests/tag5.pp b/manifests/tag5.pp index 9134b421..0b81d465 100644 --- a/manifests/tag5.pp +++ b/manifests/tag5.pp @@ -1,18 +1,22 @@ -# Allow custom tags via a define -define datadog_agent::tag5( - $tag_name = $name, - $lookup_fact = false, -){ - - if $lookup_fact{ +# @summary Allow custom tags via a define +# +# +# @param tag_name +# @param lookup_fact +# +define datadog_agent::tag5 ( + String $tag_name = $name, + Boolean $lookup_fact = false, +) { + if $lookup_fact { $value = getvar($tag_name) - if is_array($value){ + if is_array($value) { $tags = prefix($value, "${tag_name}:") - datadog_agent::tag5{$tags: } + datadog_agent::tag5 { $tags: } } else { if $value { - concat::fragment{ "datadog tag ${tag_name}:${value}": + concat::fragment { "datadog tag ${tag_name}:${value}": target => '/etc/dd-agent/datadog.conf', content => "${tag_name}:${value}, ", order => '03', @@ -20,11 +24,10 @@ } } } else { - concat::fragment{ "datadog tag ${tag_name}": + concat::fragment { "datadog tag ${tag_name}": target => '/etc/dd-agent/datadog.conf', content => "${tag_name}, ", order => '03', } } - } diff --git a/manifests/ubuntu.pp b/manifests/ubuntu.pp index 806cbef8..d78ee2f5 100644 --- a/manifests/ubuntu.pp +++ b/manifests/ubuntu.pp @@ -1,25 +1,32 @@ -# Class: datadog_agent::ubuntu +# @summary Contains the DataDog agent installation mechanism for Debian derivatives # -# This class contains the DataDog agent installation mechanism for Debian derivatives # - -class datadog_agent::ubuntu( - Integer $agent_major_version = $datadog_agent::params::default_agent_major_version, - String $agent_version = $datadog_agent::params::agent_version, - Optional[String] $agent_repo_uri = undef, - String $release = $datadog_agent::params::apt_default_release, - Boolean $skip_apt_key_trusting = false, - String $agent_flavor = $datadog_agent::params::package_name, - Optional[String] $apt_trusted_d_keyring = '/etc/apt/trusted.gpg.d/datadog-archive-keyring.gpg', - Optional[String] $apt_usr_share_keyring = '/usr/share/keyrings/datadog-archive-keyring.gpg', - Optional[Hash[String, String]] $apt_default_keys = { +# @param agent_major_version +# @param agent_version +# @param agent_repo_uri +# @param release +# @param skip_apt_key_trusting +# @param agent_flavor +# @param apt_trusted_d_keyring +# @param apt_usr_share_keyring +# @param apt_default_keys +# +class datadog_agent::ubuntu ( + Integer $agent_major_version = $datadog_agent::params::default_agent_major_version, + String $agent_version = $datadog_agent::params::agent_version, + Optional[String] $agent_repo_uri = undef, + String $release = $datadog_agent::params::apt_default_release, + Boolean $skip_apt_key_trusting = false, + String $agent_flavor = $datadog_agent::params::package_name, + String $apt_trusted_d_keyring = '/etc/apt/trusted.gpg.d/datadog-archive-keyring.gpg', + String $apt_usr_share_keyring = '/usr/share/keyrings/datadog-archive-keyring.gpg', + Hash[String, String] $apt_default_keys = { 'DATADOG_APT_KEY_CURRENT.public' => 'https://keys.datadoghq.com/DATADOG_APT_KEY_CURRENT.public', '5F1E256061D813B125E156E8E6266D4AC0962C7D' => 'https://keys.datadoghq.com/DATADOG_APT_KEY_C0962C7D.public', 'D75CEA17048B9ACBF186794B32637D44F14F620E' => 'https://keys.datadoghq.com/DATADOG_APT_KEY_F14F620E.public', 'A2923DFF56EDA6E76E55E492D3A80E30382E94DE' => 'https://keys.datadoghq.com/DATADOG_APT_KEY_382E94DE.public', }, ) inherits datadog_agent::params { - if $agent_version =~ /^[0-9]+\.[0-9]+\.[0-9]+((?:~|-)[^0-9\s-]+[^-\s]*)?$/ { $platform_agent_version = "1:${agent_version}-1" } @@ -52,6 +59,7 @@ source => $key_url, } + # lint:ignore:trailing_comma exec { "ensure key ${key_fingerprint} is imported in APT keyring": command => "/bin/cat /tmp/${key_fingerprint} | gpg --import --batch --no-default-keyring --keyring ${apt_usr_share_keyring}", # the second part extracts the fingerprint of the key from output like "fpr::::A2923DFF56EDA6E76E55E492D3A80E30382E94DE:" @@ -60,10 +68,11 @@ $(cat /tmp/${key_fingerprint} | gpg --with-colons --with-fingerprint 2>/dev/null | grep 'fpr:' | sed 's|^fpr||' | tr -d ':') | CMD } + # lint:endignore } if ($facts['os']['name'] == 'Ubuntu' and versioncmp($facts['os']['release']['full'], '16') == -1) or - ($facts['os']['name'] == 'Debian' and versioncmp($facts['os']['release']['full'], '9') == -1) { + ($facts['os']['name'] == 'Debian' and versioncmp($facts['os']['release']['full'], '9') == -1) { file { $apt_trusted_d_keyring: mode => '0644', source => "file://${apt_usr_share_keyring}", @@ -103,13 +112,11 @@ package { $agent_flavor: ensure => $platform_agent_version, - require => [Apt::Source['datadog'], - Class['apt::update']], + require => [Apt::Source['datadog'], Class['apt::update']], } package { 'datadog-signing-keys': ensure => 'latest', - require => [Apt::Source['datadog'], - Class['apt::update']], + require => [Apt::Source['datadog'], Class['apt::update']], } } diff --git a/manifests/windows.pp b/manifests/windows.pp index 15e014af..89e84e63 100644 --- a/manifests/windows.pp +++ b/manifests/windows.pp @@ -1,9 +1,21 @@ -# Class: datadog_agent::windows +# @summary Contains the DataDog agent installation mechanism for Windows # -# This class contains the DataDog agent installation mechanism for Windows # - -class datadog_agent::windows( +# @param agent_major_version +# @param agent_version +# @param agent_repo_uri +# @param msi_location +# @param api_key +# @param hostname +# @param tags +# @param tags_join +# @param tags_quote_wrap +# @param ensure +# @param npm_install +# @param ddagentuser_name +# @param ddagentuser_password +# +class datadog_agent::windows ( Integer $agent_major_version = $datadog_agent::params::default_agent_major_version, String $agent_version = $datadog_agent::params::agent_version, Optional[String] $agent_repo_uri = undef, @@ -18,7 +30,6 @@ Optional[String] $ddagentuser_name = undef, Optional[String] $ddagentuser_password = undef, ) inherits datadog_agent::params { - $msi_full_path = "${msi_location}/datadog-agent-${agent_major_version}-${agent_version}.amd64.msi" if ($agent_repo_uri != undef) { @@ -44,6 +55,8 @@ provider => 'windows', } + # lint:ignore:140chars + # lint:ignore:strict_indent exec { 'assert-acceptable-msi':, command => 'Exit 1', unless => @(ACCEPTABLE), @@ -61,6 +74,8 @@ require => File['installer'], notify => Package[$datadog_agent::params::package_name], } + # lint:endignore + # lint:endignore if $agent_version == 'latest' { $ensure_version = 'installed' @@ -71,16 +86,23 @@ $hostname_option = $hostname ? { '' => {}, default => { 'HOSTNAME' => $hostname } } $npm_install_option = $npm_install ? { false => {}, true => { 'ADDLOCAL' => 'MainApplication,NPM' } } - $ddagentuser_name_option = $ddagentuser_name ? { undef => {}, default => { 'DDAGENTUSER_NAME' => $ddagentuser_name}} - $ddagentuser_password_option = ($ddagentuser_name != undef and $ddagentuser_password != undef) ? { true => {'DDAGENTUSER_PASSWORD' => $ddagentuser_password}, false => {}} + $ddagentuser_name_option = $ddagentuser_name ? { undef => {}, default => { 'DDAGENTUSER_NAME' => $ddagentuser_name } } + $ddagentuser_password_option = ($ddagentuser_name != undef and $ddagentuser_password != undef) ? { + true => { 'DDAGENTUSER_PASSWORD' => $ddagentuser_password }, + false => {} + } + # lint:ignore:140chars package { $datadog_agent::params::package_name: ensure => $ensure_version, provider => 'windows', source => $msi_full_path, - install_options => ['/norestart', {'APIKEY' => $api_key, 'TAGS' => $tags_quote_wrap} + $npm_install_option + $hostname_option + $ddagentuser_name_option + $ddagentuser_password_option] + install_options => [ + '/norestart', + { 'APIKEY' => $api_key, 'TAGS' => $tags_quote_wrap } + $npm_install_option + $hostname_option + $ddagentuser_name_option + $ddagentuser_password_option, + ], } - + # lint:endignore } else { exec { 'datadog_6_14_fix': command => "((New-Object System.Net.WebClient).DownloadFile('https://s3.amazonaws.com/ddagent-windows-stable/scripts/fix_6_14.ps1', \$env:temp + '\\fix_6_14.ps1')); &\$env:temp\\fix_6_14.ps1", @@ -93,6 +115,5 @@ uninstall_options => ['/quiet'], subscribe => Exec['datadog_6_14_fix'], } - } }