Cacti / plugin_thold

Thold Plugin for Cacti
GNU General Public License v2.0
61 stars 60 forks source link

Fix#613 RPN expression value retrieval #623

Closed unka65 closed 10 months ago

unka65 commented 10 months ago

The threshold RPN help info looks good. Thank you.

The search for RPN expression data source values checks several sources but with my setup (no dsstats) does not find the value if the data source does not have a threshold. I have used these changes for years but with recent tweaks for the latest.

In function get_current_value() in a test, I added to compare the existing $result['values'][$idx][0] to my array_values($result['values'][$idx])[0]. They only ever differed (value was not in index 0) for the missing data sources, the reason for that change.

$value = array_values($result['values'][$idx])[0];
if ($value != $result['values'][$idx][0]) {
    cacti_log( "WARNING: " . __FILE__ . " " . __FUNCTION__ . ":" . __LINE__ . " data ID: " . $local_data_id . " base value '" . $result['values'][$idx][0] . "' not match new " . $value , false, 'THOLD' );
}

This has been a long outstanding issue for me. It would be great if it can somehow be resolved so that can update the plugin files without requiring modifications and not have to omit when submitting other fixes.

TheWitness commented 10 months ago

I'll need to review this one in a bit more detail this weekend.