@@ -171,11 +171,78 @@ install:
171171 if [ $(echo {{.NEW_RELIC_REGION}} | grep -i staging | wc -l) -gt 0 ]; then
172172 echo 'staging: true' >> /etc/newrelic-infra.yml
173173 fi
174- echo 'enable_process_metrics: true ' >> /etc/newrelic-infra.yml
175- echo 'status_server_enabled: true ' >> /etc/newrelic-infra.yml
176- echo 'status_server_port: 18003 ' >> /etc/newrelic-infra.yml
174+ echo 'enable_process_metrics: {{.NRIA_ENABLE_PROCESS_METRICS}} ' >> /etc/newrelic-infra.yml
175+ echo 'status_server_enabled: {{.NRIA_STATUS_SERVER_ENABLED}} ' >> /etc/newrelic-infra.yml
176+ echo 'status_server_port: {{.NRIA_STATUS_SERVER_PORT}} ' >> /etc/newrelic-infra.yml
177177 echo 'license_key: {{.NEW_RELIC_LICENSE_KEY}}' >> /etc/newrelic-infra.yml
178178 echo '{{.NRIA_CUSTOM_ATTRIBUTES}}' >> /etc/newrelic-infra.yml
179+ echo '{{.NRIA_PASSTHROUGH_ENVIRONMENT}}' >> /etc/newrelic-infra.yml
180+ - |
181+ # Logging configuration
182+ if [ ! -z "{{.NRIA_LOG_LEVEL}}" ]; then
183+ sed -i '/^log:/d' /etc/newrelic-infra.yml
184+ echo 'log:' >> /etc/newrelic-infra.yml
185+ echo ' level: {{.NRIA_LOG_LEVEL}}' >> /etc/newrelic-infra.yml
186+ if [ ! -z "{{.NRIA_LOG_FILE}}" ]; then
187+ echo ' file: {{.NRIA_LOG_FILE}}' >> /etc/newrelic-infra.yml
188+ fi
189+ if [ ! -z "{{.NRIA_LOG_FORMAT}}" ]; then
190+ echo ' format: {{.NRIA_LOG_FORMAT}}' >> /etc/newrelic-infra.yml
191+ fi
192+ fi
193+ - |
194+ # Hostname configuration
195+ if [ ! -z "{{.NRIA_DISPLAY_NAME}}" ]; then
196+ echo 'display_name: {{.NRIA_DISPLAY_NAME}}' >> /etc/newrelic-infra.yml
197+ fi
198+ if [ ! -z "{{.NRIA_OVERRIDE_HOSTNAME}}" ]; then
199+ echo 'override_hostname: {{.NRIA_OVERRIDE_HOSTNAME}}' >> /etc/newrelic-infra.yml
200+ fi
201+ if [ ! -z "{{.NRIA_OVERRIDE_HOSTNAME_SHORT}}" ]; then
202+ echo 'override_hostname_short: {{.NRIA_OVERRIDE_HOSTNAME_SHORT}}' >> /etc/newrelic-infra.yml
203+ fi
204+ - |
205+ # Installation paths
206+ if [ ! -z "{{.NRIA_AGENT_DIR}}" ]; then
207+ echo 'agent_dir: {{.NRIA_AGENT_DIR}}' >> /etc/newrelic-infra.yml
208+ fi
209+ if [ ! -z "{{.NRIA_PLUGIN_DIR}}" ]; then
210+ echo 'plugin_dir: {{.NRIA_PLUGIN_DIR}}' >> /etc/newrelic-infra.yml
211+ fi
212+ - |
213+ # Metrics sample rates
214+ if [ ! -z "{{.NRIA_METRICS_PROCESS_SAMPLE_RATE}}" ]; then
215+ echo 'metrics_process_sample_rate: {{.NRIA_METRICS_PROCESS_SAMPLE_RATE}}' >> /etc/newrelic-infra.yml
216+ fi
217+ if [ ! -z "{{.NRIA_METRICS_NETWORK_SAMPLE_RATE}}" ]; then
218+ echo 'metrics_network_sample_rate: {{.NRIA_METRICS_NETWORK_SAMPLE_RATE}}' >> /etc/newrelic-infra.yml
219+ fi
220+ if [ ! -z "{{.NRIA_METRICS_STORAGE_SAMPLE_RATE}}" ]; then
221+ echo 'metrics_storage_sample_rate: {{.NRIA_METRICS_STORAGE_SAMPLE_RATE}}' >> /etc/newrelic-infra.yml
222+ fi
223+ if [ ! -z "{{.NRIA_METRICS_SYSTEM_SAMPLE_RATE}}" ]; then
224+ echo 'metrics_system_sample_rate: {{.NRIA_METRICS_SYSTEM_SAMPLE_RATE}}' >> /etc/newrelic-infra.yml
225+ fi
226+ if [ ! -z "{{.NRIA_METRICS_NFS_SAMPLE_RATE}}" ]; then
227+ echo 'metrics_nfs_sample_rate: {{.NRIA_METRICS_NFS_SAMPLE_RATE}}' >> /etc/newrelic-infra.yml
228+ fi
229+ - |
230+ # Proxy configuration (NRIA_PROXY takes precedence over HTTPS_PROXY)
231+ if [ ! -z "{{.NRIA_PROXY}}" ]; then
232+ sed -i "/^proxy/d" /etc/newrelic-infra.yml
233+ echo 'proxy: {{.NRIA_PROXY}}' >> /etc/newrelic-infra.yml
234+ fi
235+ if [ ! -z "{{.NRIA_IGNORE_SYSTEM_PROXY}}" ]; then
236+ echo 'ignore_system_proxy: {{.NRIA_IGNORE_SYSTEM_PROXY}}' >> /etc/newrelic-infra.yml
237+ fi
238+ - |
239+ # Cloud and process configuration
240+ if [ ! -z "{{.NRIA_DISABLE_CLOUD_METADATA}}" ]; then
241+ echo 'disable_cloud_metadata: {{.NRIA_DISABLE_CLOUD_METADATA}}' >> /etc/newrelic-infra.yml
242+ fi
243+ if [ ! -z "{{.NRIA_DISABLE_ZERO_MEM_PROCESS_FILTER}}" ]; then
244+ echo 'disable_zero_mem_process_filter: {{.NRIA_DISABLE_ZERO_MEM_PROCESS_FILTER}}' >> /etc/newrelic-infra.yml
245+ fi
179246
180247
181248 setup_proxy :
0 commit comments