Raindrops::Watcher is a stand-alone Rack application for watching any number of TCP and UNIX listeners (all of them by default).
It depends on the Aggregate RubyGem
In your Rack config.ru:
run Raindrops::Watcher(options = {})
It takes the following options hash:
:listeners - an array of listener names, (e.g. %w(0.0.0.0:80 /tmp/sock))
:delay - interval between stats updates in seconds (default: 1)
Raindrops::Watcher is compatible any thread-safe/thread-aware Rack middleware. It does not work well with multi-process web servers but can be used to monitor them. It consumes minimal resources with the default :delay.
Returns an HTML summary listing of all listen interfaces watched on
Returns a plain text summary + histogram with X-* HTTP headers for active connections.
e.g.: curl raindrops-demo.bogomips.org/active/0.0.0.0%3A80.txt
Returns an HTML summary + histogram with X-* HTTP headers for active connections.
e.g.: curl raindrops-demo.bogomips.org/active/0.0.0.0%3A80.html
Returns a plain text summary + histogram with X-* HTTP headers for queued connections.
e.g.: curl raindrops-demo.bogomips.org/queued/0.0.0.0%3A80.txt
Returns an HTML summary + histogram with X-* HTTP headers for queued connections.
e.g.: curl raindrops-demo.bogomips.org/queued/0.0.0.0%3A80.html
Resets the active and queued statistics for the given listener.
Streams chunked a response to the client. Interval is the preconfigured
:delay
of the application (default 1 second)
The response is plain text in the following format:
ISO8601_TIMESTAMP LISTENER_NAME ACTIVE_COUNT QUEUED_COUNT LINEFEED
Query parameters:
active_min - do not stream a line until this active count is reached
queued_min - do not stream a line until this queued count is reached
X-Count - number of samples polled
X-Last-Reset - date since the last reset
The following headers are only present if X-Count is greater than one.
X-Min - lowest number of connections recorded
X-Max - highest number of connections recorded
X-Mean - mean number of connections recorded
X-Std-Dev - standard deviation of connection count
X-Outliers-Low - number of low outliers (hopefully many for queued)
X-Outliers-High - number of high outliers (hopefully zero for queued)
X-Current - current number of connections
X-First-Peak-At - date of when X-Max was first reached
X-Last-Peak-At - date of when X-Max was last reached
There is a server running this app at raindrops-demo.bogomips.org/ The Raindrops::Middleware demo is also accessible at raindrops-demo.bogomips.org/_raindrops
The demo server is only limited to 30 users, so be sure not to abuse it by using the /tail/ endpoint too much.