Event transforms. For example, in /Perf/Filesystem:
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])
    p = (usedBlocks / f.totalBlocks) * 100
    freeAmtGB = ((f.totalBlocks - usedBlocks) * f.blockSize) / 1073741824

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

    # This is where we change to a per device threshold
    perDeviceThreshold = 95.0
    m = re.search("zz(\d{3})", f.id)
    perDeviceThreshold = m and float(m.groups()[0]) or 95.0
    if p >= perDeviceThreshold: evt.severity = 5
    break
--
James Pulver
Information Technology Area Supervisor
LEPP Computer Group
Cornell University



dveezy wrote, On 7/30/2009 4:51 PM:
> How would I edit the alert templates to make the email notification alerts 
> that are sent say 
> 
> currentvalue 95%
> 
> 
> for example instead of saying xxxxxx referring to amount of bytes being 
> actually used like it is doing by default?
> 
> Thank you.
> 
> 
> 
> 
> -------------------- m2f --------------------
> 
> Read this topic online here:
> http://forums.zenoss.com/viewtopic.php?p=37475#37475
> 
> -------------------- m2f --------------------
> 
> 
> 
> _______________________________________________
> zenoss-users mailing list
> [email protected]
> http://lists.zenoss.org/mailman/listinfo/zenoss-users
_______________________________________________
zenoss-users mailing list
[email protected]
http://lists.zenoss.org/mailman/listinfo/zenoss-users

Reply via email to