Saturday, April 05, 2008

Zenoss Percentage Used for /Perf/Filesystem events

By default, Zenoss does not show the percentage of the filesystem used when showing disk space events (/Perf/Filesystem). The approach detailed below (also on the Zenoss Wiki) does the following:
  • Shows both the percentage used in the event summary as well as the amount of free space remaining in GB
  • Changes the event severity to critical (red) when the percentage free is 5% or less

Access http://:8080/zport/dmd/Events/Perf/Filesystem and enter the following for the transform:

fs_id = device.prepId(evt.component)
for f in device.os.filesystems():
    if != fs_id: continue
    p = (float(f.usedBytes()) / f.totalBytes()) * 100
    freeAmtGB = (float(f.totalBytes() - f.usedBytes())) / 1024 / 1024 / 1024
    evt.summary = "Disk space low: %3.1f%% used (%3.2f GB free)" % (p, freeAmtGB)
    if p >= 95.0: evt.severity = 5

No comments:

Post a Comment