Archived community.zenoss.org | full text search
Skip navigation
Currently Being Moderated

Display Memory Threshold Events as a Percentage

VERSION 1 
Created on: Sep 14, 2009 11:21 AM by Noel Brockett - Last Modified:  Sep 14, 2009 11:21 AM by Noel Brockett

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.

  1. Go to /Events/Perf/Memory in the web interface.
  2. Click the menu and choose More -> Transform.
  3. Paste the code below into the Transform box.
  4. Click Save.
  5. 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%
Comments (0)