Configuring the stand-alone Node.js data collector for on-premises applications

If you installed the Node.js application in on-premise environment, you must configure the Node.js data collector to collect information about the Node.js application.

Before you begin

  1. Make sure that your Node.js application can run successfully locally. The stand-alone Node.js data collector can monitor Node.js V8.0.0 and future fix packs, V10.0.0 and future fix packs, and V12.0.0 and future fix packs.
  2. Download the data collector package from IBM® Passport Advantage® website. For detailed instructions, see Download instructions.
  3. Configure the data collector package with the make_configuration_packages.sh and configure_agent_images.sh scripts on the system where the Cloud APM server is installed. For detailed instructions, see Configuring the downloaded images.

Procedure

  1. Extract files from the data collector package. The nodejs_datacollector_8.1.4.0.6.tgz package is included in the extracted directory.
  2. Determine the home directory of your application.
    • For typical Node.js applications, if you use the node app.js command to start your Node.js application and the app.js main file is in the /root/nodejs_app directory, /root/nodejs_app is the home directory of your application.
    • For collective members in the IBM API Connect environment, run the wlpn-server list command to display the list of all your collective member on the same machine. The home directory of your collective member is in the following format:
      user_directory/collective-member_name/package
      For example, if you get /root/wlpn/rock-8345a96-148538-1/package as a command output, /root/wlpn is the user directory and rock-8345a96-148538-1 is the collective member name.
    • For Developer Portal applications in the IBM API Connect environment, you can run the ps -ef | grep node command to find the home directory. If you get the following command output, for example, the home directory is /home/admin/bgsync and the main file of your application is rest_server.js:
      admin 19085 1 0 Jun25 ?  00:06:53 /usr/local/bin/node /home/admin/bgsync/rest_server.js
  3. From the home directory of your application, run the following command to extract files from the data collector package:
    tar -zxf nodejs_datacollector_8.1.4.0.6.tgz
  4. Extract the ibmapm.tgz file in the nodejs_dc folder by running the following command:
    tar -zxf nodejs_dc/ibmapm.tgz
    You will get an ibmapm folder.
  5. Run the following command to install the data collector to your application:
    npm install ./ibmapm
  6. Add the following line to the beginning of the main file of your Node.js application:
    require('ibmapm');
    • If you start your application by running the node app.js command, app.js is the main file of your application.
    • For collective members in the IBM API Connect environment, the main file is defined in the package.json file in the home directory or its sub-folders. By default, the main file is home_directory/server/server.js, where home_directory is the home directory to your collective member.
    • For Developer Portal applications in the IBM API Connect environment, you can run the ps -ef | grep node command to find the main file. If you get the following command output, for example, the main file of your application is rest_server.js.
      admin 19085 1 0 Jun25 ?  00:06:53 /usr/local/bin/node /home/admin/bgsync/rest_server.js
  7. Restart your application.
    Tip:
    • To restart your collective member, run the wlpn-server stop collective_member_name command. The collective member automatically restarts after you run this command. If it does not start, run the wlpn-server start collective_member_name command to restart it manually.
    • To restart your Developer Portal applications, first run the /etc/init.d/restservice stop command to stop the application, and then run the /etc/init.d/restservice start command to start it.

Results

The data collector is configured and is connected to the Cloud APM server.

What to do next

Remember: To add your application to the Cloud APM console, choose Node.js Runtime in the application editor.