Cacti / plugin_thold

Thold Plugin for Cacti

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rrd_maximum values instead of ifspeed or ifHighspeed

Azhnm2006 opened this issue · comments

Describe the bug
I was planning to use the rrd_maximum option instead of the query ifsepeed or ifHighspeed.; however the results show not correct value as the return value was the MAX value for the current value from rrd file based on the get_current_value function. i have to use the rrd_maximum as i have different limit on my rrd file rather than the speed. I used the latest develop release from github however the values are not correct. After adding the debug and traces to show the values i was able to figure out where is the problem. the problem was on the DS_CURRWNT_MAX VALUE section which is calling get_current_value function. i have modified the script in easy way to match my requirements. please check below modification and validate my update if possible.

**case 'CURRENT_DS_MAXIMUM_VALUE':
#################################################### Modified by Hamed#######################################
//array_push($stack, get_current_value($local_data_id, 'rrd_maximum'));
$rrd = 0;
$MAX_VALUE = db_fetch_assoc_prepared('SELECT rrd_maximum
FROM data_template_rrd
WHERE local_data_id = ? and (data_source_name = "traffic_in" or data_source_name = "traffic_out")',
array($local_data_id));

            if (cacti_sizeof($MAX_VALUE)) {
                    foreach ($MAX_VALUE as $MAX) {
                            $rrd =  $MAX['rrd_maximum'];
                    }
            }

           // cacti_log(" this is expected rrd_maxi value $rrd", false, 'THOLD');

            array_push($stack, $rrd);
            break;**

To Reproduce
Steps to reproduce the behavior:
to to follow this RPN and check your results. with original code will give wrong value.

CURRENT_DATA_SOURCE,8,,CURRENT_DS_MAXIMUM_VALUE,1,/,100,

Expected behavior
after code change it will give the correct values.

Screenshots
If applicable, add screenshots to help explain your problem.

Plugin (please complete the following information):

  • Version: latest develop code
  • Source: [ github]

Pull request please.

Thanks for update, unfortunately I don't have privilege to do any change on code or creat any fork. I opened it as issue only and share it to other as might others face the same issue. The solution I provided is customized to my case only. You can proceed as pull from your side.

This sounds more like a feature request don't you think?

agreed should be like that.but based on history i can see that was requested by many other before.