JSPM

  • Created
  • Published
  • Downloads 373
  • Score
    100M100P100Q91362F
  • License Copyright (c) Sematext Group, Inc.

Node.js monitoring agent for SPM by Sematext

Package Exports

  • spm-agent-nodejs

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (spm-agent-nodejs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

spm-agent-nodejs

bitHound Score build status

npm-stats

This is the Node.js monitoring agent for SPM performance monitoring from Sematext.

The following information is collected and transmitted to SPM (Cloud or On-Premises version):

  • OS Metrics (CPU / Mem)
  • Process Memory
  • EventLoop stats
  • Garbage Collector stats
  • Web server stats (requests, error rate, response times etc.) Working for all web servers frameworks that use Node.js http/https module including
    • "connect" based frameworks
    • Express.js,
    • Sails.js
    • Hapi.js
    • Restify
    • and others ...

The module is able to run in cluster mode (master/worker).

Status

Supported Node-Versions: Node >= 0.10, 0.12, 4.x, 5.x

Please check our blog for more information or contact us at npmjs@sematext.com.

Installation


    npm install spm-agent-nodejs

Get a free account and create a Node.js API token at sematext.com/spm

Configuration

We use https://www.npmjs.com/package/rc for configuration. This means config parameters can be passed via several config locations commandline args or ENV variables. We recommend to use a file in current directory in INI or JSON format called ".spmagentrc". This file can be generated by providing setting and environment variable and calling a helper script:

    export SPM_TOKEN=YOUR-SPM-TOKEN
    node ./node_modules/spm-agent-nodejs/bin/spmconfig.js

The command above generates following default configuration file:

    # Directory for buffered metrics
    dbDir = ./spmdb

    # Application Token for SPM
    [tokens]
      spm = YOUR-SPM-TOKEN

    [logger]
      # log file directory default is ./spmlogs
      dir = ./spmlogs
      # silent = true means no creation of log files
      silent = false
      # log level for output - debug, info, error, defaults to error to be quiet
      level = error

The only required setting is the SPM Application Token, this could be set via config file ".spmagentrc" or environment variable:

export spmagent_tokens__spm=YOUR-SPM-APP-TOKEN

Please note the use of double "_" for nested properties

Usage

Node Version 0.10 and 0.12

Add this line at the begin of your source code / main script / app.js

    var spmAgent = require ('spm-agent-nodejs')

Node Version > 4.x

There is an alternative using latest 4.x and 5.x releases. It supports a command line option "-r" to preload node modules before the actual application is started. In this case the original source code needs no modification:

  node -r './spm-agent-nodejs' yourApp.js

Results

Troubleshooting

Please visit our WIKI for more information

Other SPM related packages

Please check out spm-metrics-js to monitor any custom metric in your application.

sematext-agent-docker, aka Sematext Agent for Docker

LICENCE

Apache 2 - see LICENSE file.