It would be nice to be able to do math operations on values from data queries. I have attached a patch to 0.8.6j that adds this functionality.
Usage: VALUE/MATH:<math operations>
Example: VALUE/MATH:/1000 will take the value from the snmp query and divide it by 1000
I am using eval which may not be the best idea.
Data Query - VALUE/MATH addition to source type
Moderators: Developers, Moderators
Data Query - VALUE/MATH addition to source type
- Attachments
-
- cacti-0.8.6j-data_query_value_math.patch
- cacti-0.8.6j-data_query_value_math.patch
- (1.25 KiB) Downloaded 294 times
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
Thank you for your effort.
I'd like to ask a question without having digged deeper into your code:
Did you already consider using a CDEF for calculations? If, why doesn't it fit?
And did you even consider using a COMPUTE data source? That's a feature of rrdtool 1.2.x not yet supported by cacti (but hopefully will be implemented soon).
Reinhard
I'd like to ask a question without having digged deeper into your code:
Did you already consider using a CDEF for calculations? If, why doesn't it fit?
And did you even consider using a COMPUTE data source? That's a feature of rrdtool 1.2.x not yet supported by cacti (but hopefully will be implemented soon).
Reinhard
The reason for this addition is for input data, not output. I was polling the voltage from a Cisco device and getting the Low and High threshold. These values are in minivolts but I want to display them in volts.
Without wasting resources storing these values in an RRD file I just made them input values and created HRULEs. Since you can't perform a CDEF without a data source that would not work.
I have not found any good information in the RRDTool docs about COMPUTE but I don't believe it would fit what I needed in this scenario.
I will also be looking into allowing variables in the upper and lower limits of the graph template so that I can be sure the HRULEs show.
Without wasting resources storing these values in an RRD file I just made them input values and created HRULEs. Since you can't perform a CDEF without a data source that would not work.
I have not found any good information in the RRDTool docs about COMPUTE but I don't believe it would fit what I needed in this scenario.
I will also be looking into allowing variables in the upper and lower limits of the graph template so that I can be sure the HRULEs show.
Fixed the patch so that it splits a value description from its value to do the math.
This patch will also apply against beta4 of 0.8.7.
This patch will also apply against beta4 of 0.8.7.
- Attachments
-
- cacti-0.8.6j-data_query_value_math_v2.patch
- (1.3 KiB) Downloaded 316 times
Who is online
Users browsing this forum: No registered users and 3 guests