Are your memory threshold events hard to understand and ugly?
Changing Memory Threshold Events to Display % Used
The default memory utilization threshold events for Linux systems in Zenoss can be hard to understand. They will show you the current value as the number of kBytes free instead of the percentage used. You can fix this by applying a single event class transform on the /Perf/Memory event class by following the steps below.
Creating the Event Class Transform
Follow these steps to create the event class transform.
- Go to /Events/Perf/Memory in the web interface.
- Click the menu and choose More -> Transform.
- Paste the code below into the Transform box.
- Click Save.
- Move any existing memory threshold events to history.
import re
match = re.search('threshold of Free Memory [^:]+: current value ([\d\.]+)', evt.message)
if match and device:
avail = float(match.groups()[0]) * 1024
total = device.hw.totalMemory
percent_used = (1 - (avail / total)) * 100
evt.summary = "Memory threshold exceeded: current value %3.1f%%" % (percent_used)
Results
The memory threshold event would have originally looked liked this:
threshold of Free Memory not met: current value 626704.00
After this transform is applied it will now look like this:
Memory threshold exceeded: current value 86.3%