Installing the Agent

Learn how to install the NGINX Amplify Agent.

To use NGINX Amplify to monitor your infrastructure, you need to install NGINX Amplify Agent on each system that has to be checked.

Note:
The agent will drop root privileges on startup. It will then use the user ID of the user nginx to set its effective user ID. The package install procedure will add the nginx user automatically unless it’s already found in the system. If the user directive appears in the NGINX configuration, the agent will pick up the user specified in the NGINX config for its effective user ID (e.g. www-data).

Using the Install Script

Take the following steps to install the Agent:

  1. Download and run the install script.

    # curl -sS -L -O \
    https://github.com/nginxinc/nginx-amplify-agent/raw/master/packages/install.sh && \
    API_KEY='YOUR_API_KEY' sh ./install.sh
    

    Where YOUR_API_KEY is a unique API key assigned to your Amplify account. You will see the API key when adding a new system in the Amplify web interface. You can also find it in the Account menu.

  2. Verify that the agent has started.

    # ps ax | grep -i 'amplify\-'
    2552 ?        S      0:00 amplify-agent
    

Installing the Agent Manually

Installing on Ubuntu or Debian

  1. Add the NGINX public key.

    # curl -fs http://nginx.org/keys/nginx_signing.key | apt-key add -
    

    or

    # wget -q -O - \
    http://nginx.org/keys/nginx_signing.key | apt-key add -
    
  2. Configure the repository as follows.

    # codename=`lsb_release -cs` && \
    os=`lsb_release -is | tr '[:upper:]' '[:lower:]'` && \
    echo "deb http://packages.amplify.nginx.com/${os}/ ${codename} amplify-agent" > \
    /etc/apt/sources.list.d/nginx-amplify.list
    
  3. Verify the repository config file (Ubuntu 14.04 example follows).

    # cat /etc/apt/sources.list.d/nginx-amplify.list
    deb http://packages.amplify.nginx.com/ubuntu/ trusty amplify-agent
    
  4. Update the package index files.

    # apt-get update
    
  5. Install and run the agent.

    # apt-get install nginx-amplify-agent
    

Installing on CentOS, Red Hat Linux, or Amazon Linux

  1. Add the NGINX public key.

    # curl -sS -L -O http://nginx.org/keys/nginx_signing.key && \
    rpm --import nginx_signing.key
    

    or

    # wget -q -O nginx_signing.key http://nginx.org/keys/nginx_signing.key && \
    rpm --import nginx_signing.key
    
  2. Create the repository config as follows (mind the correct release number).

    Use the first snippet below for CentOS and Red Hat Linux. The second one applies to Amazon Linux.

    # release="7" && \
    printf "[nginx-amplify]\nname=nginx amplify repo\nbaseurl=http://packages.amplify.nginx.com/centos/${release}/\$basearch\ngpgcheck=1\nenabled=1\n" > \
    /etc/yum.repos.d/nginx-amplify.repo
    
    # release="latest" && \
    printf "[nginx-amplify]\nname=nginx amplify repo\nbaseurl=http://packages.amplify.nginx.com/amzn/${release}/\$basearch\ngpgcheck=1\nenabled=1\n" > \
    /etc/yum.repos.d/nginx-amplify.repo
    
  3. Verify the repository config file (RHEL 7.1 example follows).

    # cat /etc/yum.repos.d/nginx-amplify.repo
    [nginx-amplify]
    name=nginx repo
    baseurl=http://packages.amplify.nginx.com/centos/7/$basearch
    gpgcheck=1
    enabled=1
    
  4. Update the package metadata.

    # yum makecache
    
  5. Install and run the agent.

    # yum install nginx-amplify-agent
    

Creating the Config File from a Template

# api_key="YOUR_API_KEY" && \
sed "s/api_key.*$/api_key = ${api_key}/" \
/etc/amplify-agent/agent.conf.default > \
/etc/amplify-agent/agent.conf

API_KEY is a unique API key assigned to your Amplify account. You will see your API key when adding a new system using the Amplify web interface. You can also find the API key in the Account menu.

Starting and Stopping the Agent

# service amplify-agent start
# service amplify-agent stop
# service amplify-agent restart

Verifying that the Agent Has Started

# ps ax | grep -i 'amplify\-'
2552 ?        S      0:00 amplify-agent