Using N|Solid with AppDynamics to Monitor Node.js Applications
Making sure your teams are moving quickly is a primary concern when you’re instrumenting performance monitoring with any language, on any platform.
This is especially true with Node.js - it can be nearly impossible to get the raw performance Node.js offers while simultaneously monitoring for application performance. At NodeSource, we’ve accomplished this with N|Solid.
That said, centralizing data is key to operational success - if you’re working in a polyglot environment or have tooling already in place, you need to get insight into everything and adhere to your existing tooling.
Because of this, we’ve recently teamed up with AppDynamics to integrate the rich metrics of N|Solid as a first-class citizen into the AppDynamics Dashboard. Today, I’m going to show you how to get N|Solid metrics flowing into AppDynamics with minimal effort.
Connecting N|Solid and AppDynamics
Initial Setup with AppDynamics
To get started, open up the AppDynamics Console and head over to the Applications tab in the main navigation.
Create a new application in the dashboard, and select the "Create Application using the Getting Started Wizard" option. Within the Getting Started Wizard, select that you want to create a new Node.js application.
Set the Application and create a new Tier in your Application for the application as you’d like to. You’ll need to install the module from npm in the Node.js application that you’ll be deploying on N|Solid and monitoring in the AppDynamics Dashboard. To do so, navigate to the application’s directory and install the module.
If you’re running npm@5 or above, you can install and save with:
npm install email@example.com
If you’re running on a version prior to npm@5, you can install and save the module as a dependency in your package.json with:
npm install firstname.lastname@example.org --save
There may be a newer version of the AppDynamics module available - check the module on npm to see what the newest possible version is. N|Solid will always work with the supported versions of the AppDynamics module, so you’ll never need to worry about compatibility.
You will then need to grab the app agent snippet provided by AppDynamics with the application’s details provided in Step 4 of the Getting Started Wizard and put it on the first line of your application’s main file. This snippet will look something like this, with details filled in where appropriate:
controllerHostName: '<controller host name>',
controllerPort: <controller port number>,
accountName: '<AppDynamics account name>',
accountAccessKey: '<AppDynamics account key>',
A general guide to the object you’ll be passing to the
require() statement above:
- If your application is using SSL, make sure you set
accountNamefield is required when a controller is running in multi-tenant mode
accountAccessKeyfield is required for all AppDynamics controllers on version 4.1 or above
applicationNamefield is the app name you defined in Step 3 of the Getting Started Wizard
tierNamefield is the tier name you defined in Step 3 of the Getting Started Wizard
nodeNameis the name of the Node (not Node.js) - for example, the machine’s hostname. You can learn a bit more about this terminology in the Tiers and Nodes page in the AppDynamics documentation.
If you have any questions about this step, be sure to check out the AppDynamics guide on installing the Node.js Agent.
Running your Application with N|Solid
In your development environment, make sure you have N|Solid installed. Once N|Solid is installed locally, you’ll want to run the following commands:
source /usr/local/nsolid/nsolid-env # Uses the nsolid runtime
node myapp.js # Where "myapp.js" is the main file of your application that has the AppDynamics code you added earlier.
And that’s it for N|Solid setup! Your application should now be running on the N|Solid runtime, polling real time metrics and security information.
If you’re interested in using other platforms (like Docker) to develop and deploy your application, be sure to check out the N|Solid Documentation, and simply swap out the process described here for your desired development process.
Viewing N|Solid Metrics in AppDynamics
Once your application is running, check back in on the AppDynamics Getting Started Wizard. Wait for the application to connect to AppDynamics - it’ll show that it’s trying to connect and let you know once it’s connected.
Once your application is connected to AppDynamics, navigate to the metric browser by clicking on Applications, then selecting the application you created in the Getting Started Wizard, then clicking on Metric Browser. From there, expand Application Infrastructure Performance, select the Tier you created in the Getting Started Wizard, then select N|Solid.
From there, you should see all your application’s metrics as reported by N|Solid. All of these metrics are available for you to incorporate into your AppDynamics Dashboards and reports.
One Last Thing…
If you’re interested in application performance within Node.js, be sure to check out part one of our three part series on Node.js Performance Monitoring. It shares insight into the parts of your Node.js applications you need to be monitoring to start squeezing out the best possible performance from your applications.
If you’d like to to stay in the loop with the tools, tutorials, tips, and more around Node.js performance, be sure to check out @NodeSource on Twitter and keep an eye on the NodeSource Blog to keep up to date.