Forum Discussion
Anonymous
2 years agoHi ,
Groovy Script For Complex DataPoint
import com.santaba.agent.groovyapi.api.DataCollectionAPI
def dataPointName = "Running"
def day = System.currentTimeMillis() - 1 * 24 * 60 * 60 * 1000
def historicalData = DataCollectionAPI.getHistoricalData(dataPointName,day, System.currentTimeMillis())
def maxRunningWithinWeek = historicalData.max()
return maxRunningWithinWeek
You could use collector script caching to remember the previous week’s values. Add the current value to that list, find the max and output it. Given the number of poll cycles in a week, you’d size your list accordingly so when you add a new point if the total size of the list is more than a week, you’d just drop the oldest value.
Related Content
- 6 months ago
- 6 months ago
- 10 months ago