Cacti / cacti

Cacti ™
http://www.cacti.net
GNU General Public License v2.0
1.65k stars 406 forks source link

DSStats Avg/Peak function broken due to change in RRDtool processing #1362

Closed reubenfarrelly closed 6 years ago

reubenfarrelly commented 6 years ago

This warning has recently started appearing in my cacti logs. This log output below is with cacti head from -git as of today. I'm running php-7.1.14 on Gentoo Linux:

16/Feb/2018 12:00:10 - CMDPHP PHP ERROR WARNING Backtrace: (/poller_dsstats.php: 191 dsstats_get_and_store_ds_avgpeak_values)(/lib/dsstats.php: 72 dsstats_write_buffer)(/lib/dsstats.php: 96 sizeof)(CactiErrorHandler)(/lib/functions.php: 4619 cacti_debug_backtrace)

16/Feb/2018 12:00:10 - ERROR PHP WARNING: sizeof(): Parameter must be an array or an object that implements Countable in file: /var/www/cacti.xxx.net/htdocs/lib/dsstats.php on line: 96 16/Feb/2018 12:00:10 - CMDPHP PHP ERROR WARNING Backtrace: (/poller_dsstats.php: 191 dsstats_get_and_store_ds_avgpeak_values)(/lib/dsstats.php: 72 dsstats_write_buffer)(/lib/dsstats.php: 96 sizeof)(CactiErrorHandler)(/lib/functions.php: 4619 cacti_debug_backtrace) 16/Feb/2018 12:00:10 - ERROR PHP WARNING: sizeof(): Parameter must be an array or an object that implements Countable in file: /var/www/cacti.xxx.net/htdocs/lib/dsstats.php on line: 96

It's hard to say if it is having an impact (nothing obviously is amiss) but it is logged as a warning nonetheless.

cigamit commented 6 years ago

Well it's very odd that it is happening. I'll have to upgrade a system to use php7.1.14. I'm making some changes to avoid that, but it would be nice to know the root cause.

cigamit commented 6 years ago

Okay, found the issue. There was an attempt to move the dsstats processing to some other cacti functions, but in that attempt, we lost the ability to capture the rrdtool output causing this issue.

The code has been updated to restore that functionality, also did some general cleanup to reduce the complexity of the code.

I will look at moving the RRDtool processing to our core functions, but have to discuss this with @browniebraun before doing that as it impacts his RRDtool proxy.

cigamit commented 6 years ago

Resolved, thanks to taking the time to report @reubenfarrelly!