|
1 | 1 | agent = node['appdynamics']['dotnet_agent'] |
2 | 2 | controller = node['appdynamics']['controller'] |
3 | | -proxy = node['appdynamics']['http_proxy'] |
4 | | -bitness = node['kernel']['os_info']['os_architecture'] |
| 3 | +proxy = node['appdynamics']['http_proxy'] |
5 | 4 | install_directory = agent['install_dir'] |
6 | 5 | system_directory = node['kernel']['os_info']['windows_directory'] |
7 | 6 |
|
8 | | -agent_msi = "" |
9 | | -################################################################################################################################## |
10 | | -# The below paths can also be used instead of temp direcotry. But there will be msiexec exceptions if there is space in the path # |
11 | | -# agent_msi_path = "#{Chef::Config[:file_cache_path]" # |
12 | | -# setup_config = "#{Chef::Config[:file_cache_path]}\\setup.xml" # |
13 | | -# install_log_file = "#{Chef::Config[:file_cache_path]}\\DotnetAgentInstall.log" # |
14 | | -################################################################################################################################## |
15 | 7 | agent_msi_path = "#{system_directory}\\Temp" |
16 | 8 | setup_config = "#{agent_msi_path}\\setup.xml" |
17 | 9 | install_log_file = "#{agent_msi_path}\\DotnetAgentInstall.log" |
18 | 10 |
|
19 | | - |
20 | 11 | # Check the bitness of the OS to determine the installer to download and run |
21 | | -case bitness |
| 12 | +case node['kernel']['os_info']['os_architecture'] |
22 | 13 | when /64/ |
23 | 14 | agent_msi = "#{agent_msi_path}\\dotNetAgentSetup64.msi" |
24 | 15 | source_path = "#{agent['source']}/dotNetAgentSetup64.msi" |
25 | 16 | when /32/ |
26 | 17 | agent_msi = "#{agent_msi_path}\\dotNetAgentSetup.msi" |
27 | 18 | source_path = "#{agent['source']}/dotNetAgentSetup.msi" |
28 | 19 | else |
29 | | - agent_msi = "Unsupported OS bitness" |
| 20 | + raise "Unsupported OS architecture" |
30 | 21 | end |
31 | 22 |
|
32 | 23 | # Download the msi file from source |
|
35 | 26 | checksum agent['checksum'] |
36 | 27 | end |
37 | 28 |
|
38 | | -#Environment Validation |
39 | | -##################################################################################################### |
40 | | -# Environment Validation using Powershell # |
41 | | -##################################################################################################### |
42 | | -# # Comment if you're installing 4.1 |
43 | | -# #Check whether the MSDTC service is up and running |
44 | | -# #if it is not running, start the service |
45 | | -# powershell_script 'check_MSDTC' do |
46 | | - # code 'Start-Service MSDTC' |
47 | | - # only_if {'(Get-Service MSDTC).status' != "Running" } |
48 | | -# end |
49 | | - |
50 | | -# # Comment if you're installing 4.1 -- Matt Jensen to confirm with Sanjay |
51 | | -# #Check whether the WMI service is up and running |
52 | | -# #if it is not running, start the service |
53 | | -# powershell_script 'check_WMI' do |
54 | | - # code 'Start-Service Winmgmt' |
55 | | - # only_if {'(Get-Service Winmgmt).status' != "Running" } |
56 | | -# end |
| 29 | +# Environment Validation |
57 | 30 |
|
58 | | -# # Comment if you're installing 4.1 |
59 | | -# # Check whether the COM+ service is up and running |
60 | | -# # if it is not running, start the service |
61 | | -# powershell_script 'check_complus' do |
62 | | - # code 'Start-Service COMSysApp' |
63 | | - # only_if {'(Get-Service COMSysApp).status' != "Running" } |
64 | | -# end |
65 | | -##################################################################################################### |
66 | | - |
67 | | -# Comment if you're installing 4.1 |
68 | | -# Check whether the MSDTC service is up and running |
69 | | -# if it is not running, start the service |
| 31 | +# MSDTC Service |
70 | 32 | service "MSDTC" do |
71 | 33 | action [ :enable, :start ] |
72 | 34 | end |
73 | 35 |
|
74 | | -# Comment if you're installing 4.1 -- Matt Jensen to confirm with Sanjay |
75 | | -# Check whether the WMI service is up and running |
76 | | -# if it is not running, start the service |
| 36 | +# WMI Service |
77 | 37 | service "Winmgmt" do |
78 | 38 | action [ :enable, :start ] |
79 | 39 | end |
80 | 40 |
|
81 | | -# Comment if you're installing 4.1 |
82 | | -# Check whether the COM+ service is up and running |
83 | | -# if it is not running, start the service |
84 | | -service "COMSysApp" do |
85 | | - action [ :enable, :start ] |
| 41 | +if agent['version'] < '4.1' |
| 42 | + # COM+ Service is not required in 4.1+ |
| 43 | + service "COMSysApp" do |
| 44 | + action [ :enable, :start ] |
| 45 | + end |
86 | 46 | end |
87 | 47 |
|
88 | | - |
89 | 48 | # Check whether IIS 7.0+ is installed |
90 | 49 | # Enable IIS Health Monitoring for the Machine snapshots to return IIS App Pool data |
91 | 50 | # There is no equivalent available in chef to get the IIS version - so completely using powershell scripts |
|
98 | 57 | template "#{setup_config}" do |
99 | 58 | cookbook agent['template']['cookbook'] |
100 | 59 | source agent['template']['source'] |
101 | | - |
| 60 | + |
102 | 61 | variables( |
103 | | - :app_name => node['appdynamics']['app_name'], |
104 | | - :log_file_directory => agent['logfiles_dir'], |
105 | | - :controller_host => controller['host'], |
106 | | - :controller_port => controller['port'], |
107 | | - :controller_ssl => controller['ssl'], |
108 | | - :controller_user => controller['user'], |
109 | | - :controller_accesskey => controller['accesskey'], |
110 | | - :proxy_host => proxy['host'], |
111 | | - :proxy_port => proxy['port'], |
| 62 | + :app_name => node['appdynamics']['app_name'], |
| 63 | + :log_file_directory => agent['logfiles_dir'], |
| 64 | + :controller_host => controller['host'], |
| 65 | + :controller_port => controller['port'], |
| 66 | + :controller_ssl => controller['ssl'], |
| 67 | + :controller_user => controller['user'], |
| 68 | + :controller_accesskey => controller['accesskey'], |
| 69 | + :proxy_host => proxy['host'], |
| 70 | + :proxy_port => proxy['port'], |
112 | 71 | ) |
113 | 72 | end |
114 | 73 |
|
115 | | -# Installing the agent |
| 74 | +# Installing the agent |
116 | 75 | windows_package 'Install AppD .NET Agent' do |
117 | 76 | source agent_msi |
118 | 77 | options "/lv #{install_log_file} AD_SetupFile=#{setup_config} INSTALLDIR=\"#{install_directory}\"" |
119 | 78 | installer_type :msi |
120 | | - only_if { File.exists?(agent_msi) } |
| 79 | + only_if { File.exists?(agent_msi) } |
121 | 80 | end |
122 | | - |
123 | | - |
124 | | -## Installing the agent -- No Dependency on windows cookbook |
125 | | -## The below code block can also be used for installing the agent |
126 | | -# execute "install #{agent_msi}" do |
127 | | -# command "msiexec /i #{agent_msi} /q /norestart /lv #{install_log_file} AD_SetupFile=#{setup_config} INSTALLDIR=\"#{install_directory}\"" |
128 | | -# only_if { File.exists?(agent_msi) } |
129 | | -# end |
0 commit comments