This transform resides in /Events/Perf/Memory
import re
#match statement
match = re.search('threshold of low swap [^:]+: current value ([\d\.]+)', evt.message)
if match:
#extract available from the summary
avail = (float(match.groups()[0]) / 1024)
total = (device.os.totalSwap / 1048576)
#calculate used
used = (total - avail)
percent_used = (1 - (avail / total)) * 100
#Make a nicer summary
evt.message = "swap threshold exceeded: %3.1f%% used (used:%3.1fMB, free:%3.1fMB, total:%3.1fMB)" % (percent_used,used,avail,total)
evt.summary = "swap threshold exceeded: %3.1f%% used (used:%3.1fMB, free:%3.1fMB, total:%3.1fMB)" % (percent_used,used,avail,total)
old summary:
summary threshold of low swap not met: current value 460604.00
new summary after transform:
summary swap threshold exceeded: 12.0% used (used:61.2MB, free:449.8MB, total:511.0MB)