I want to calculate the percentage of usage of some features of my host, by RRD queries.(I have Cacti installed and Cacti stores the monitoring data in RRD).
For example if there is 1 GB total swap memory and now I have used 250 MB, the return value of my query should be 0.25
or as another example, if the total bandwidth of network is 200 and now 100 is used, the desired return value is 0.50
My questions are:
1) can RRD tell me these total values (total memory of host or total network bandwidth)?
2) Which query syntax can returns such percentages as described in examples?
If my questions are not obvious, I can describe more. if anyone can point me to some good documentation on RRD to figure this out myself or if anyone can give me a good start it would be greatly appreciated.
For calculations in rrdtool you can use CDEF expressions when drawing graphs or in rrdtool xport commands.
CDEF:perc=x,200,/
The expressions are based on reversed polish notation and documented in man rrdgraph_data
.
In this example:
perc
is the name of the new computed field=
is an expression in reversed polish notation meaning x/200