On Mar 11, 2008, at 2:55 PM, jiml wrote:
I am (attempting) to use ZMI to run some queries. On the howto page http://www.zenoss.com/community/docs/howtos/get-a-list-of-device-names/ , it shows a couple examples:

return [ d.id for d in context.getSubDevices() ]
and
return [ d.manageIp for d in context.getSubDevices() ]

Both of which work great. Where can I find a list of attributes I can put in the script in place of id and manageIp. I am trying to come up with a script that will give me d.id (machine name) and d.??? (pingstatus), basically to look something like:

machine1  up
machine2 down
machine3 up

Try the following:

return [ "%s %s" % (d.id, d.getPingStatus() and "down" or "up") for d in context.getSubDevices() ]

The getPingStatus method on a device will return the current number of ping failures. So if it is 0 the device is currently up. "d" in these examples is a Device class object. You can look up all methods that are available on the Device class in the Zenoss API docs, specifically: http://www.zenoss.com/community/docs/zenoss-api-docs/2.1/ZenModel.Device.Device-class.html

_______________________________________________
zenoss-users mailing list
[email protected]
http://lists.zenoss.org/mailman/listinfo/zenoss-users

Reply via email to