Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion check_redis.pl
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@

use strict;
use IO::Socket;
use IO::Socket::SSL;
use Time::HiRes;
use Text::ParseWords;
use Getopt::Long qw(:config no_ignore_case);
Expand Down Expand Up @@ -510,6 +511,8 @@

my $o_host= undef; # hostname
my $o_port= undef; # port
my $o_use_tls= 0; # use tls (true) or not (false), default is false
my $o_tls_no_verification = 0; # whether to verify that the TLS certificate of the Redis server is trusted
my $o_pwfile= undef; # password file
my $o_password= undef; # password as parameter
my $o_database= undef; # database name (usually a number)
Expand Down Expand Up @@ -572,6 +575,10 @@ sub help {
Hostname or IP Address to check
-p, --port=INTEGER
port number (default: 6379)
-s --ssl --tls
Use TLS to connect to redis
--tls_no_verification
Disable certificate verification for TLS connections
-D, --database=NAME
optional database name (usually a number), needed for --query but otherwise not needed
-x, --password=STRING
Expand Down Expand Up @@ -2506,11 +2513,14 @@ sub check_options {
my $nlib = shift;
my %Options = ();
Getopt::Long::Configure("bundling");

GetOptions(\%Options,
'v:s' => \$o_verb, 'verbose:s' => \$o_verb, "debug:s" => \$o_verb,
'h' => \$o_help, 'help' => \$o_help,
'H:s' => \$o_host, 'hostname:s' => \$o_host,
'p:i' => \$o_port, 'port:i' => \$o_port,
's' => \$o_use_tls, 'ssl' => \$o_use_tls, 'tls' => \$o_use_tls,
'tls_no_verification' => \$o_tls_no_verification,
'C:s' => \$o_pwfile, 'credentials:s' => \$o_pwfile,
'x:s' => \$o_password, 'password:s' => \$o_password,
'D:s' => \$o_database, 'database:s' => \$o_database,
Expand Down Expand Up @@ -2651,7 +2661,12 @@ sub check_options {
$nlib->verb("connecting to $dsn");
$start_time = [ Time::HiRes::gettimeofday() ] if defined($o_timecheck);

$redis = Redis-> new ( server => $dsn, 'debug' => (defined($o_verb))?1:0 );
$redis = Redis-> new (
server => $dsn,
'debug' => (defined($o_verb))?1:0,
ssl => $o_use_tls?1:0,
SSL_verify_mode => $o_tls_no_verification? SSL_VERIFY_NONE : SSL_VERIFY_NONE,
);

if ($PASSWORD) {
$redis->auth($PASSWORD);
Expand Down