File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ Facter . add ( :datadog_agent_exp_active ) do
2+ confine kernel : 'Linux'
3+ setcode do
4+ active = false
5+
6+ # Determine via service manager when available
7+ if Facter ::Util ::Resolution . which ( 'systemctl' )
8+ active = system ( 'systemctl is-active --quiet datadog-agent-exp' )
9+ elsif Facter ::Util ::Resolution . which ( 'service' )
10+ active = system ( 'service datadog-agent-exp status >/dev/null 2>&1' )
11+ elsif Facter ::Util ::Resolution . which ( 'pgrep' )
12+ # Fallback: look for the experiment agent binary as the running command (exact path prefix)
13+ active = system ( 'pgrep -f "^/opt/datadog-packages/datadog-agent/experiment/bin/agent/agent( |$)" >/dev/null 2>&1' )
14+ end
15+
16+ active
17+ end
18+ end
Original file line number Diff line number Diff line change 507507 }
508508
509509 # Declare service
510+ if ($facts [' os' ][' name' ] != ' Windows' and $facts [' datadog_agent_exp_active' ] == true ) {
511+ $_service_ensure = ' stopped'
512+ } else {
513+ $_service_ensure = $service_ensure
514+ }
515+
510516 class { ' datadog_agent::service' :
511517 agent_flavor => $agent_flavor ,
512- service_ensure => $service_ensure ,
518+ service_ensure => $_service_ensure ,
513519 service_enable => $service_enable ,
514520 service_provider => $service_provider ,
515521 }
You can’t perform that action at this time.
0 commit comments