mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-26 02:48:28 +00:00
Added Redis replication backlog graph
This commit is contained in:
parent
edb7a1f991
commit
f88edd0863
1 changed files with 24 additions and 10 deletions
|
@ -59,7 +59,7 @@ if ( $autoconf ) {
|
||||||
my $suggest = ( defined $ARGV[0] and $ARGV[0] eq "suggest" );
|
my $suggest = ( defined $ARGV[0] and $ARGV[0] eq "suggest" );
|
||||||
if ( $suggest ) {
|
if ( $suggest ) {
|
||||||
if ( defined( $sock ) ) {
|
if ( defined( $sock ) ) {
|
||||||
my @plugins = ('connected_clients', 'key_ratio', 'keys_per_sec', 'per_sec', 'used_keys', 'used_memory');
|
my @plugins = ('connected_clients', 'key_ratio', 'keys_per_sec', 'per_sec', 'repl_backlog_size', 'used_keys', 'used_memory');
|
||||||
foreach my $plugin (@plugins) {
|
foreach my $plugin (@plugins) {
|
||||||
print "$plugin\n";
|
print "$plugin\n";
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ switch ($0) {
|
||||||
print "missratio.draw STACK\n";
|
print "missratio.draw STACK\n";
|
||||||
exit 0;
|
exit 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $total = $hash->{'keyspace_hits'} + $hash->{'keyspace_misses'};
|
my $total = $hash->{'keyspace_hits'} + $hash->{'keyspace_misses'};
|
||||||
my $hitratio = 0;
|
my $hitratio = 0;
|
||||||
my $missratio = 0;
|
my $missratio = 0;
|
||||||
|
@ -143,7 +143,7 @@ switch ($0) {
|
||||||
|
|
||||||
case "per_sec" {
|
case "per_sec" {
|
||||||
if ( $config ) {
|
if ( $config ) {
|
||||||
print "graph_title ${TITLE_PREFIX}Per second\n";
|
print "graph_title ${TITLE_PREFIX}Requests Per second\n";
|
||||||
print "graph_vlabel per \${graph_period}\n";
|
print "graph_vlabel per \${graph_period}\n";
|
||||||
print "graph_category search\n";
|
print "graph_category search\n";
|
||||||
print "graph_args -l 0\n";
|
print "graph_args -l 0\n";
|
||||||
|
@ -158,6 +158,20 @@ switch ($0) {
|
||||||
print "connections.value ". $hash->{'total_connections_received'} ."\n";
|
print "connections.value ". $hash->{'total_connections_received'} ."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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";
|
||||||
|
print "graph_args -l 0\n";
|
||||||
|
print "repl_backlog_size.label bytes behind master\n";
|
||||||
|
exit 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
print "repl_backlog_size.value " . $hash->{'repl_backlog_size'} . "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
case "used_memory" {
|
case "used_memory" {
|
||||||
if ( $config ) {
|
if ( $config ) {
|
||||||
|
@ -177,7 +191,7 @@ switch ($0) {
|
||||||
print "used_memory_rss.value ". $hash->{'used_memory_rss'} ."\n";
|
print "used_memory_rss.value ". $hash->{'used_memory_rss'} ."\n";
|
||||||
print "used_memory_peak.value ". $hash->{'used_memory_peak'} ."\n";
|
print "used_memory_peak.value ". $hash->{'used_memory_peak'} ."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
case "used_keys" {
|
case "used_keys" {
|
||||||
my $dbs;
|
my $dbs;
|
||||||
foreach my $key (keys %{$hash}) {
|
foreach my $key (keys %{$hash}) {
|
||||||
|
@ -210,18 +224,18 @@ switch ($0) {
|
||||||
close ($sock);
|
close ($sock);
|
||||||
|
|
||||||
sub get_conn {
|
sub get_conn {
|
||||||
|
|
||||||
my $sock;
|
my $sock;
|
||||||
|
|
||||||
if( $UNIX_SOCKET && -S $UNIX_SOCKET ){
|
if( $UNIX_SOCKET && -S $UNIX_SOCKET ){
|
||||||
|
|
||||||
$sock = IO::Socket::UNIX->new(
|
$sock = IO::Socket::UNIX->new(
|
||||||
Type => SOCK_STREAM(),
|
Type => SOCK_STREAM(),
|
||||||
Peer => $UNIX_SOCKET,
|
Peer => $UNIX_SOCKET,
|
||||||
);
|
);
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
$sock = IO::Socket::INET->new(
|
$sock = IO::Socket::INET->new(
|
||||||
PeerAddr => $HOST,
|
PeerAddr => $HOST,
|
||||||
PeerPort => $PORT,
|
PeerPort => $PORT,
|
||||||
|
@ -229,7 +243,7 @@ sub get_conn {
|
||||||
Proto => 'tcp'
|
Proto => 'tcp'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( defined( $PASSWORD ) ) {
|
if ( defined( $PASSWORD ) ) {
|
||||||
print $sock "AUTH ", $PASSWORD, "\r\n";
|
print $sock "AUTH ", $PASSWORD, "\r\n";
|
||||||
my $result = <$sock> || die "can't read socket: $!";
|
my $result = <$sock> || die "can't read socket: $!";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue