Skip navigation
Currently Being Moderated

Percentage Used for Filesystem Threshold - Improved

VERSION 1 
Created on: Sep 14, 2009 11:21 AM by Noel Brockett - Last Modified:  Sep 14, 2009 11:21 AM by Noel Brockett
Special thanks to the tip at http://www.zenoss.com/Members/netdata/show-the-usage-in-a-filesytem-threshold/ for helping me solve the problem with getting the percentage of used space shown in the /Perf/Filesystem events.

To this approach, I added the following:
- Calculation and display of the amount of free space in GB
- Changing the severity of the event to 'critical' (red) when the percentage of free space is 5% or less

The transform entered on http://<your Zenoss server>:8080/zport/dmd/Events/Perf/Filesystem becomes:

fs_id = device.prepId(evt.component)
for f in device.os.filesystems():
    if f.id != 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
    break
Comments (0)