Transforms - Nice CPU Usage Events
From Zenoss Wiki
There are plenty of additional ways to match these events, this is one of the simplest:
Event Class: Perf > CPU
Linux and Windows CPU
# Converts Linux and Windows CPU to a percentage. This is assuming ssCpuIdle is being used for the Linux threshold import re regex = re.search('threshold of .*(CPU).* (exceeded|restored|not met): current value ([\d\.]+)', evt.message, re.I) if regex and device and device.getDeviceClassPath().startswith("/Server/SSH/Linux"): lincpu = re.search("current value ([\d\.]+)", evt.summary) if lincpu: currentcpu = 100 - float(lincpu.group(1)) evt.component = "CPU" evt.summary = "High CPU Utilization: Currently %3.0f%%" % (currentcpu) evt.message = evt.summary if regex and device and device.getDeviceClassPath().startswith("/Server/Windows"): wincpu = re.search("current value ([\d\.]+)", evt.summary) if wincpu: currentcpu = float(wincpu.group(1)) evt.component = "CPU" evt.summary = "High CPU Utilization: Currently %3.0f%%" % (currentcpu) evt.message = evt.summary
Linux Load
# Converts Linux high load events into a prettier message import re if evt.summary.startswith('threshold of high load'): load = re.search("current value ([\d\.]+)", evt.summary) if load: currentload = float(load.group(1)) evt.component = "CPU" evt.summary = "High CPU Load: Currently %2.2f" % (currentload) evt.message = evt.summary