mesures

0.3.2 • Public • Published

Mesures

Exposing key/value over HTTP as a JSON, even in real time.

Mesures, like metrics in French.

Write value on a socket, with nc or other low tech tool. Read it with curl.

Test it

Mesure uses Mocha tests.

npm install
npm test

Try it

In a terminal

./bin/mesures.js

You can specify a config file as first argument. Have a look at conf.json

In an other terminnal

echo "SET answer 42" | nc localhost 8124

In a browser

http://localhost:1337

Event source :

First event a dump, followings are new values.

http://localhost:1337/events

First event is a complete dump, following by a simple key/value for each modifications.

Install as a service

There is a script to install mesures on a debian like Linux

sudo ./install_debian.sh

The scripts create a new user mesures:mesures, copy the default conf and install the init.d boot scipt.

Put a nice Nginx in front, it will handle the port 80 for you.

Configuration

Configuration is done with a json file. It's the first argument for the mesures script.

Internal website

  • host
  • port
  • homepage true: default website. false : 404 not found. A path: default root folder?

Modules

Each modules can access to the state object (in read/write mode) and register url patterns.

input/tcp_socket

Send command to the server. It uses the redis old syntax. Words are space separated, first word is the action. Action is case insensitive. Answer start with a + if it works, a - for an error.

  • port
  • host host, 0.0.0.0 if you wont to listen every network interface|

Commands

  • SET key value
  • DELETE key
  • INCR key value [interval (ms)]

input/eventsource

Chain different mesures servers listeing each other via eventsource.

  • url eventsource url
  • prefix add this prefix to the key

input/self

rss and V8 head size and usage.

input/collectd

Collectd can write its data priodicaly.

Collectd conf :

LoadPlugin write_http
<Plugin write_http>
    <URL "http://localhost:8125/collectd-post">
        Format "JSON"
    </URL>
</Plugin>

It uses a private webserver with a different port

  • port 8125
  • host localhost

proc/stats

Fetch metrics from /proc folder.

output/vapor

Remember old values with a capped list.

Todo

  • √ expose stack as JSON over HTTP
  • √ set value over a socket
  • √ expose values as Server Sent Event
  • √ homepage with some javascripts.
  • √ registerable modules
  • √ config file
  • √ chain mesures
  • √ self monitoring
  • _ backup JSON file for crash proof
  • _ not only GAUGE, add COUNTER type
  • _ handling collectd HTTP PUT
  • _ logging
  • _ display timestamp in the graph
  • _ handling statsd UDP protocol

Licence

GPLv3. © Mathieu Lecarme.

Readme

Keywords

none

Package Sidebar

Install

npm i mesures

Weekly Downloads

15

Version

0.3.2

License

none

Last publish

Collaborators

  • athoune