Because a majority of our systems can have a standard threshold I ended up 
using the below as a transform, I got most of the code from another post I 
found within this forum.  The reason the 105% is there because we have seen 
admins remove mounts or change mounts around and it caused event that report 
300% used.  Also, I if someone can point out why the evt.summary in the > 105 
does not work.  Sorry, I am not a python coder.

import re

fs_id = device.prepId(evt.component)
for f in device.os.filesystems():
   if f.id != fs_id: continue

   # Extract the percent and free from the summary
   m = re.search("threshold of [^:]+: current value ([\d\.]+)", evt.summary)
   if not m: continue
   usedBlocks = float(m.groups()[0])
   per_used = (usedBlocks / f.totalBlocks) * 100

   freeAmtPer = 100-per_used

   # Make a nicer summary
   evt.summary = "Disk space low: %3.1f%% used (%3.2f%% free)" %  
(per_used,freeAmtPer) 

   if per_used > 105 and evt.severity == 5:
      evt.severity = 3
      evt.summary = "There was a problem checking a filesystem, %3.1%% was 
returned as being used" % (per_used)
   elif per_used >= 100 and evt.severity == 5: 
      evt.severity = 5
   elif per_used >= 98 and per_used < 100 and evt.severity == 4:
      evt.severity = 4
   elif per_used >= 90 and per_used < 98 and evt.severity == 3: 
      evt.severity = 3
   else:
      evt._action="drop"
   break




-------------------- m2f --------------------

Read this topic online here:
http://forums.zenoss.com/viewtopic.php?p=30163#30163

-------------------- m2f --------------------



_______________________________________________
zenoss-users mailing list
[email protected]
http://lists.zenoss.org/mailman/listinfo/zenoss-users

Reply via email to