A Zenoss installation with added devices that have CPU usage monitored.
- Zenoss 4.x
- Zenoss 3.x
- Zenoss 2.5.x
The following will convert your events generated by thresholds on CPU utilization to show the used value instead of the idle value.
Use the code block included below and paste it into your /Perf/Cpu event class transform field.
- To locate navigate to: Events -> Event Classes -> Perf -> Cpu.
- Select the action wheel at the bottom of the left side-bar.
- Choose Transform.
- Paste the code and click Save at the bottom of the code field. Now any events that display the default threshold name of 'low CPU idle' will contain both the percent used and percent idle in the message displayed.
import re m = re.search("threshold of low CPU idle not met: current value ([\d\.]+)", evt.message) currentValue = float(m.groups()) newValue = 100 - currentValue evt.summary = "threshold of low CPU idle not met: current value %3.1f%% used (%s idle)" % (newValue, currentValue) evt.message = evt.summary