Hateburo: kazeburo hatenablog

SRE / 運用系小姑 / Goを書くPerl Monger

Released Plack::Middleware::ServerStatus::Lite 0.30, includes server-status command

I released Plack::Middleware::ServerStatus::Lite 0.30. This version includes `server-status` command.

https://metacpan.org/release/Plack-Middleware-ServerStatus-Lite

server-status command is able to display server status without HTTP requests.

eg.

$ cat app.psgi
use Plack::Builder;

builder {
    enable "Plack::Middleware::ServerStatus::Lite",
        path => '/server-status',
        allow => [ '127.0.0.1'],
        scoreboard => '/tmp/server-status',
        counter_file => '/tmp/server-status/counter';
    sub { [200,[],["ok"]] };
};
$ plackup -s Starman -a app.psgi

And run `server-status`

$ server-status --scoreboard /tmp/server-status --counter /tmp/server-status/counter
Total Accesses: 123
BusyWorkers: 2
IdleWorkers: 3
--
pid status remote_addr host method uri protocol ss
20060 A 127.0.0.1 localhost:10001 GET / HTTP/1.1 1
20061 .
20062 A 127.0.0.1 localhost:10001 GET /foo HTTP/1.1 0
20063 .
20064 .

By using `server-status` we can get server status if all processes are busy :)

the original code by @karenetheridge. Thank you.