status

System automation on steroids

npm install status
2 downloads in the last day
15 downloads in the last week
40 downloads in the last month

status

Information

Packagestatus
Description System automation on steroids
Node Version >= 0.6

Introduction

Shh... It's okay - everything is going to be alright. status is here to make all of your nightmares go away.

status provides a flexible JSON interface on top of any commands/tasks/sensors/signals/hardware/etc you want to automate. status operations can be run locally (via the CLI) or remotely (via the REST server).

Usage

Command Line

# Specify a plugin and the output you want back
# In this example I specify the 'uptime' plugin with the 'total' operation
$ status uptime total
{"total":{"hours":7,"minutes":40,"seconds":6}}

# You can pass arguments to operations too!
# Arguments can be any javascript objects separated by commas
$ status processes grep["skype"]
{"grep":[{"id":"1234", "name":"skype"}]}

# Chaining operations will run them asynchronously
$ status cpu temp:usage:speed
{"temp":107.6, "usage":10, "speed":2100}

# Combine them all and have fun!
$ status cpu temp["celsius"]:usage["total","mhz"]:speed["ghz"]
{"temp":42, "usage":100, "speed":2.1}

REST API

# Specify a plugin and the output you want back
# In this example I specify the 'uptime' plugin with the 'total' operation
POST /status/uptime "total"
{"total":{"hours":7,"minutes":40,"seconds":6}}

# You can pass arguments to operations too!
# Arguments can be any javascript objects separated by commas
POST /status/uptime "grep['skype']"
{"grep":[{"id":"1234", "name":"skype"}]}

# Chaining operations will run them asynchronously
POST /status/cpu "temp:usage:speed"
{"temp":107.6, "usage":10, "speed":2100}

# Combine them all and have fun!
POST /status/cpu "temp['celsius']:usage['total','mhz']:speed['ghz']"
{"temp":42, "usage":100, "speed":2.1}

Writing Plugins

Let's write a plugin called "coolkern" that returns the kernel version

{exec} = require "child_process"

coolkern =
  meta:
    name: "coolkern"
    author: "YOU"
    version: "0.0.1"

  version: (done) ->
    exec "uname -r", (err, stdout, stderr) ->
      done stdout

Simple enough, right? Now add it to status

status = require 'status'
status.load coolkern

Finished! Now you can test it out

$ status kernel version
{"version":"3.3.7-1-ARCH"}

LICENSE

(MIT License)

Copyright (c) 2012 Fractal contact@wearefractal.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

npm loves you