README
pm2plugin
This plugin will pull data from PM2 and publish to New Relic as a plugin
Fork of https://github.com/kenahrens/newrelic-pm2-plugin. Allows plugin to be required as a node module and the poller triggered programatically.
Installation instructions
- Install the dependency
npm install pm2pluginoryarn add pm2plugin - In your app's startup script, after you start your app in PM2, require the plugin and pass your New Relic license key to start the listener.
if (process.env.NEW_RELIC_LICENSE_KEY) {
require('pm2plugin')(process.env.NEW_RELIC_LICENSE_KEY, true);
}
Parameters
pm2plugin(license, debug, hostname, guid, version, url)
| Param | Type | Default | Description |
|---|---|---|---|
| license | String |
Required | New Relic License Key |
| [debug] | Boolean |
false |
Output debug info to the console? |
| [hostname] | String |
os.hostname() |
Component name to be shown in NR |
| [guid] | String |
com.newrelic.pm2plugin |
NR plugin Guid |
| [version] | String |
version from package.json |
The version of the plugin |
| [url] | String |
https://platform-api.newrelic.com/platform/v1/metrics |
The new relic url to post to |

History
- 2.2.0 - Add hostname parameter
- 2.0.0 - Convert for use as node module
- 1.1.0 - Metrics for each PM2 process and added restarts per interval
- 1.0.4 - Close the connection to PM2 on each poll cycle
- 1.0.3 - Fix for when errors are not properly handled from Plugin API
- 1.0.2 - Support for multiple PM2 Servers (run on each PM2 instance)
- 1.0.1 - Support for single PM2 Server only, separate config file
- 1.0.0 - Initial prototype