This is a great solution, but it suffers from a subtle but serious problem that
will wreak havoc with a distrbuted collector setup. The call to f.usedBytes()
within the transform will make an XML-RPC call to the collector responsible for
this device to get the last polled usedBytes. This causes a problem with
distribtued collector setups because the event transform will be evaluated
within the zenhub daemon, which is also responsible for handling this XML-RPC
request. So what ends up happening is that zenhub blocks because it is to busy
asking for the information to respond with it.
Long-winded explanation aside, there is a better way. You can extract the
current usedBlocks from the summary of the message so we don't have to run
through this XML-RPC nonsense. Take a look at your transform below that has
been altered to use this mechanism instead. Please note that I haven't actually
tested this, but it should at least be enough to get you going.
If you don't have distributed collectors you may also want to take this
approach because it performs better. The reason being is that it doesn't have
to again look into the RRD file for the current value of usedBlocks.
Code:
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
-------------------- m2f --------------------
Read this topic online here:
http://forums.zenoss.com/viewtopic.php?p=25729#25729
-------------------- m2f --------------------
_______________________________________________
zenoss-users mailing list
[email protected]
http://lists.zenoss.org/mailman/listinfo/zenoss-users