npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

loopback-component-ping

v2.0.2

Published

Retrieve the internal state of the LoopBack API Node process.

Downloads

189

Readme

loopback-component-ping

Greenkeeper badge

CircleCI Coverage Status Dependencies semantic-release

Component for LoopBack that adds a model for retrieving the internal state of the Node process.

It is a wrapper around the express-ping package.

Installation

Install the module

$ npm install --save loopback-component-ping

Configure the module in server/component-config.json

The configuration object accepts the following parameters:

  • acls (array) (optional) allows you to specify LoopBack ACL definitions that will be applied to the Ping model. (Default: no ACL)
  • modelName (string) (optional) allows to specify the name of the API endpoint that's used. (Default: 'Ping'),
  • parts (object) (optional) allows you to filter out parts of the output by setting the value to false. (Default: show all parts)
{
  "loopback-component-ping": {
    "parts": {
      "application": true,
      "environment": true,
      "resources": true,
      "system": true,
      "timestamp": true,
      "uptime": true
    },
    "modelName": "Ping",
    "acls": [{
      "accessType": "*",
      "principalType": "ROLE",
      "principalId": "$unauthenticated",
      "permission": "ALLOW"
    }]
  }
}

Usage

After installation you should be able to retrieve data about the Node process through the new endpoint on your API:

http://0.0.0.0:3000/api/Ping

{
  "application": {
    "name": "test-server",
    "version": "1.0.0",
    "pid": 25663,
    "title": "node",
    "argv": [
      "/usr/local/bin/node",
      "/Users/beeman/workspace/fullcube/loopback-component-ping/test/test-server/server/server.js"
    ],
    "versions": {
      "http_parser": "2.7.0",
      "node": "6.9.0",
      "v8": "5.1.281.84",
      "uv": "1.9.1",
      "zlib": "1.2.8",
      "ares": "1.10.1-DEV",
      "icu": "57.1",
      "modules": "48",
      "openssl": "1.0.2j"
    },
    "node_env": "development"
  },
  "environment": {
    "- CUT -": "ALL ENV VARS WILL BE SHOWN",
    "NODE": "/usr/local/bin/node",
    "NODE_ENV": "development"
  },
  "resources": {
    "memory": {
      "rss": 127225856,
      "heapTotal": 100749312,
      "heapUsed": 77737976
    },
    "loadavg": [
      2.23828125,
      1.830078125,
      1.59423828125
    ],
    "cpu": [
      {
        "model": "Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz",
        "speed": 2800,
        "times": {
          "user": 2503330,
          "nice": 0,
          "sys": 2401620,
          "idle": 23095740,
          "irq": 0
        }
      },
      {
        "- CUT -": "ALL CORES WILL BE SHOWN"
      }
    ],
    "disk": [
      {
        "filesystem": "/dev/disk1",
        "size": 487358464,
        "used": 350916048,
        "available": 136186416,
        "capacity": 0.73,
        "mount": "/"
      },
      {
        "- CUT -": "ALL DISKS WILL BE SHOWN"
      }
    ],
    "nics": {
      "lo0": [
        {
          "address": "::1",
          "netmask": "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
          "family": "IPv6",
          "mac": "00:00:00:00:00:00",
          "scopeid": 0,
          "internal": true
        },
        {
          "address": "127.0.0.1",
          "netmask": "255.0.0.0",
          "family": "IPv4",
          "mac": "00:00:00:00:00:00",
          "internal": true
        },
        {
          "address": "fe80::1",
          "netmask": "ffff:ffff:ffff:ffff::",
          "family": "IPv6",
          "mac": "00:00:00:00:00:00",
          "scopeid": 1,
          "internal": true
        }
      ],
      "- CUT -": "ALL NICS WILL BE SHOWN"
    }
  },
  "system": {
    "arch": "x64",
    "platform": "darwin",
    "type": "Darwin",
    "release": "15.6.0",
    "hostname": "dev.local",
    "uptime": 27998,
    "cores": 8,
    "memory": 17179869184
  },
  "timestamp": 1477214879328,
  "uptime": 22.002
}