UNPKG

4.63 kBMarkdownView Raw
1![status](https://secure.travis-ci.org/wearefractal/status.png?branch=master)
2
3## Information
4
5<table>
6<tr>
7<td>Package</td><td>status</td>
8</tr>
9<tr>
10<td>Description</td>
11<td>System automation on steroids</td>
12</tr>
13<tr>
14<td>Node Version</td>
15<td>>= 0.6</td>
16</tr>
17</table>
18
19## Introduction
20
21Shh... It's okay - everything is going to be alright. status is here to make all of your nightmares go away.
22
23status 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).
24
25## Usage
26
27### Command Line
28
29```javascript
30// Specify a plugin and the output you want back
31// In this example I specify the 'uptime' plugin with the 'total' operation
32$ status os uptime
33{"total":{"hours":7,"minutes":40,"seconds":6}}
34
35// You can pass arguments to operations too!
36// Arguments can be any javascript objects separated by commas
37$ status processes grep["skype"]
38{"grep":[{"id":1234, "name":"skype"}]}
39
40// Chaining operations will run them asynchronously
41$ status cpu temp:usage:speed
42{"temp":107.6, "usage":10, "speed":2100}
43
44// Combine them all and have fun!
45$ status cpu temp["celsius"]:usage["total","mhz"]:speed["ghz"]
46{"temp":42, "usage":100, "speed":2.1}
47```
48
49### REST API
50
51```javascript
52// Specify a plugin and the output you want back
53// In this example I specify the 'uptime' plugin with the 'total' operation
54POST /status/os "uptime"
55{"total":{"hours":7,"minutes":40,"seconds":6}}
56
57// You can pass arguments to operations too!
58// Arguments can be any javascript objects separated by commas
59POST /status/processes "grep['skype']"
60{"grep":[{"id":1234, "name":"skype"}]}
61
62// Chaining operations will run them asynchronously
63POST /status/cpu "temp:usage:speed"
64{"temp":107.6, "usage":10, "speed":2100}
65
66// Combine them all and have fun!
67POST /status/cpu "temp['celsius']:usage['total','mhz']:speed['ghz']"
68{"temp":42, "usage":100, "speed":2.1}
69```
70
71## Included Plugins
72
73```
74cpu@0.0.1 - CPU information
75 * temp
76 * usage
77 * speed
78spotify@0.0.1 - Spotify controls/information
79 * next
80 * previous
81 * toggle
82 * pause
83 * play
84 * stop
85 * open
86 * playing
87processes@0.0.1 - Process information
88 * all
89 * mine
90 * grep
91 * top
92network@0.0.1 - Network information
93 * upstream
94 * downstream
95wireless@0.0.1 - Wireless network information
96 * ssid
97 * bssid
98 * signal
99 * frequency
100 * rate
101 * security
102 * mode
103hd@0.0.1 - Hard Disk information
104 * temp
105 * usage
106 * total
107 * free
108 * used
109daemons@0.0.1 - Daemon management through rc.d
110 * list
111 * started
112 * stopped
113 * auto
114 * noAuto
115 * start
116 * stop
117 * restart
118 * status
119ram@0.0.1 - RAM information
120 * usage
121 * total
122 * free
123 * used
124os@0.0.1 - System information
125 * load
126 * uptime
127 * arch
128 * platform
129 * type
130 * hostname
131 * kernel
132 * environment
133 * drives
134 * cpus
135 * network
136node@0.0.1 - Node information
137 * version
138 * environment
139 * prefix
140speech@0.0.1 - text to speech using festival
141 * speak
142```
143
144## Writing Plugins
145
146Let's write a plugin called "coolkern" that returns the kernel version
147
148```coffee-script
149{exec} = require "child_process"
150
151coolkern =
152 meta:
153 name: "coolkern"
154 author: "YOU"
155 version: "0.0.1"
156
157 version: ->
158 exec "uname -r", (err, stdout) =>
159 @done stdout
160```
161
162Simple enough, right? Now add it to status
163
164```coffee-script
165status = require 'status'
166status.load coolkern
167```
168
169Finished! Now you can test it out
170
171```
172$ status kernel version
173{"version":"3.3.7-1-ARCH"}
174```
175
176## LICENSE
177
178(MIT License)
179
180Copyright (c) 2012 Fractal <contact@wearefractal.com>
181
182Permission is hereby granted, free of charge, to any person obtaining
183a copy of this software and associated documentation files (the
184"Software"), to deal in the Software without restriction, including
185without limitation the rights to use, copy, modify, merge, publish,
186distribute, sublicense, and/or sell copies of the Software, and to
187permit persons to whom the Software is furnished to do so, subject to
188the following conditions:
189
190The above copyright notice and this permission notice shall be
191included in all copies or substantial portions of the Software.
192
193THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
194EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
195MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
196NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
197LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
198OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
199WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\No newline at end of file