Giter VIP home page Giter VIP logo

dias's Introduction

dias NPM version Build Status Dependency Status License

Detect PaaS details of your application instance

Install

npm install dias

Supported PaaS services

  • AWS
  • AppFog
  • Nodejitsu
  • Travis CI
  • Heroku
  • Strider
  • dotCloud
  • your mac/windows/linux/freebsd box

Based on everypaas, but as of version 0.0.7, everypaas iis only functional for: Heroku, Strider, and dotCloud.

Usage

var dias = require('dias')
console.log(dias())

// additional details via callback

dias(function(data) {
  console.log(data)
})

Details available with use of callback:

  • AWS support
  • serial number
  • useragent as a collection of details in the form of a useragent

AWS example

{
  host: 'us01-dea-f8e454e6d5',
  os: 'Linux',
  serial: 'i-a5001be8',
  useragent: 'Linux/i-a5001be8 AWS/us-east-1 node/0.8.14'
  version: '3.2.0-23-virtual',
  arch: 'x64',
  gid: 114,
  uid: 22212,
  title: '/opt/cloudfoundry/runtimes/nodejs-v0.8.14/bin/node',
  node: '0.8.14',
  cpus: { model: 'Intel Xeon CPU E5-2665', cores: 2 },
  up: 10212921.312263723,
  load: [ 0.5444335935, 0.40966796875, 0.35546875 ], // 1, 5, & 15 minute load averages
  mem: { total: 17909567488, free: 352100352 }
}

AppFog example

{
  host: 'us01-dea-f8e454e6d5',
  os: 'Linux',
  serial: 'SYS-1234567890',
  useragent: 'Linux/SYS-1234567890 PaaS/AppFog node/0.8.14'
  version: '3.2.0-23-virtual',
  arch: 'x64',
  gid: 114,
  uid: 22212,
  title: '/opt/cloudfoundry/runtimes/nodejs-v0.8.14/bin/node',
  node: '0.8.14',
  cpus: { model: 'Intel Xeon CPU E5-2665', cores: 2 },
  paas: 'appfog',
  appfog: {
     id: '28af8427780e30d77d1715e64880445f',
     index: 0,
     center: 'aws'
  },
  up: 10212921.312263723,
  load: [ 0.5444335935, 0.40966796875, 0.35546875 ], // 1, 5, & 15 minute load averages
  mem: { total: 17909567488, free: 352100352 }
}

Nodejitsu example

{
   host: 'da7a889b-06ce-488b-a3b7-516648ac6868.local',
   os: 'SunOS',
   serial: 'SYS-1234567890',
   useragent: 'SunOS/SYS-1234567890 PaaS/Nodejitsu'
   version: '5.11',
   arch: 'x64',
   gid: 65534,
   uid: 103,
   node: '0.10.17',
   cpus:
   {
     model: 'Intel Xeon CPU E5645',
     cores: 24,
     speed: 2400
   },
   paas: 'nodejitsu',
   nodejitsu: 'account-subdomain',
   up: 1350401,
   load: [ 0.03125, 0.00390625, 0 ],
   mem: { total: 268435456, free: 217288704 }
}

Travis CI example

{
   host: 'testing-worker-linux-5-1-11238-linux-10',
   os: 'Linux',
   serial: 'SYS-1234567890',
   useragent: 'Linux/SYS-1234567890 PaaS/Travis node/0.10.17'
   version: '2.6.32-042stab061.2',
   arch: 'x64',
   gid: 1000,
   uid: 1000,
   title: 'node',
   node: '0.8.25',
   cpus: { cores: 32, speed: 2299 },
   paas: 'travis',
   up: 21.76509598,
   load: [ 0.208984375, 0.04736328125, 0.0146484375 ],
   mem: { total: 3221225472, free: 2842660864 }
}

Macbook example

{
  host: 'my-mac.local',
  os: 'Darwin',
  serial: 'W980000A0BM',
  useragent: 'OSX/10.8.5 SN/W980000A0BM node/0.10.33'
  version: '11.4.2',
  arch: 'x64',
  gid: 20,
  uid: 501,
  title: 'node',
  node: '0.10.33',
  cpus: { model: 'Intel Core2 Duo CPU T9800', cores: 2, speed: 2930 },
  up: 94816,
  load: [ 1.03369140625, 1.0888671875, 1.01220703125 ],
  mem: { total: 8589934592, free: 3252342784 }
}

CLI example

var dias  = require('dias')
var argv  = require('minimist')(process.argv.slice(2))

dias({uanode: argv.n}, function(platform) {
  var result = (argv.u) ? platform.useragent : JSON.stringify(platform)
  console.log(result)
})

Optional modules

serial-number module is optional to provided additional information, ex: AWS instance information. It is optional as some PaaS use have read-only file system, access '/usr/local/bin'

License: MIT

Dependencies:

everypaas

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.