Révision 6002cb63
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.
| plugins/mysql/mysql_connections_per_user | ||
|---|---|---|
| 75 | 75 |
|
| 76 | 76 |
sub print_graph_data() {
|
| 77 | 77 |
# Define the values that are returned to munin |
| 78 |
my ($current, $upper_limit) = (0,0,0); |
|
| 79 |
|
|
| 80 |
# Gather the values from mysqladmin |
|
| 81 |
$current = poll_variables($MYSQL_VARIABLES,"Threads_connected"); |
|
| 82 |
$upper_limit = poll_variables($MYSQL_VARIABLES,"max_connections"); |
|
| 83 | 78 |
|
| 84 | 79 |
# Return the values to Munin |
| 85 | 80 |
my $counts = count_thread_users(); |
| ... | ... | |
| 89 | 84 |
return $counts{$a} <=> $counts{$b};
|
| 90 | 85 |
} |
| 91 | 86 |
my $i = 0; |
| 87 |
my $total = 0; |
|
| 92 | 88 |
foreach my $user (sort valsort keys(%counts)) {
|
| 93 | 89 |
last if $i++ >= $numusers; |
| 90 |
$total += $counts{$user};
|
|
| 94 | 91 |
print "$user.value $counts{$user}\n";
|
| 95 | 92 |
} |
| 96 |
print "current.value $current\n";
|
|
| 97 |
print "limit.value $upper_limit\n";
|
|
| 93 |
my $other = poll_variables($MYSQL_VARIABLES,"Threads_connected") - $total;
|
|
| 94 |
print "other.value $other\n";
|
|
| 98 | 95 |
} |
| 99 | 96 |
|
| 100 | 97 |
sub poll_variables {
|
| ... | ... | |
| 117 | 114 |
|
| 118 | 115 |
sub print_graph_information {
|
| 119 | 116 |
print <<EOM; |
| 120 |
graph_title MySQL Connections |
|
| 117 |
graph_title MySQL Connections per user
|
|
| 121 | 118 |
graph_args --base 1000 --lower-limit 0 |
| 122 | 119 |
graph_vlabel Connections |
| 123 | 120 |
graph_info The number of current connexions per user. |
| ... | ... | |
| 136 | 133 |
foreach my $user (sort valsort keys(%counts)) {
|
| 137 | 134 |
last if $i++ >= $numusers; |
| 138 | 135 |
print <<EOM; |
| 139 |
$user.label Connexions for user $user
|
|
| 136 |
$user.label $user |
|
| 140 | 137 |
$user.info Number of connexions used by user $user |
| 141 | 138 |
EOM |
| 142 | 139 |
print "$user.draw "; |
| ... | ... | |
| 150 | 147 |
} |
| 151 | 148 |
|
| 152 | 149 |
print <<EOM; |
| 153 |
current.label In Use |
|
| 154 |
current.draw LINE1 |
|
| 155 |
current.info The number of current threads connected |
|
| 156 |
current.warning $warning |
|
| 157 |
current.critical $critical |
|
| 158 |
limit.label Maximum |
|
| 159 |
limit.draw LINE1 |
|
| 160 |
limit.info The current value of the "max_connections" variable |
|
| 150 |
other.label Others |
|
| 151 |
other.draw STACK |
|
| 152 |
other.info Other connected threads not in the top $numusers |
|
| 161 | 153 |
EOM |
| 162 | 154 |
} |
| 163 | 155 |
|
Formats disponibles : Unified diff