Aggregated metric values can be queried similar to the instantaneous values either from JDL, from within a policy/event constraint, or from an array of multiple metrics values. This section includes the following information:
r = getMatrix().getResource(“local_vmhost”) print "resource.id: %s" % (r.getFact("resource.id")) print "load_one.10_minute.average: %s" % ( r.getFact("resource.metrics.load_one.10_minute.average") )
<event> <context> <vmhost /> </context> <trigger> <gt fact="vmhost.vm.count" value="0" /> <gt fact="vmhost.resource.metrics.load_one.10_minute.average" value="2" /> </trigger> <reset> <lt fact="vmhost.resource.metrics.load_one.10_minute.average" value=".5" /> </reset> </event>
The consolidation functions (AVERAGE,MAX, and MIN) are supported for each defined aggregation period. In RRD terminology, this means that for each metric, there are three RRAs defined for each “period” element in the .metric deployable definition.
You can query for an array of “raw” values that constitute the aggregated datapoints for a given RRA within the RRD data structure by appending .values to the factname representing the metric (and period) of interest. For example, to print all the MIN values collected for the 10_minute aggregation period, the JDL is
r = getMatrix().getResource(“local_vmhost”) print "resource.id: %s" % (r.getFact("resource.id")) print "load_one.10_minute.min.values: %s" % ( r.getFact("resource.metrics.load_one.10_minute.min.values") )
Similarly, to print the array of AVERAGE and MAX values collected, the JDL is
print "load_one.10_minute.average.values: %s" % ( r.getFact("resource.metrics.load_one.10_minute.average.values") ) print "load_one.10_minute.max.values: %s" % ( r.getFact("resource.metrics.load_one.10_minute.max.values") )