Hello Jan-Frode, Thanks for the script!
-Trey On Feb 3, 2008 7:55 AM, Jan-Frode Myklebust <[EMAIL PROTECTED]> wrote: > On 2008-01-23, Trey Sheldon <[EMAIL PROTECTED]> wrote: > > > > Hmm, I hadn't thought of THAT location.. my first thought went to the > > "syslocation" snmp variable. Thanks for the other point of view! > > I plan on using the snmp syslocation to feed the zenoss /Location. But, > I'm not quite sure how to handle servers that span multiple rack slots > yet.. Also not sure if I should use the zenoss rackSlot variable, or > use /Locations/MyLocation/Rack5/Slot9-11 > > This script reads snmp syslocation (for Devices/Server/Linux-devices), > and if the format of it is "/Mylocation/RackX", then it enters this > into the zenoss "Location". > > ------------------------------------------------------------------------ > #! /usr/bin/env python > from xmlrpclib import ServerProxy > ZenossURL = 'http://admin:[EMAIL PROTECTED]:8080/' > deviceTree = ServerProxy(ZenossURL + > 'zport/dmd/Devices/Server/Linux/devices/') > for device in deviceTree.objectIds(): > node = ServerProxy(ZenossURL + > 'zport/dmd/Devices/Server/Linux/devices/' + device) > snmpLocation = node.getProperty('snmpLocation') > if snmpLocation[0] == '/': > if snmpLocation.split()[0] != node.getLocationName() : > print "Updating " + device + ' to '+ > snmpLocation.split()[0] > node.setLocation(snmpLocation.split()[0]) > else: > if node.getLocationName() != '/Unknown' : > print 'Setting ' + device + ' to /Unknown' > node.setLocation('/Unknown') > ------------------------------------------------------------------------ > > Ref: http://tanso.net/zenoss/python-xmlrpclib/ > > > > -jf > > _______________________________________________ > zenoss-users mailing list > [email protected] > http://lists.zenoss.org/mailman/listinfo/zenoss-users >
_______________________________________________ zenoss-users mailing list [email protected] http://lists.zenoss.org/mailman/listinfo/zenoss-users
