Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion attributes/dotnet_agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
default['appdynamics']['dotnet_agent']['checksum'] = '7acb3756147a1d5a13c49b107a890ea56a8eb4099fd793e498e34b6f0b5962dc' #nil
default['appdynamics']['dotnet_agent']['install_dir'] = 'C:\Program Files\Appdynamics'
default['appdynamics']['dotnet_agent']['logfiles_dir'] = 'C:\DotNetAgent\Logs'

default['appdynamics']['dotnet_agent']['Restart_Windows_Service']='AppDynamics.Agent.Coordinator_service'# can be used for restarting any non-instrumented service
default['appdynamics']['dotnet_agent']['template']['cookbook'] = 'appdynamics'
default['appdynamics']['dotnet_agent']['template']['source'] = 'dotnet/setup.config.erb'
default['appdynamics']['dotnet_agent']['standalone_apps'] = {
'w3svc'=>{'executable'=>'b.exe','tier'=>'b Tier','commandline'=>nil,'restart'=>true},
'msdtc'=>{'executable'=>'a.exe','tier'=>'a Tier','commandline'=>'-a -b','restart'=>true}
}
default['appdynamics']['dotnet_agent']['instrument_iis'] = false

21 changes: 20 additions & 1 deletion recipes/dotnet_agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
proxy = node['appdynamics']['http_proxy']
install_directory = agent['install_dir']
system_directory = node['kernel']['os_info']['windows_directory']

agent_msi_path = "#{system_directory}\\Temp"
setup_config = "#{agent_msi_path}\\setup.xml"
install_log_file = "#{agent_msi_path}\\DotnetAgentInstall.log"
Expand Down Expand Up @@ -68,6 +67,8 @@
:controller_accesskey => controller['accesskey'],
:proxy_host => proxy['host'],
:proxy_port => proxy['port'],
:standalone_apps => agent['standalone_apps'],
:instrument_iis => agent['instrument_iis']
)
end

Expand All @@ -78,3 +79,21 @@
installer_type :msi
only_if { File.exists?(agent_msi) }
end

Restart_Windows_Service = agent['Restart_Windows_Service'] + ',' + agent['standalone_apps'].keys.join(',')

# Restart Appdynamics Agent Coordinator & Windows Services that are instrumented.
# There is an additional variable available for adding un-instrumented windows services for restarting. We're using that to restart the Appdynamics Agent coordinator
powershell_script 'Restart Windows Services' do
code <<-EOH
Restart-Service #{Restart_Windows_Service}
EOH
not_if Restart_Windows_Service.nil?
end

powershell_script 'Restart IIS' do
code <<-EOH
IISReset
EOH
only_if {agent['instrument_iis']==true}
end
11 changes: 10 additions & 1 deletion templates/default/dotnet/setup.config.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,17 @@
<machine-agent />
<app-agents>
<IIS>
<automatic enabled="true" />
<automatic enabled="<%= @instrument_iis%>" />
</IIS>
<% unless @standalone_apps.nil? %>
<standalone-applications>
<% @standalone_apps.each { |app_name, app_value| puts %>
<standalone-application executable="<%= app_value[:executable]%>" <% unless app_value[:commandline].nil? %>command-line="<%= app_value[:commandline]%>"<% end %>>
<tier name="<%= app_value[:tier]%>" />
</standalone-application>
<%}%>
</standalone-applications>
<% end %>
</app-agents>
</appdynamics-agent>
</winston>