status
v0.0.13
Published
System automation on steroids
Downloads
4,544
Readme
Information
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 os uptime
{"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/os "uptime"
{"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/processes "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}
Included Plugins
[email protected] - CPU information
* temp
* usage
* speed
[email protected] - Spotify controls/information
* next
* previous
* toggle
* pause
* play
* stop
* open
* playing
[email protected] - Process information
* all
* mine
* grep
* top
[email protected] - Network information
* upstream
* downstream
[email protected] - Wireless network information
* ssid
* bssid
* signal
* frequency
* rate
* security
* mode
[email protected] - Hard Disk information
* temp
* usage
* total
* free
* used
[email protected] - Daemon management through rc.d
* list
* started
* stopped
* auto
* noAuto
* start
* stop
* restart
* status
[email protected] - RAM information
* usage
* total
* free
* used
[email protected] - System information
* load
* uptime
* arch
* platform
* type
* hostname
* kernel
* environment
* drives
* cpus
* network
[email protected] - Node information
* version
* environment
* prefix
[email protected] - text to speech using festival
* speak
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: ->
exec "uname -r", (err, stdout) =>
@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 [email protected]
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.