Home > Wagento Way > New Relic Agent Installation for Magento on AWS

New Relic Agent Installation for Magento on AWS

Share:

Grow Your eCommerce

Tell us a little about yourself and we’ll guide you through.


New Relic Agent

Installing a New Relic agent on a server using an advanced continuous deployment tool like Elastic Beanstalk can be a confusing problem to approach. Installation methods found in New Relic documentation and other online resources didn’t work well for this author. New Relic supports so many different technology stacks that you become lost in installation documentation that is not applicable to you. Hopefully, this article can serve as a brief overview of installing New Relic on a LAMP stack appropriate for Magento while using AWS Elastic Beanstalk.

At first, the author mistakenly thought there was only one New Relic agent to install and was encountering multiple ways to install it. Eventually, the realization came that there are two agents: a PHP agent and an infrastructure agent. Both should be installed to get the most out of New Relic. Here are the two configuration files needed to get those agents installed via Elastic Beanstalk.

.ebextensions/new_relic_php.config

<CODE>
packages:
  yum:
    newrelic-php5: []
  rpm:
    newrelic: http://yum.newrelic.com/pub/newrelic/el5/x86_64/newrelic-repo-5-3.noarch.rpm
commands:
  configure_new_relic:
    command: newrelic-install install
    env:
      NR_INSTALL_SILENT: true
      NR_INSTALL_KEY: <new_relic_key>
files:
  "/etc/php.d/newrelic_custom.ini":
    mode: "000644"
    owner: root
    group: root
    content: |
      [newrelic]
      newrelic.appname = "`{ "Ref" : "AWSEBEnvironmentName" }`"
      newrelic.distributed_tracing_enabled = true
      newrelic.span_events_enabled = true
</CODE>

.ebextensions/new_relic_infrastructure.config

</CODE>
files:
  "/etc/newrelic-infra.yml" :
    mode: "000644"
    owner: root
    group: root
    content: |
      license_key: <new_relic_key>
      enable_process_metrics: true
  "/etc/newrelic-infra/logging.d/discovered.yml" :
    mode: "000644"
    owner: root
    group: root
    content: |
      logs:
        - name: configured-logs-0
          file: /var/log/httpd/*access_log
        - name: configured-logs-1
          file: /var/log/httpd/*error_log
  "/etc/newrelic-infra/logging.d/magento.yml" :
    mode: "000644"
    owner: root
    group: root
    content: |
      logs:
        - name: magento-logs
          file: /var/app/current/var/log/*.log


commands:
# Create the agent’s yum repository
  "01-agent-repository":
    command: sudo curl -o /etc/yum.repos.d/newrelic-infra.repo https://download.newrelic.com/infrastructure_agent/linux/yum/amazonlinux/2/x86_64/newrelic-infra.repo
#
# Update your yum cache
  "02-update-yum-cache":
    command: yum -q makecache -y --disablerepo='*' --enablerepo='newrelic-infra'
#
# Run the installation script
  "03-run-installation-script":
    command: sudo yum install newrelic-infra -y
</CODE>

This is the author’s first attempt to install New Relic in an environment with PHP using Elastic Beanstalk for deployment. This is a basic configuration, not an advanced one. The essential metrics are ingested by New Relic; transactions and logs, specifically. Hopefully, this article provides clarity on the overall method of installation for New Relic agents and provides an extensible foundation for further tweaks to configuration. Happy tweaking!

Table of Contents

Grow Your eCommerce

Tell us a little about yourself and we’ll guide you through.

About the Author

Joe Shelton is currently the Head of Development at Wagento Commerce. He worked as a Web Developer at Creative Arc from 2008 to 2015. An Iowa State University alumnus, he holds a degree in Computer Science. 

Related Topics

Drive Efficiency, Cut Costs: Hyvä for Magento 2 Outdoor Retail Success

The world of outdoor retail across the globe is evolving and quite rapidly at that. Today, customers want, nay expect, a seamless shopping experience. And this is true no matter if they are browsing online, visiting a physical store, or engaging with the brand on social media. Suffice it to say that an omnichannel approach […]

Hyvä Theme for Magento: A Modern Tech Stack You’ll Love Working With 

In the ever-evolving world of eCommerce, Magento has remained a go-to platform for retailers who seek robust, scalable solutions. However, the complexity of Magento’s traditional frontend can be daunting. Enter Hyvä, a theme that not only simplifies Magento’s frontend but revolutionizes it with a modern tech stack that developers love working with. This comprehensive guide […]

Boost Performance, Minimize Downtime: 8 Best Practices to Master Magento 2 Upgrades

In the fiercely competitive world of eCommerce, a sturdy platform is akin to an oxygen mask. It is what makes all the difference between scaling the peak of success and plummeting into frustrated customers and abandoned carts. As a matter of fact, according to a studies, a well-optimized platform can supercharge your conversion rates by […]

Talk to a Wagento
Expert Today

Talk to a Wagento
Expert Today