The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Mojolicious::Plugin::Status - Mojolicious server status

SYNOPSIS

  # Mojolicious
  $self->plugin('Status');

  # Mojolicious::Lite
  plugin 'Status';

  # Secure access to the server status ui with Basic authentication
  my $under = $self->routes->under('/status' => sub ($c) {
    return 1 if $c->req->url->to_abs->userinfo eq 'Bender:rocks';
    $c->res->headers->www_authenticate('Basic');
    $c->render(text => 'Authentication required!', status => 401);
    return undef;
  });
  $self->plugin('Status' => {route => $under});

DESCRIPTION

Screenshot

Mojolicious::Plugin::Status is a Mojolicious plugin providing a server status ui for Mojo::Server::Daemon and Mojo::Server::Prefork. Note that this module is EXPERIMENTAL and should therefore only be used for debugging purposes.

OPTIONS

Mojolicious::Plugin::Status supports the following options.

return_to

  # Mojolicious::Lite
  plugin Status => {return_to => 'some_route'};

Name of route or path to return to when leaving the server status ui, defaults to /.

route

  # Mojolicious::Lite
  plugin Status => {route => app->routes->any('/status')};

Mojolicious::Routes::Route object to attach the server status ui to, defaults to generating a new one with the prefix /mojo-status.

size

  # Mojolicious::Lite
  plugin Status => {size => 1234};

Size of anonymous mapped memory to use for storing statistics, defaults to 52428800 (50 MiB).

slowest

  # Mojolicious::Lite
  plugin Status => {slowest => 5}; 

Number of slowest requests to track, defaults to 10.

METHODS

Mojolicious::Plugin::Status inherits all methods from Mojolicious::Plugin and implements the following new ones.

register

  my $route = $plugin->register(Mojolicious->new);

Register renderer and helper in Mojolicious application.

BUNDLED FILES

The Mojolicious::Plugin::Status distribution includes a few files with different licenses that have been bundled for internal use.

Artwork

  Copyright (C) 2018, Sebastian Riedel.

Licensed under the CC-SA License, Version 4.0 http://creativecommons.org/licenses/by-sa/4.0.

Bootstrap

  Copyright (C) 2011-2018 The Bootstrap Authors.

Licensed under the MIT License, http://creativecommons.org/licenses/MIT.

Font Awesome

  Copyright (C) Dave Gandy.

Licensed under the MIT License, http://creativecommons.org/licenses/MIT, and the SIL OFL 1.1, http://scripts.sil.org/OFL.

AUTHOR

Sebastian Riedel, sri@cpan.org.

COPYRIGHT AND LICENSE

Copyright (C) 2018-2021, Sebastian Riedel and others.

This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version 2.0.

SEE ALSO

Mojolicious, Mojolicious::Guides, https://mojolicious.org.