Setting the metrics URL
To set up metrics monitoring, specify a metrics URL, which can specify either a third-party console (StatsD, Graphite, or Splunk) or a log file. You can specify the metrics URL:
- With the STRONGLOOP_METRICS environment variable.
- When you install StrongLoop Process Manager as a service (for production use).
- With the
slc ctl env-setcommand.
Setting the metrics URL with an environment variable
You can set the environment variable on the system running StrongLoop PM:
<url> is one of the metrics URLs described below.
Then deploy the application to the system running StrongLoop PM.
Setting the metrics URL during Process Manager service installation
To set the metrics URL when you install StrongLoop Process Manager as a service, use the command:
If installing with Docker, use:
Setting the metrics URL at runtime
Once the application is already running or deployed, use the
slc ctl env-set command to set the environment variable on the system running StrongLoop PM. StrongLoop PM will automatically restart the application with the new setting; for example, if the service name is my-app:
Running the app
Once you have set the metrics URL, run the application under control of StrongLoop Process Manager.
For example, to run a local application called my-app:
To run a remote application (typical in production):
- Build the application with
slc build; see Building applications with slc.
- Install StrongLoop Process Manager as a service on the production system; see Setting up a production host.
If you have not already set the STRONGLOOP_METRICS environment variable, you can set it as described above in Setting the metrics URL during Process Manager service installation
- Deploy the application to the production host with
slc deploy; see Deploying apps to Process Manager.
StatsD is a simple protocol for log information along with a simple daemon (server) that aggregates and summarizes application metrics. The client communicates with the StatsD server using the StatsD protocol, and the daemon then generates aggregate metrics and relays them to a graphing or monitoring backend. For more information on StatsD, see StatsD, what it is and how it can help you.
The StatsD Node server:
- Includes a built-in Graphite backend that can be local or hosted.
- Supports other backends such Zabbix, DataDog, and so on.
- Supports custom backends.
Other metrics consumers, such as DataDog, have agents that support the StatsD-protocol.
To use StatsD, set the STRONGLOOP_METRICS environment variable to a StatsD receiver URL of the form:Where:
- host is the name of the host where the StatsD server is running; default is "localhost".
- port is the TCP port the StatsD server is using; default is 8125.
- scope is a string to scope or identify metrics; for example this might be the name of the application or module.
You can set the environment variable before you deploy your application to Process Manager.
To set it after you deploy the application, use the
slc ctl env-set command, which will automatically restart the application with that environment variable. For example:
To use Graphite, set a metrics URL of the form:Where:
- host is the name of the host where the Graphite server is running; default is "localhost".
- port is the TCP port the Graphite server is using; default is 2003.
This specifies to forward metrics data to hosted Graphite.
To use Splunk, set a metrics URL of the form:Where:
- host is the name of the host where the Splunk server is running; default is "localhost".
- port is the TCP port the Splunk server is using; you must provide a value since the protocol has no assigned port.
This specifies to write to Splunk using a UDP key-value protocol.
To send metrics information to a log file, set a metrics URL of the form:If you omit the file name, by default metrics information is send to the console (stdout).
To write metrics information using syslog, set a metrics URL of the form:Where:
- appName is any string; default is "statsd".
- priority is any of the following values:
- LOG_INFO (the default)