Node.JS Application Monitoring

About Node.JS Application Monitoring

Node.JS monitoring allows you to monitor health status and performance of your Node.JS server. You can also set metrics thresholds, so that you get alerted if any of the Node.JS monitor metrics (see Viewing Node.JS Monitor Data further in this document) reaches some critical level preset by you.

Once you add a Node.JS application monitor, Monitis will start connecting to your Node.JS server at regular intervals of time and fetching monitoring data onto Node.JS monitor screen in your Monitis dashboard.

Note: for most types of Application Monitoring (see Application Monitoring), you need to have Smart Agent downloaded, installed and running on your machine to configure the monitoring (see Downloading Smart Agent for Linux and Windows).

Adding Node.JS Application Monitor

Installing Node.JS Plugin

About Node.JS Plugin

As a prerequisite for adding Node.JS monitor in your Monitis account you need first to install our Node.JS plugin on your machine to add a monitoring module into your Node.JS server project.

Note: Node.JS installed on your machine must be v 0.10 or higher.

Since Node.JS platform doesn’t contain any embedded stats module, Monitis has created Node.JS plugin that receives, processes and sends measured parameters of Node.JS server and evaluation of server health status onto Node.JS monitor in your dashboard via the open API by HTTP requests.

Because the plugin is implemented by using event-driven technology and only just collects information, it adds in fact very insignificant additional load to the existing server and practically doesn’t affect server performance – the main processing is done in remote script part.

Installing Node.JS plugin for Windows

To install the plugin you need to have Node.js and NPM tool installed on your machine.

To install the Monitis Node.JS plugin as NPM module, go to your Node.JS project root folder and run the following command on your Windows machine:

npm install node-monitor

Node.Js CMD

Installing Node.JS plugin for Linux

To install the Monitis Node.JS plugin as NPM module, go to your Node.JS project root folder and run the following command on your Linux machine:

npm install node-monitor

Node.JS linux

 

Registering Node.JS Plugin With The Server

After you have installed the Monitis Node.JS plugin, add the following 2 lines in your Node.JS server source code to register the Node.JS plugin with the server:

var monitor = require(‘monitor’);// insert monitor module-plugin, put this line in the early beginning of the source code
monitor.Monitor(server); //add server to monitor, put this command after initialization of Node.JS server in the source code

As soon as you register the Monitis Node.JS plugin within your Node.JS server the plugin will start operating as an embedded Node.JS module and will be collecting measurement data from your Node.JS application running on your Node.JS server and sending them by HTTP request onto your Node.JS monitor in your Monitis dashboard.

For more information about Monitis Node.JS plugin you can refer to https://www.npmjs.org/package/node-monitor .

Adding Node.JS Monitor in Dashboard

Adding Node.JS Monitor for Windows

Go to the Monitors menu and select Application Monitors->Node.JS.

Add Node.js Monitor

The Add Application Monitor – Step 1 window will open.

Add Node.js Monitor Step 1 Windows

If you have already downloaded and installed Smart Agent for Windows, select it from the Agent list.

Make sure that your Smart Agent for Windows is running, as shown under Agent Status. If the Agent is stopped, run it from the Smart Agent Controller window (see Downloading, Installing and Running Smart Agent for Windows).

Agent_Key.png

If you haven’t downloaded Smart Agent for Windows yet, click on the Download Agent button to download it. Follow the instructions under Downloading, Installing and Running Smart Agent for Windows.

Note that it may take up to 5 min for newly installed Agent to appear in the agent list (you can click Refresh to refresh the agent list).

Select the Windows Agent from the list, and click Next.

Add Node.js Monitor Step 2 Windows

Select from the Monitor Group combo box the monitor group for this monitor to be assigned to.

You can also create a new monitor group by clicking on the “+” icon next to Add a new Group.

You can see there on the screen the two steps required for the installation of the Node.JS plugin.

If you haven’t yet installed the Monitis Node.JS plugin, follow the instructions under Installing Node.JS Plugin above to install the plugin and register it within your Node.JS server.

Under Host Name enter the host name for your Node.JS server.

Click Test to test establishing connection to your Node.JS server. Wait a little, as the test takes about 1 min to complete.

Test Node.JS Monitor

If successfully connected, you will see success message on the screen:

Node.js Monitor Test Success

If there was a failure establishing connection, you will see an error message on the screen:

Node.js Monitor Test Error

To add more Application monitors of different types to the same Smart Agent, click the green “+” button under Add More Monitors (see Adding Multiple Server-Device and Application Monitors for the Same Agent).

Add Node.Js Monitor Step 2.1 Windows

Click Add when finished.

The Alert Configuration window will appear.

http://www.monitis.com/support/wp-content/uploads/2016/09/word-image-19.png

  • Click Send to All Contacts if you want to send alerts for this monitor to all contacts.
  • Click Custom Configuration (Advanced) to configure sending alerts for this monitor only to selected contacts.The Alert Rules window will open. Click on the Add Alert Rule button to configure alert rule(s) for your monitor.

http://www.monitis.com/support/wp-content/uploads/2016/09/word-image-20.png

Set up the alert rule and click Add Rule. See Alert Rules in Alerts 2.0 for more info about alert rules.

Note: To be able to add alert rules, you need to set up thresholds (Critical or Warning) in your monitor first.

A threshold includes two conditions connected by a logical OR. If any of the conditions matches the monitor will enter your specified state.

  • Check fails (response timed out, connection failure, etc)
  • Any or all of your selected metrics meet the failure conditions you specified for them

http://www.monitis.com/support/wp-content/uploads/2016/09/word-image-21.png

http://www.monitis.com/support/wp-content/uploads/2016/09/word-image-22.png

See Thresholds for more info.

  • Click Don’t Send Alerts if you don’t want any alerts for this monitor to be sent.

Your newly created application monitor will appear in your Monitis dashboard. Wait until it loads the first results.

http://www.monitis.com/support/wp-content/uploads/2016/09/word-image-23.png

You can use the Settings menu to change at any time Node.JS monitor setup data: e.g. provide a new hostname and run a connection test.

http://www.monitis.com/support/wp-content/uploads/2016/09/word-image-24.png

Adding Node.JS Monitor for Linux

Go to the Monitors menu and select Application Monitors->Node.JS.

Add Node.js Monitor

The Add Application Monitor – Step 1 window will open.

Add Node.JS Monitor for Linux Step 1

If you have already downloaded and installed Smart Agent for Linux, select it from the Agent list.

Make sure that your Smart Agent for Linux is running, as shown under Agent Status. If the Agent is stopped, run it on your Linux machine (see Downloading, Installing and Running Smart Agent for Linux).

Status Monitoring Smart Agent

If you haven’t downloaded Smart Agent for Linux yet, click on the Download Agent button to download it. Follow the instructions under Downloading, Installing and Running Smart Agent for Linux.

Note that it may take up to 5 min for newly installed Agent to appear in the list (you can click Refresh to refresh the agent list).

Select the Linux Agent from the list, and click Next.

The Add Application Monitor – Step 2 window will open.

Add Node.js Monitor Step 2

Select from the Monitor Group combo box the monitor group for this monitor to be assigned to.

You can also create a new monitor group by clicking on the “+” icon next to Add a new Group.

You can see there on the screen the 2 steps required for the installation of the Node.JS plugin.

If you haven’t yet installed the Node.JS plugin, follow the instructions under Installing Node.JS Plugin

above to install the plugin and register it with your Node.JS server.

Under Host Name enter the host name for your Node.JS server. This field is mandatory to enable access to your Node.JS server.

Click Test to test establishing connection to your Node.JS server. Wait a little, as the test takes about 1 min to complete.

Test Node.JS Monitor

If successfully connected, you will see success message on the screen:

Node.js Monitor Test Success

If there was a failure establishing connection, you will see an error message on the screen:

Node.js Monitor Test Error

To add more Application monitors of different types to the same Smart Agent, click the green “+” button under Add More Monitors (see Adding Multiple Server-Device and Application Monitors for the Same Agent).

Add More Monitors

Click Add when finished.

The Alert Configuration window will appear.

http://www.monitis.com/support/wp-content/uploads/2016/09/word-image-33.png

  • Click Send to All Contacts if you want to send alerts for this monitor to all contacts.
  • Click Custom Configuration (Advanced) to configure sending alerts for this monitor only to selected contacts.The Alert Rules window will open. Click on the Add Alert Rule button to configure alert rule(s) for your monitor.

http://www.monitis.com/support/wp-content/uploads/2016/09/word-image-34.png

Set up the alert rule and click Add Rule. See Alert Rules in Alerts 2.0 for more info about alert rules.

Note: To be able to add alert rules, you need to set up thresholds (Critical or Warning) in your monitor first.

A threshold includes two conditions connected by a logical OR. If any of the conditions matches the monitor will enter your specified state.

  • Check fails (response timed out, connection failure, etc)
  • Any or all of your selected metrics meet the failure conditions you specified for them

C:\Users\monitis_user\AppData\Roaming\Skype\garikarmenia\media_messaging\media_cache_v3\^E8A71BE2B3C062D1933381C993B537E4FE803A95CD1828B009^pimgpsh_fullsize_distr.png

C:\Users\monitis_user\AppData\Roaming\Skype\garikarmenia\media_messaging\media_cache_v3\^3FFF87861A17432C93A4A3382B1567E4259B3F992900EF96DA^pimgpsh_fullsize_distr.png

For definitions of Node.JS monitor’s metrics and statuses see Viewing Node.JS Monitor Data.

See Thresholds for more info.

  • Click Don’t Send Alerts if you don’t want any alerts for this monitor to be sent.

Your newly created application monitor will appear in your dashboard. Wait until it loads the first results.

 Node.JS Metrics

You can use the Settings menu to change at any time Node.Js monitor setup data: e.g. provide a new hostname as well as run a connection test.

 

C:\Users\monitis_user\AppData\Roaming\Skype\garikarmenia\media_messaging\media_cache_v3\^7297F3FF7F1E2E268FD77ECC737B7A31BCF47CE5DA4C4B4604^pimgpsh_fullsize_distr.png

Viewing Node.JS Monitor Data

By default, there are four Node.JS metrics preselected in the chart view: Average Response TimeRequests/secServer Activity and Success Rate. You can toggle off or on any of these and other shown metrics.

 Node.JS Metrics

If you switch to the table view, you can see a number of metrics, including the state of your Node.JS server.

When you switch to the table view for the first time, you will see a pop-up window, where you can select metrics to display.

C:\Users\monitis_user\Desktop\Ashkhen\metrics.JPG

Select the metrics and click OK. The table view will open, showing your selected metrics.

Node.js Monitor Table View

Note: if you roll-over the mouse over a column name, and then click the arrow that will appear next to the column name, the list of the metrics will open where you can select to show/hide any of the metrics.

Note that the columns will be shown/hidden persistently: next time you open the table view they will show as per your last selection. You can then show/hide the columns again as you like.

Node.js Monitor Table View Columns

The following metrics are available in Node.JS monitor:

  • Average Response Time – an evaluation of server average response time which has been spent on preparing response during monitoring interval.
  • Requests/sec – Number of requests per second during monitoring interval (named also “input load”).
  • Server Activity – Server processing (busy) time divided over monitoring interval, e.g. during 300 sec monitoring interval server raised 200 requests each of them running for some time: Server Activity = sum(each_request_processing _time)/300.
  • Success Rate (%) – % of successfully ended requests with 2xx code.
  • Uptime – The period of time that the server has been up and running since the last restart.
  • Average Request Processing Time (ms) – an evaluation of server average time which has been spent on processing of requests during monitoring interval.
  • Max Request Processing Time (ms) – server max time which has been spent on processing request body from network during monitoring interval.
  • Average Network Time (ms) – an evaluation of server average time which has been spent to receive request body from network during monitoring interval.
  • Max Network Time (ms) – server max time which has been spent on receiving request body from network during the monitoring interval.
  • Max Response Time (ms) – Server max time which has been spent on preparing response during monitoring interval.
  • Input Traffic (kb/sec) – input traffic (kb/sec) during monitoring interval.
  • Output Traffic (kb/sec) – output traffic (kb/sec) during monitoring interval.
  • State – The evaluation of monitored Node.Js server health state at monitoring check time.

Note: if you hover the mouse cursor over any column name, a tip with description of the metric will be shown.

http://www.monitis.com/support/wp-content/uploads/2016/09/word-image-40.png

Depending on the results of the last monitoring check, you will see one of the below described states under State in the table view:

  • RUNNING:

This state means that there are requests being processed on your Node.JS server as per the last monitoring check.

To get additional info, either double-click the row or, alternatively, click on a value under Requests/sec or Success Rate (%). The Monitor Details window will open.

Node.js Monitor Details

Under Requests by Method you can see the percentage of each request method (GET, HEAD, POST, etc) out of total requests run on your Node.JS within the last monitoring check interval.

Under Responses by Status Code you can see the percentage of each of the shown HTTP status code groups out of total status code responses.

  • IDLE:

This status means that there is server running on Node.JS platform, but there are no requests being processed on the Node.JS server as per the last monitoring check.

  • UNABLE TO CONNECT:

If Monitis monitoring check was unable to connect to your Node.JS server, you will see the Unable to Connect status under State in the table view. Double-clicking the row will show the error returned by Node.JS server.

Depending on what caused connection attempt to fail, you will see one of the below 2 error messages:

  • If unable to connect to Node.JS server at your specified hostname:

http://www.monitis.com/support/wp-content/uploads/2016/09/word-image-42.png

  • If there is no server running on Node.JS platform:

http://www.monitis.com/support/wp-content/uploads/2016/09/word-image-43.png