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

Transform Swap Threshold Events to a more friendly format

VERSION 1 
Created on: Sep 1, 2010 10:57 AM by Dave Ta - Last Modified:  Sep 1, 2010 11:07 AM by Dave Ta

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)

Comments (2)

More Like This

  • Retrieving data ...

More by Dave Ta