mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-29 20:34:51 +00:00
used keys and expires
This commit is contained in:
parent
d81a0f0600
commit
5a489679c7
1 changed files with 48 additions and 14 deletions
|
@ -55,24 +55,27 @@ foreach (split(/\r\n/, $rep)) {
|
|||
}
|
||||
close ($sock);
|
||||
|
||||
my $config = ( defined $ARGV[0] and $ARGV[0] eq "config" );
|
||||
|
||||
|
||||
$0 =~ s/(.+)redis_//g;
|
||||
|
||||
switch ($0) {
|
||||
case "connected_clients" {
|
||||
if ( defined $ARGV[0] and $ARGV[0] eq "config" ) {
|
||||
if ( $config ) {
|
||||
print "graph_title Connected clients\n";
|
||||
print "graph_vlabel Connected clients\n";
|
||||
print "connected_clients.label connected clients\n";
|
||||
print "graph_category redis\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
print "connected_clients.value " . $hash->{'connected_clients'} . "\n";
|
||||
}
|
||||
|
||||
|
||||
case "per_sec" {
|
||||
if ( defined $ARGV[0] and $ARGV[0] eq "config" ) {
|
||||
if ( $config ) {
|
||||
print "graph_title Per second\n";
|
||||
print "graph_vlabel per \${graph_period}\n";
|
||||
print "graph_category redis\n";
|
||||
|
@ -82,19 +85,50 @@ switch ($0) {
|
|||
print "connections.type COUNTER\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
print "requests.value ". $hash->{'total_commands_processed'} ."\n";
|
||||
print "connections.value ". $hash->{'total_connections_received'} ."\n";
|
||||
}
|
||||
|
||||
|
||||
case "used_memory" {
|
||||
if ( defined $ARGV[0] and $ARGV[0] eq "config" ) {
|
||||
if ( $config ) {
|
||||
print "graph_title Used memory\n";
|
||||
print "graph_vlabel Used memory\n";
|
||||
print "used_memory.label used memory\n";
|
||||
print "graph_category redis\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
print "used_memory.value ". $hash->{'used_memory'} ."\n";
|
||||
}
|
||||
|
||||
case "used_keys" {
|
||||
my $dbs;
|
||||
foreach my $key (keys %{$hash}) {
|
||||
if ( $key =~ /^db\d+$/ && $hash->{$key} =~ /keys=(\d+),expires=(\d+)/ ) {
|
||||
$dbs->{$key} = [ $1, $2 ];
|
||||
}
|
||||
}
|
||||
|
||||
if ( $config ) {
|
||||
print "graph_title Used keys\n";
|
||||
print "graph_vlabel Used keys\n";
|
||||
print "graph_category redis\n";
|
||||
|
||||
foreach my $db (keys %{$dbs}) {
|
||||
printf "%s_keys.label %s keys\n", $db, $db;
|
||||
printf "%s_expires.label %s expires\n", $db, $db;
|
||||
}
|
||||
|
||||
exit 0;
|
||||
}
|
||||
|
||||
foreach my $db (keys %{$dbs}) {
|
||||
printf "%s_keys.value %d\n", $db, $dbs->{$db}[0];
|
||||
printf "%s_expires.value %d\n", $db, $dbs->{$db}[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# vim: ft=perl ai ts=4 sw=4 et:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue