Permalink
Browse files

updated README, added linux init.d script

  • Loading branch information...
1 parent 94549c9 commit 6b4eda816572c0bd44f8ea757e9464a274c6c62f Geoff Flarity committed Mar 10, 2012
Showing with 53 additions and 8 deletions.
  1. +41 −8 README.md
  2. +12 −0 misc/init.d/nervous
View
@@ -1,19 +1,21 @@
# Nervous - Monitoring doesn't have to suck.
-# Manifesto:
+## Manifesto:
Graphite does a good job storing and presenting time series data. But I've yet to find satisfactory solution to the problem of *easily* gathering arbitrary hardware, operating system and application data to feed Graphite. Collectd comes closest, it has facilities for writting plugins in Perl, Python and Java. That's great but I had difficulty compiling the Perl plugin and interfaces seems needlessly complex. That said, for those chases where collectd already has a plugin satisfying your needs it's great. Nervous tries to provide a framework for easily creating your own custom monitoring plugins. These plugins are written in JavaScript and chances are good that you already know a little. But most importantly, Nervous tries to this and only this very well.
"Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices."
The ease with which plugins can be written in Node.js JavaScript is also advantage. For these reasons I feel that Node.js is perfectly suited for writing a pluggable monitoring system.
-# About Nervous
+
+## About Nervous
Nervous is the embodiment of the beliefs above. It is a simple plugin based monitoring system with support for sending data to Graphite or [Response](https://github.com/gflarity/response). It follows the 'convention over configuration' and 'keep it simple shithead' ethea.
Contributions in the form of code, plugins, documentation, spreading the word, high fives are all encouraged. Specifically I could use help creating startup scripts, packaging manifests for different platforms etc.
+
## About Plugins:
Plugins are just regular Node.js libraries/modules that conform to a certain convention to make them pluggable. They can be hosted on github and installed with NPM. Use your favourite configuration management system to install/deploy them. Configuration goes at the top of the plugin's index.js and should easily be templatable. They're expected to 'play nice' by not blocking the event loop, not overwhelming the system with events, and not tax the system's resources unecessarily. Some available plugins include cpu usage, filesystem size/usage, memcached stats gathering.
@@ -25,7 +27,9 @@ Plugins get loaded during startup. Inside the plugin you define how data gets re
1) Install/setup Graphite (optional)
-2) edit the config in ./bin/nervous file, if you don't have graphite then change system_type to 'stdout' instead.
+2) Install Nervous by running 'sudo ./install.sh' (optional)
+
+2) Copy the conf/nervous.json.example to conf/nervous.json and edit it. If you don't have graphite then change system_type to 'stdout' instead.
3) start nervous up
@@ -34,22 +38,51 @@ Plugins get loaded during startup. Inside the plugin you define how data gets re
cd ../
./bin/nervous
-Note this is under construction. Soon there will be make install support. I'm considering including optional support for forever.
+4a) On linux you can install 'forvever' and copy the init.d script into place:
+
+`
+sudo npm install forever -g
+sudo cp misc/init.d/nervous /etc/init.d/
+sudo service nervous start
+`
+
+4b) On SmartOS or other illumos systems you can use the included SMF manifest:
+
+`
+sudo svccfg import misc/smf/nervous.xml
+`
## Where to find plugins:
-under construction. My current plan is to use a namespace convention for the NPM repostiory. Something like nervous_plugin_foo. Suggestions welcome.
+Search search.npmjs.org for nervous. Plugins conform to the naming convention 'nervous_plugin_<foo>' and there are already some there.
## How to write plugins:
-Examples under construction. Please take a look the following examples and follow the conventions you see there.
-Please include all module dependencies with your plugins. The idea is to make it incredibly simple to install and configure plugins.
+Please take a look the included examples as well as those plugins available through npm. It's really easy:
+
+`
+//this oneliner loads the config.json in the plugin root dir
+var config = JSON.parse( fs.readFileSync( require.resolve('./config.json') ) );
+
+//export a single function, it gets an event emitter which you send out graphite data on as you like
+module.exports = function( axon ) {
+
+ //do some stuff, usually inside of a 'setInterval' then:
+ axon.emit( 'data', name, value );
+
+ //or:
+ axon.emit( 'data', name, value, timestamp );
+};
+`
+
## How to test plugins:
-Check out the test.js script inside the plugins directory. It takes a plugin name as a argument and then loads the plugin just like nervous would, only data just gets printed to stdout.
+Check out the test.js script inside the plugins directory. It takes a plugin name as a argument and then loads the plugin just like nervous would, only data just gets printed to stdout. Example:
+
+`node test filesystem_usage`
## Mailing List:
View
@@ -0,0 +1,12 @@
+#! /bin/bash set -e
+NERVOUS=/opt/nervous/bin/nervous
+case "$1" in
+start) forever start $NERVOUS ;;
+stop) forever stop $NERVOUS ;;
+force-reload|restart)
+forever restart $NERVOUS ;;
+status) forever list | grep $NERVOUS ;;
+*) echo "Usage: /etc/init.d/nervous {start|stop|restart|force-reload}"
+exit 1 ;;
+esac
+exit 0

0 comments on commit 6b4eda8

Please sign in to comment.