App-Unicheck-Modules-Redis
view release on metacpan or search on metacpan
lib/App/Unicheck/Modules/Redis.pm view on Meta::CPAN
package App::Unicheck::Modules::Redis;
use 5.10.1;
use strict;
use warnings FATAL => 'all';
use Moo;
use Getopt::Long qw(GetOptionsFromArray);
use Redis;
use Try::Tiny;
use JSON;
=head1 NAME
App::Unicheck::Modules::Redis - App::Unicheck module to check redis servers.
=head1 VERSION
Version 0.01
=cut
our $VERSION = '0.02';
=head1 SYNOPSIS
App::Unicheck::Modules::Redis can check used memory and reachability of redis servers.
# to show available information on parameters run
unicheck --info Redis
=cut
sub run {
my ($self, $action, @params) = @_;
$self->$action(@params);
}
=head1 ACTIONS
=head2 reachable
Check if the server is reachable.
# check default localhost:6379
unicheck Redis reachable
# check specific host:port
unicheck Redis reachable --host example.com --port 1234
=cut
sub reachable {
my ($self, @params) = @_;
my $host = '127.0.0.1';
my $port = 6379;
my $format = 'num';
GetOptionsFromArray([@params],
'port=i' => \$port,
'host=s' => \$host,
'format=s' => \$format,
);
my $retval;
try {
Redis->new(server => "$host:$port");
( run in 1.196 second using v1.01-cache-2.11-cpan-39bf76dae61 )