You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This patch adds an extra feature for the datasources, check_ds, that decides whether a datasource is to be graphed or not.
It needs to move collect_data() call to outside the if because the data should be available for the config mode of the plugin. If you care about the number of statistics-gathering queries collect_data() should cache the data it retrieves, I haven't because this is really on the edge of my Perl hacking abilities 😃.
It moves the print multigraph..-statement because it should not be printed for graphs that won't be there later on, munin gets rather confused if you do.
--- mysql 2013-05-06 18:26:07.000000000 +0200
+++ mysql.new 2013-05-14 22:29:32.317507777 +0200
@@ -227,13 +228,10 @@
if ($command eq 'autoconf') {
return $command_map{$command}->();
}
else {
- if ($command eq 'show') {
- collect_data();
- }
+ collect_data();
for my $graph (sort keys %graphs) {
- print "multigraph mysql_$graph$instance\n";
$command_map{$command}->($graph);
}
}
return 0;
@@ -270,8 +268,21 @@
my %conf = (%{$defaults{global_attrs}}, %{$graph->{config}{global_attrs}});
$conf{args} .= ' --no-gridfit --slope-mode';
+ # see if there needs to be some datasource defined
+ if ( defined ($graph->{config}{check_ds})) {
+
+ # if the datasource isn't in the data, skip this graph (query cache not enabled or smt)
+ for my $f ($graph->{config}{check_ds}) {
+ if ( !defined ($data->{$f})) {
+ return;
+ }
+ }
+ }
+
+ print "multigraph mysql_$graph_name$instance\n";
+
while (my ($k, $v) = each %conf) {
print "graph_$k $v\n";
}
print "graph_category mysql$instance\n";
@@ -301,8 +312,10 @@
sub show {
my $graph_name = shift;
my $graph = $graphs{$graph_name};
+
+ print "multigraph mysql_$graph_name$instance\n";
die "Can't show data for '$graph_name' because InnoDB is disabled."
if $graph_name =~ /innodb_/ && $data->{_innodb_disabled};
The text was updated successfully, but these errors were encountered:
This patch adds an extra feature for the datasources, check_ds, that decides whether a datasource is to be graphed or not.
It needs to move
collect_data()
call to outside the if because the data should be available for the config mode of the plugin. If you care about the number of statistics-gathering queriescollect_data()
should cache the data it retrieves, I haven't because this is really on the edge of my Perl hacking abilities 😃.It moves the
print multigraph..
-statement because it should not be printed for graphs that won't be there later on, munin gets rather confused if you do.The text was updated successfully, but these errors were encountered: