Perl warning: uninitialized value $first_epoch in subtraction
dwreski opened this issue · comments
This appears to be a warning when first creating the RRD for many of the plugins.
2021/02/17 13:30:15 [INFO] creating rrd-file for bandwidth_br0->_0dayusage: '/var/lib/munin/havoc/havoc-bandwidth_br0-_0dayusage-g.rrd'
2021/02/17 13:30:15 [PERL WARNING] Use of uninitialized value $first_epoch in subtraction (-) at /usr/share/perl5/vendor_perl/Munin/Master/UpdateWorker.pm line 768, <GEN1> line 648.
2021/02/17 13:30:15 [INFO] creating rrd-file for bandwidth_br0->monthly: '/var/lib/munin/havoc/havoc-bandwidth_br0-monthly-g.rrd'
2021/02/17 13:30:15 [PERL WARNING] Use of uninitialized value $first_epoch in subtraction (-) at /usr/share/perl5/vendor_perl/Munin/Master/UpdateWorker.pm line 768, <GEN1> line 648.
This is what I have for the lines surrounding 768 in /usr/share/perl5/vendor_perl/Munin/Master/UpdateWorker.pm
761 # Add the RRD::create prefix (filename & RRD params)
762 my $heartbeat = $update_rate * 2;
763 unshift (@args,
764 $rrd_file,
765 "--start", ($first_epoch - $update_rate),
766 "-s", $update_rate,
767 sprintf('DS:42:%s:%s:%s:%s',
768 $ds_config->{type}, $heartbeat, $ds_config->{min}, $ds_config->{max}),
769 );
Stale issue message
If this issue is valid, it should be moved to https://github.com/munin-monitoring/munin/ as it propably affects https://github.com/munin-monitoring/munin/blob/master/lib/Munin/Master/UpdateWorker.pm
Edit: still happening on Debian Buster
2021/11/30 14:50:36 [PERL WARNING] Use of uninitialized value $first_epoch in subtraction (-) at /usr/share/perl5/Munin/Master/UpdateWorker.pm line 770, <GEN1> line 2795.
installed versions (dpkg -l
):
ii munin 2.0.49-1 all network-wide graphing framework (grapher/gatherer)
ii munin-common 2.0.49-1 all network-wide graphing framework (common)
ii munin-doc 2.0.49-1 all network-wide graphing framework (documentation)
ii munin-node 2.0.49-1 all network-wide graphing framework (node)
ii munin-plugins-core 2.0.49-1 all network-wide graphing framework (plugins for node)
ii munin-plugins-extra 2.0.49-1 all network-wide graphing framework (user contributed plugins for node)
Thanks for validating this. Please let me know how I can help troubleshoot this.
@guardiandigital to me it looks like
my $first_epoch = (defined($service_data) and defined($service_data->{$ds_name})) ? ($service_data->{$ds_name}->{when}->[0]) : 0;
still might result in an uninitialized value if the array when
has no 0th element.
Testing a possible fix on our servers.
quick grep over our log seems it's happening for values of the following plugins:
- bind9_rr
- bind95_
- docker_cpu
- docker_memory
- df_inode (non contrib plugin)
The fix provided by @ap-wtioit is now merged. Thanks!