Cacti / cacti

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

Data Source Statistics incorrectly reports that a data source does not exist #1414

Closed netniV closed 6 years ago

netniV commented 6 years ago

I have just seen a large number of warnings from DSSTATS have appeared in my log files. When I took one of the filenames and looked for it, it was present. Therefore, this warning appears to be in error. When I used the debug plugin to verify the datasource, no issues were found.

netniV commented 6 years ago

The path is probably the which usually corresponds to /rra/

k4y53r commented 6 years ago

Hi,

I've also get this error after upgrade to 1.1.36, checked path and permission with no error detected on them

Update: no structured RRA used

netniV commented 6 years ago

I have create a patch for 1.2 that should fix this. For now, you may wish to apply the PR #1434 to your 1.1.36 system.

MarcHagen commented 6 years ago

After changing that line i got stuck polling processes loop infinitely and producing big log files.

11-Mar-2018 13:36:17 - CMDPHP PHP ERROR WARNING Backtrace: (/poller_boost.php: 166 dsstats_boost_bottom)(/lib/dsstats.php: 708 dsstats_get_and_store_ds_avgpeak_values)(/lib/dsstats.php: 71 dsstats_obtain_data_source_avgpeak_values)(/lib/dsstats.php: 173 dsstats_rrdtool_execute)(/lib/dsstats.php: 808 feof)(CactiErrorHandler)(/lib/functions.php: 4586 cacti_debug_backtrace)
11-Mar-2018 13:36:17 - ERROR PHP WARNING: feof() expects parameter 1 to be resource, null given in file: /usr/share/cacti/lib/dsstats.php on line: 808
11-Mar-2018 13:36:17 - CMDPHP PHP ERROR WARNING Backtrace: (/poller_boost.php: 166 dsstats_boost_bottom)(/lib/dsstats.php: 708 dsstats_get_and_store_ds_avgpeak_values)(/lib/dsstats.php: 71 dsstats_obtain_data_source_avgpeak_values)(/lib/dsstats.php: 173 dsstats_rrdtool_execute)(/lib/dsstats.php: 809 fgets)(CactiErrorHandler)(/lib/functions.php: 4586 cacti_debug_backtrace)
11-Mar-2018 13:36:17 - ERROR PHP WARNING: fgets() expects parameter 1 to be resource, null given in file: /usr/share/cacti/lib/dsstats.php on line: 809

In my case $use_proxy is false and file_exists() true. This is due to https://github.com/Cacti/cacti/blob/5bc95d0f76125b43190d2953bae34b1d4345987e/lib/dsstats.php#L55 uses the same wrong usage of comparing a string to an integer

Because of that the $process_pipes are not populated correctly

netniV commented 6 years ago

Can you open that as a separate issue so that it can be patched too.