Enable the Application Metrics for Node.js™ Dashboard for the Node-RED Bluemix Starter Application in one of 3 simple ways. This lets you easily monitor the performance characteristics of your Node-RED flows in real time on Bluemix.

Node-RED is a programming tool for wiring together hardware devices, APIs and online services in new and interesting ways. Built on Node.js™, it provides a browser-based editor that makes it easy to wire together flows using a wide range of nodes. Flows can be deployed to the runtime in a single-click.
Application Metrics for Node.js™ provides instant and powerful insights into the live performance of your Node.js™ applications.

The Node-RED Bluemix Starter Application

The Node-RED Bluemix Starter Application is an example Node-RED application that can be deployed into Bluemix with only a couple of clicks. It’s available on Github here. You can optionally clone it and add your own code for deployment, or if you’d rather dive straight in, click this button:

Deploy to Bluemix

This will take you to the Deploy to Bluemix page, where (once you’ve logged in) it will create a Dev-Ops toolchain. This includes a private Git repository to host your code, an integrated IDE to develop your code, and a delivery pipeline to build and deploy your code. You can tailor this to your own specifications, or just hit the Deploy button to get going. Once you’ve deployed, you can click on Delivery Pipeline to watch your app being deployed.

Way 1 – Change the useAppmetrics variable in bluemix-settings.js to true

Click the Eclipse Orion Web IDEtile to launch the Editor, and edit bluemix-settings.js so that the useAppmetrics flag is set to true. Next, select the Git view and commit and push your change. Use the Back Arrow to return to the toolchain and optionally click on Delivery Pipeline to watch your app being deployed.

Way 2 – Tick the Application Metrics for Node.js™ Dashboard checkbox in the Node-RED First Steps wizard

When your app has been successfully deployed, click the View app button to be taken to the Node-RED first steps wizard. This page in the wizard allows you to tick a checkbox to enable the Application Metrics for Node.js™ Dashboard when your Node-RED application starts. It also details the URL the dashboard will be available on for your future use. The wizard will further confirm your selection on the Summary page.

Way 3 – Add the NODE_RED_USE_APPMETRICS environment variable to your application

Adding the NODE_RED_USE_APPMETRICS environment variable will take precedence over the previous ways above, so this can also be used to turn the he Application Metrics for Node.js™ Dashboard off. The environment variable can be added via Bluemix console or via command line. It can be set to either true or false.

If you’re using the Bluemix console, access the Environment variables for your application by clicking on the application in the Bluemix dashboard. Then select Runtime in the left-hand context menu before selecting the Environment variables tab in the middle of the page. Scroll down to the User defined section and press the Add button to create a new row in the table. Fill in NODE_RED_USE_APPMETRICS in the NAME box, and true or false in the VALUE box, then click the Save button. Restart your application to pick up the Environment variable change.

If you’re using the command line interface, where [APPLICATION_NAME] is the name of your application, issue the command cf set-env [APPLICATION_NAME] NODE_RED_USE_APPMETRICS true to enable the Application Metrics for Node.js™ Dashboard, or cf set-env [APPLICATION_NAME] NODE_RED_USE_APPMETRICS false to disable it. Restage your application to pick up the Environment variable change.

Whichever way you pick, the Application Metrics for Node.js™ Dashboard will now be running on the Node-RED web server on Bluemix at [YOUR_APPLICATION_URL]/appmetrics-dash. There’s a link to the dashboard from the application’s homepage in the ‘Enabling Application Metrics for Node.js monitoring’ section.

Join The Discussion

Your email address will not be published. Required fields are marked *