What are the steps to install CA Agent to Monitor Node.js Applications?

Document ID : KB000030495
Last Modified Date : 14/02/2018
Show Technical Document Details

Description:

What are the steps to install CA Agent to Monitor Node.js Applications?

 

Solution:

The CA Agent reports the Node.js application metrics to the CA EP Agent. You must have EPAgent 9.7.1 installed prior to installing the CA Agent. The EPAgent 9.7.1 release includes the REST interface. For additional information on EPAgent 9.7.1, contact CA Support or view the REST interface documentation on the CA Communities site.

You can use the CA Agent from a runner script or API integration. The runner script allows use of the agent with zero code modifications. However, using a runner script instead of node may not be feasible in all environments.

 

Contents: 

Install CA Agent using a Global Runner

The simplest method for collecting metrics from a Node application and reporting the data to your EP Agent is to install CA Agent globally and use ca-agent-run to run your application. Global installation makes the CA Agent runner available as a global command. You can get started with any code modifications.

Follow these steps:

  1. Use the following command to install CA Agent:

    $ npm install --global ca-agent
  2. Run your Node application as follows:

    $ cd my-appmy-app$ ca-agent-run .

    By default, ca-agent-run configures CA Agent to report metrics to localhost:8080. 

  3. To change the host and port, set the EPAGENT environm ent variable. 

    $ EPAGENT=http://stats-server.mydomain:8000 ca-agent-run my-app

Install CA Agent using a Local Runner

You can install the CA Agent as an application dependency. This avoids any modification of the system and keeps all dependencies local to the application:

Follow these steps:

  1. Use the following command to install CA Agent:

    $ cd to/your/app/rootmy-app$ npm install --save ca-agent
  2. Run your application with the Node as follows:

    my-app$ ./node_modules/.bin/ca-agent-run .

Install CA Agent using API Integration

You can install the CA Agent using API integration to keep all dependencies local to the application and avoid any global modifications.

Follow these steps:

  1. install the agent and add it as a dependency of your application.

    $ npm install --save ca-agent
  2. Require the agent as early as possible in your application, specifying the host and port that you have configured your EP Agent to accept metrics on.

    require('ca-agent')({    host: '54.191.244.236',  // your EP Agent host    port: 8080,              // your EP Agent REST API port    appName: 'my-app',       // name to report metrics under});// [your code]

CA Agent Components 

The CA Agent installs the following modules

Component
Version
Description
ca-agent1.0The CA APM Agent for monitoring Node applications. Installs strong-agent as a dependency.
strong-agent1.1Strongloop application performance monitoring agent.
debug2.1Tiny node.js debugging utility modeled after Node core's debugging technique.
semver2.2.1Semantic version parser used by npm.
strong-license1.0Simple license generator that uses JSON web tokens (JWT)