Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


Data Query - VALUE/MATH addition to source type

 
Post new topic   Reply to topic    Cacti Forum Index -> Feature Requests
Author Message
llow
Cacti User


Joined: 05 Oct 2007
Posts: 88

PostPosted: Fri Oct 05, 2007 5:38 pm    Post subject: Data Query - VALUE/MATH addition to source type Reply with quote

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.



cacti-0.8.6j-data_query_value_math.patch
 Description:
cacti-0.8.6j-data_query_value_math.patch

Download
 Filename:  cacti-0.8.6j-data_query_value_math.patch
 Filesize:  1.25 KB
 Downloaded:  60 Time(s)

Back to top
gandalf
Developer


Joined: 02 Dec 2004
Posts: 12275
Location: Muenster, Germany

PostPosted: Sat Oct 06, 2007 5:54 am    Post subject: Reply with quote

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
Back to top
llow
Cacti User


Joined: 05 Oct 2007
Posts: 88

PostPosted: Sat Oct 06, 2007 11:57 am    Post subject: Reply with quote

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.
Back to top
gandalf
Developer


Joined: 02 Dec 2004
Posts: 12275
Location: Muenster, Germany

PostPosted: Sat Oct 06, 2007 1:55 pm    Post subject: Reply with quote

Please have a look at the changelog of 087. If I remember correctly, CDEFs are allowed with GPRINTs, then
Reinhard
Back to top
llow
Cacti User


Joined: 05 Oct 2007
Posts: 88

PostPosted: Mon Oct 08, 2007 11:08 am    Post subject: Reply with quote

RRDTool 1.2.23 won't allow a CDEF with just values though. Storing a single unchanging value in the RRD file seems like a waste.
Back to top
llow
Cacti User


Joined: 05 Oct 2007
Posts: 88

PostPosted: Fri Oct 12, 2007 2:20 pm    Post subject: Reply with quote

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.



cacti-0.8.6j-data_query_value_math_v2.patch
 Description:

Download
 Filename:  cacti-0.8.6j-data_query_value_math_v2.patch
 Filesize:  1.3 KB
 Downloaded:  87 Time(s)

Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Feature Requests All times are GMT - 5 Hours
Page 1 of 1

 



Powered by phpBB © 2001, 2005 phpBB Group