mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-24 09:57:09 +00:00
Now supports password protected Redis servers
This commit is contained in:
parent
eb3dad4363
commit
a7be1b2079
1 changed files with 7 additions and 1 deletions
|
@ -26,7 +26,7 @@
|
|||
##
|
||||
## 1. Download the plugin to your plugins directory (e.g. /usr/share/munin/plugins)
|
||||
## 2. Create 3 symlinks at the directory that us used by munin for plugins detection (e.g. /etc/munin/plugins): redis_connected_clients, redis_per_sec and and redis_used_memory
|
||||
## 3. Edit plugin-conf.d/munin-node if it is needed (env.host and env.port variables are accepted)
|
||||
## 3. Edit plugin-conf.d/munin-node if it is needed (env.host and env.port variables are accepted; set env.password for password protected Redis server)
|
||||
## 4. Restart munin-node service
|
||||
|
||||
use strict;
|
||||
|
@ -35,6 +35,7 @@ use Switch;
|
|||
|
||||
my $HOST = exists $ENV{'host'} ? $ENV{'host'} : "127.0.0.1";
|
||||
my $PORT = exists $ENV{'port'} ? $ENV{'port'} : 6379;
|
||||
my $PASSWORD = exists $ENV{'password'} ? $ENV{'password'} : undef;
|
||||
|
||||
my $server = "$HOST:$PORT";
|
||||
my $sock = IO::Socket::INET->new(
|
||||
|
@ -42,6 +43,11 @@ my $sock = IO::Socket::INET->new(
|
|||
Proto => 'tcp'
|
||||
);
|
||||
|
||||
if ( defined( $PASSWORD ) ) {
|
||||
print $sock "AUTH ", $PASSWORD, "\r\n";
|
||||
my $result = <$sock> || die "can't read socket: $!";
|
||||
}
|
||||
|
||||
print $sock "INFO\r\n";
|
||||
my $result = <$sock> || die "can't read socket: $!";
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue