Munin plugin & Use of uninitialized value in

By | November 25, 2015

I usually find sticking this code in an existing plugin resolve the problem

if(!defined $data->{$ds->{name}}) { $data->{$ds->{name}} = 0; }

egĀ Use of uninitialized value in printf at /usr/local/etc/munin/plugins/mysql_innodb_io_pend line 885.

so I stuck the code in just before line 885.

The red highlighted text is the added code, the orange is the code which was throwing up the warning

sub show {
 my $graph_name = shift;

 die 'Unknown graph ' . ($graph_name ? $graph_name : '')
 unless $graphs{$graph_name};

 my $graph = $graphs{$graph_name};

 update_data();

 die "Can't show data for '$graph_name' because InnoDB is disabled."
 if $graph_name =~ /innodb_/ && $data->{_innodb_disabled};

 for my $ds (@{$graph->{data_sources}}) {
 if(!defined $data->{$ds->{name}}) { $data->{$ds->{name}} = 0; }
 printf "%s.value %s\n",
 clean_fieldname($ds->{name}), $data->{$ds->{name}};
 }

 return 0;
}