IBM Performance Management

Configuring the Node.js agent

You must add one or more plug-ins to your Node.js application and restart it before the agent can begin monitoring your application.

About this task

Node.js is a software platform that employs JavaScript for server-side solutions, these solutions are often used for receiving and responding to HTTP requests. The Node.js agent can be used to measure and collect data about the performance of Node.js applications. For example, throughput and response times for HTTP requests, and other measurements that relate to resource usage, are monitored and stored for display and analysis. The Node.js agent is a single instance agent. It registers subnodes for each monitored Node.js application.
Subnode name structure: NJ:hostname_port:NJA
Important: The Node.js agent does not support cluster application monitoring. It can only monitor a Node.js application that listens on at least one port. If a Node.js application listens on multiple port numbers, then the lowest port number is used for monitoring.
You must add one or more plug-ins to your Node.js application and restart it before the agent can begin monitoring your application. These plug-ins, which are known as data collector plug-ins, collect data that is forwarded to the Node.js agent. Currently, there are three data collector plug-ins:
  • The resource data collector plug-in collects resource monitoring data from your Node.js applications.
  • The deep-dive data collector plug-in collects diagnostic data from your Node.js applications.
  • The method trace data collector plug-in collects method traces from your Node.js applications.
No actual agent configuration is required. The agent starts automatically after installation.

Procedure

  1. Make sure that the user ID that is used to run the application server has full permission to the install_dir directory.
  2. Add one of the following lines to your Node.js application file to add data collector plug-ins. Do not use a double quotation mark " to replace the single quotation mark ' in the commands or code phrases that you use to add a data collector plug-in.
    • To add resource data collector plug-in, add the following line to the beginning of the Node.js application file:
      require('install_dir/lx8266/nj/bin/plugin/knj_index.js');
      where install_dir is the installation directory of Node.js agent. If the agent is installed in the default directory /opt/ibm/apm/agent, the line is:
      require('/opt/ibm/apm/agent/lx8266/nj/bin/plugin/knj_index.js');
    • To add resource data collector plug-in and deep-dive data collector plug-in, add the following line to the beginning of the Node.js application file.
      require('install_dir/lx8266/nj/bin/plugin/knj_deepdive.js');
    • To add resource data collector plug-in, deep-dive data collector plug-in, and method trace data collector plug-in, add the following line to the beginning of the Node.js application file.
      require('install_dir/lx8266/nj/bin/plugin/knj_methodtrace.js');
  3. Verify that the Node.js agent is running. This step is only needed the first time that the agent is started as it creates a plug-in folder when it first starts. Normally the agent starts automatically 1 or 2 minutes after installation.
  4. Restart your Node.js application to enable the monitoring plug-ins.

What to do next