I'm in a very similar situation and have found a round about way to do rrd fetches through the Zope interface. It requires some set up though so stick with me...
At the Zope interface (http://ZENOSSDEVICE:PORT/zport/dmd/Devices/manage) add the Python script titled getData: Code: #device="localhost", metric="sysUpTime", start=1800, function="AVERAGE" list = [] for d in context.getSubDevices(): if d.id == device: list.append(d.id) for rt in d.getRRDTemplate().getRRDDataPoints(): if rt.getId() == metric: list.append(rt.getId()) fullfilename = d.fullRRDPath() + "/" + rt.name() + ".rrd" fopts = [] fopts.append("%s" % fullfilename) fopts.append("%s" % function) fopts.append("--start=%d" % (context.getTime() - start)) fopts.append("--end=%d" % context.getTime()) fetch = d.rrdFetch(*fopts) for k in fetch[0]: list.append(k) for f, in fetch[2]: if f == None: list.append(-1.0) else: list.append(f) return list The parameter list in the comment line at the top. Now what this script does is take a device, a metric, and a time and return data points for that metric back that much time. However, Zope won't let you execute some commands for security reasons (such as time.time() or rrdFetch()), so we need to add some external methods... In your ZENHOME/Extensions folder add the following python files: rrdHelper.py Code: import rrdtool def rrdFetch(file, function, start, end): return rrdtool.fetch(file, function, start, end) time.py Code: import time def getTime(): return time.time() Then in the Zope interface add the external methods... 1. Id: rrdFetch Module Name: rrdHelper Function Name: rrdFetch 2. Id: getTime Module Name: time Function Name: getTime Now, back to that original python script, the default parameter values are provided, so if you have the device "localhost" somewhere in your Zenoss device tree, you should be able to go to the URL http://ZENOSSDEVICE:PORT/zport/dmd/Devices/getData and get some data straight out of the rrd file ZENHOME/Devices/localhost/sysUpTime_sysUpTime.rrd So pick your favorite language, point your xmlrpc at http://ZENOSSDEVICE:PORT/zport/dmd/Devices/ and call getData(device, metric, time). You can do a great deal using Zope scripts including managing events and thresholds as well if you can't find the function you want directly in the API. -------------------- m2f -------------------- Read this topic online here: http://community.zenoss.com/forums/viewtopic.php?p=14279#14279 -------------------- m2f -------------------- _______________________________________________ zenoss-users mailing list [email protected] http://lists.zenoss.org/mailman/listinfo/zenoss-users
