App-Unicheck-Modules-MySQL
view release on metacpan or search on metacpan
lib/App/Unicheck/Modules/MySQL.pm view on Meta::CPAN
package App::Unicheck::Modules::MySQL;
use 5.10.1;
use strict;
use warnings FATAL => 'all';
use Moo;
use Getopt::Long qw(GetOptionsFromArray);
use Try::Tiny;
use DBI;
use JSON;
=head1 NAME
App::Unicheck::Modules::MySQL - App::Unicheck module to check mysql connections and servers.
=head1 VERSION
Version 0.02
=cut
our $VERSION = '0.02';
=head1 SYNOPSIS
App::Unicheck::Modules::MySQL can be used to check server availability, version, database sizes and more.
# for additional information run
unicheck --info MySQL
=cut
sub run {
my ($self, $action, @params) = @_;
$self->$action(@params);
}
=head1 ACTIONS
=head2 reachable
Check if the server is reachable.
# check default localhost:3306
unicheck MySQL reachable
# check specific host:port
unicheck MySQL reachable --host example.com --port 1234
=cut
sub reachable {
my ($self, @params) = @_;
my $host = 'localhost';
my $port = 3306;
my $format = 'num';
my $user = '';
my $pass = '';
my $database = '';
GetOptionsFromArray([@params],
'port=i' => \$port,
'host=s' => \$host,
'format=s' => \$format,
'user=s' => \$user,
( run in 0.643 second using v1.01-cache-2.11-cpan-39bf76dae61 )