2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

overhaul graph display: remove total, make "current" the "limit"

i did this because I can't figure out how to *not* stack the lines
after the areas. furthermore, removing the limit is essential to have
a proper resolution in the display.
This commit is contained in:
Antoine Beaupré 2014-01-02 19:17:09 -05:00
parent 02c5c4b6d6
commit 6002cb63eb

View File

@ -75,11 +75,6 @@ if ($arg eq 'config') {
sub print_graph_data() {
# Define the values that are returned to munin
my ($current, $upper_limit) = (0,0,0);
# Gather the values from mysqladmin
$current = poll_variables($MYSQL_VARIABLES,"Threads_connected");
$upper_limit = poll_variables($MYSQL_VARIABLES,"max_connections");
# Return the values to Munin
my $counts = count_thread_users();
@ -89,12 +84,14 @@ sub print_graph_data() {
return $counts{$a} <=> $counts{$b};
}
my $i = 0;
my $total = 0;
foreach my $user (sort valsort keys(%counts)) {
last if $i++ >= $numusers;
$total += $counts{$user};
print "$user.value $counts{$user}\n";
}
print "current.value $current\n";
print "limit.value $upper_limit\n";
my $other = poll_variables($MYSQL_VARIABLES,"Threads_connected") - $total;
print "other.value $other\n";
}
sub poll_variables {
@ -117,7 +114,7 @@ sub poll_variables {
sub print_graph_information {
print <<EOM;
graph_title MySQL Connections
graph_title MySQL Connections per user
graph_args --base 1000 --lower-limit 0
graph_vlabel Connections
graph_info The number of current connexions per user.
@ -136,7 +133,7 @@ my $i = 0;
foreach my $user (sort valsort keys(%counts)) {
last if $i++ >= $numusers;
print <<EOM;
$user.label Connexions for user $user
$user.label $user
$user.info Number of connexions used by user $user
EOM
print "$user.draw ";
@ -150,14 +147,9 @@ print "$user.draw ";
}
print <<EOM;
current.label In Use
current.draw LINE1
current.info The number of current threads connected
current.warning $warning
current.critical $critical
limit.label Maximum
limit.draw LINE1
limit.info The current value of the "max_connections" variable
other.label Others
other.draw STACK
other.info Other connected threads not in the top $numusers
EOM
}