diff --git a/manifests/server/linux.pp b/manifests/server/linux.pp index 427d1c0..46a6684 100644 --- a/manifests/server/linux.pp +++ b/manifests/server/linux.pp @@ -52,6 +52,7 @@ $newrelic_nrsysmond_labels = undef, $newrelic_nrsysmond_timeout = undef, $newrelic_nrsysmond_hostname = undef, + $newrelic_nrsysmond_docker = false, ) inherits ::newrelic { if ! $newrelic_license_key { @@ -105,4 +106,13 @@ notify => Service[$newrelic_service_name], } + if ($newrelic_nrsysmond_docker == true) { + # Newrelic must belong to the Docker group to fetch metrics. + exec { 'newrelic-should-be-in-docker-group': + command => "/usr/sbin/usermod -aG docker newrelic", + unless => "/bin/cat /etc/group | grep '^docker:' | grep -qw newrelic", + notify => Service[$newrelic_service_name] + } + } + }