/*
Search for events from the channel 'cpu.system' and
log a corresponding message whenever the value is higher than 25%
*/
@Execute(context=ExecutionContext.PRESELECTION, description="My description")
def dumpHighCPU(List<RuntimeEvent<?>> events) {
events.filterByChannelName('cpu.system').filter[value as Double > 25.0].forEach[
consolePrintln("High CPU Load at "+new Date(timestamp/1000))
]
}