From 509471b070ab71eaa36856b40d92724e0d66bc58 Mon Sep 17 00:00:00 2001 From: tsaavik Date: Mon, 22 Jul 2019 15:26:46 -0700 Subject: [PATCH] Added Redis lag graph for slave0 node replication --- plugins/redis/redis_ | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/plugins/redis/redis_ b/plugins/redis/redis_ index e2704a55..fd0fc73c 100755 --- a/plugins/redis/redis_ +++ b/plugins/redis/redis_ @@ -59,7 +59,7 @@ if ( $autoconf ) { my $suggest = ( defined $ARGV[0] and $ARGV[0] eq "suggest" ); if ( $suggest ) { if ( defined( $sock ) ) { - my @plugins = ('connected_clients', 'key_ratio', 'keys_per_sec', 'per_sec', 'repl_backlog_size', 'used_keys', 'used_memory'); + my @plugins = ('connected_clients', 'key_ratio', 'keys_per_sec', 'per_sec', 'repl_backlog_size', 'repl_lag', 'used_keys', 'used_memory'); foreach my $plugin (@plugins) { print "$plugin\n"; } @@ -160,7 +160,6 @@ switch ($0) { case "repl_backlog_size" { if ( $config ) { - my $maxclients= get_config("maxclients")->{"maxclients"}; print "graph_title ${TITLE_PREFIX}replication backlog\n"; print "graph_vlabel replication backlog\n"; print "graph_category search\n"; @@ -172,6 +171,21 @@ switch ($0) { print "repl_backlog_size.value " . $hash->{'repl_backlog_size'} . "\n"; } + case "repl_lag" { + if ( $config ) { + print "graph_title ${TITLE_PREFIX}replication lag\n"; + print "graph_vlabel replication lag\n"; + print "graph_category search\n"; + print "graph_args -l 0\n"; + print "repl_backlog_size.label amount behind master\n"; + exit 0; + } + + if ($hash->{slave0} =~ /lag=(\d+)/) { + print "repl_backlog_size.value " . $1 . "\n"; + } + } + case "used_memory" { if ( $config ) {