Forum Discussion
Anonymous
12 months 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
- 4 months ago
- 4 months ago
- 8 months ago