You can subscribe to this list here.
2007 |
Jan
|
Feb
(65) |
Mar
(276) |
Apr
(544) |
May
(638) |
Jun
(225) |
Jul
(204) |
Aug
(294) |
Sep
(532) |
Oct
(506) |
Nov
(324) |
Dec
(359) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(208) |
Feb
(225) |
Mar
(248) |
Apr
(388) |
May
(222) |
Jun
(47) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <sv...@ze...> - 2007-04-13 13:54:51
|
Author: chris Date: 2007-04-13 09:54:51 -0400 (Fri, 13 Apr 2007) New Revision: 4645 Removed: tags/zenoss-1.1.2/ Log: removed. sliding tag for a change in zenoss.spec that doesn't blow away all of the nagios plugins |
From: <sv...@ze...> - 2007-04-13 13:53:46
|
Author: chris Date: 2007-04-13 09:53:43 -0400 (Fri, 13 Apr 2007) New Revision: 4644 Modified: branches/zenoss-1.1.x/inst/rpm/zenoss.spec Log: grep for perl files and don't just blow away all of /usr/local/zenoss/libexec Modified: branches/zenoss-1.1.x/inst/rpm/zenoss.spec =================================================================== --- branches/zenoss-1.1.x/inst/rpm/zenoss.spec 2007-04-13 13:52:38 UTC (rev 4643) +++ branches/zenoss-1.1.x/inst/rpm/zenoss.spec 2007-04-13 13:53:43 UTC (rev 4644) @@ -121,9 +121,9 @@ DIRNAME=${RPM_BUILD_ROOT}/${ZENHOME}/libexec for file in \ - `ls $DIRNAME | awk '{print $1}' | cut -d: -f1 | sort -u` + `grep perl $DIRNAME | awk '{print $1}' | cut -d: -f1 | sort -u` do - rm $DIRNAME/$file + rm -f $DIRNAME/$file done |
From: <sv...@ze...> - 2007-04-13 13:53:11
|
Author: chris Date: 2007-04-13 09:52:38 -0400 (Fri, 13 Apr 2007) New Revision: 4643 Modified: trunk/inst/rpm/zenoss.spec Log: grep for perl files and don't just blow away all of /usr/local/zenoss/libexec Modified: trunk/inst/rpm/zenoss.spec =================================================================== --- trunk/inst/rpm/zenoss.spec 2007-04-13 13:25:03 UTC (rev 4642) +++ trunk/inst/rpm/zenoss.spec 2007-04-13 13:52:38 UTC (rev 4643) @@ -121,9 +121,9 @@ DIRNAME=${RPM_BUILD_ROOT}/${ZENHOME}/libexec for file in \ - `ls $DIRNAME | awk '{print $1}' | cut -d: -f1 | sort -u` + `grep perl $DIRNAME | awk '{print $1}' | cut -d: -f1 | sort -u` do - rm $DIRNAME/$file + rm -f $DIRNAME/$file done |
From: <sv...@ze...> - 2007-04-13 13:25:04
|
Author: marc Date: 2007-04-13 09:25:03 -0400 (Fri, 13 Apr 2007) New Revision: 4642 Modified: trunk/Products/ZenEvents/MySqlSendEvent.py Log: #1121 * Now getting zprop from dmd.Devices Modified: trunk/Products/ZenEvents/MySqlSendEvent.py =================================================================== --- trunk/Products/ZenEvents/MySqlSendEvent.py 2007-04-13 13:24:40 UTC (rev 4641) +++ trunk/Products/ZenEvents/MySqlSendEvent.py 2007-04-13 13:25:03 UTC (rev 4642) @@ -117,7 +117,7 @@ execute(curs, self.buildDetailInsert(evid, detaildata)) if rescount != 1: sql = ('select evid from %s where dedupid="%s"' % ( - event._action, decode(self, event.dedupid))) + event._action, decode(self.dmd.Devices, event.dedupid))) execute(curs, sql) rs = curs.fetchone() if rs: @@ -231,7 +231,7 @@ if statusdata.has_key('prodState'): insert += "prodState=%d," % statusdata['prodState'] insert += "summary='%s',%s=%s+1,%s=%.3f" % ( - self.escape(decode(self, statusdata.get('summary',''))), + self.escape(decode(self.dmd.Devices, statusdata.get('summary',''))), self.countField, self.countField, self.lastTimeField,statusdata['lastTime']) return insert |
From: <sv...@ze...> - 2007-04-13 13:24:45
|
Author: jstevens Date: 2007-04-13 09:24:40 -0400 (Fri, 13 Apr 2007) New Revision: 4641 Added: trunk/Products/ZenModel/BasicDataSource.py trunk/Products/ZenModel/migrate/zenpackdatasources.py trunk/Products/ZenModel/skins/zenmodel/editBasicDataSource.pt Modified: trunk/Products/ZenModel/RRDDataSource.py trunk/Products/ZenModel/RRDTemplate.py trunk/Products/ZenModel/data/devices.xml trunk/Products/ZenModel/migrate/__init__.py trunk/Products/ZenModel/skins/zenmodel/editRRDDataSource.pt Log: Refactor of RRDDataSource. RRDDataSource is now subclassable by zenpacks. The traditional built-in datasource types are mostly handled in BaseDataSource now. * zenpackdatasources migrate script converts classes of current ds in zeo * devices.xml updated with new class specifications * datasource edit pages rejiggered a bit Added: trunk/Products/ZenModel/BasicDataSource.py Modified: trunk/Products/ZenModel/RRDDataSource.py =================================================================== --- trunk/Products/ZenModel/RRDDataSource.py 2007-04-13 13:19:21 UTC (rev 4640) +++ trunk/Products/ZenModel/RRDDataSource.py 2007-04-13 13:24:40 UTC (rev 4641) @@ -6,15 +6,10 @@ __doc__="""RRDDataSource -Defines attributes for how a datasource will be graphed -and builds the nessesary DEF and CDEF statements for it. +Base class for DataSources +""" -$Id: RRDDataSource.py,v 1.6 2003/06/03 18:47:49 edahl Exp $""" - -__version__ = "$Revision: 1.6 $"[11:-2] - import os -import md5 from Globals import DTMLFile from Globals import InitializeClass @@ -26,21 +21,22 @@ from Products.ZenUtils.ZenTales import talesCompile from Products.ZenRelations.RelSchema import * -from Products.ZenEvents.ZenEventClasses import Status_Web, Cmd_Fail from ZenModelRM import ZenModelRM from ZenPackable import ZenPackable -def manage_addRRDDataSource(context, id, REQUEST = None): - """make a RRDDataSource""" - ds = RRDDataSource(id) - context._setObject(ds.id, ds) - if REQUEST is not None: - REQUEST['RESPONSE'].redirect(context.absolute_url()+'/manage_main') +#def manage_addRRDDataSource(context, id, dsClassName, dsType, REQUEST = None): +# """make a RRDDataSource""" +# raise '####### HEY #####' +# for dsClass in +# ds = RRDDataSource(id) +# context._setObject(ds.id, ds) +# if REQUEST is not None: +# REQUEST['RESPONSE'].redirect(context.absolute_url()+'/manage_main') -addRRDDataSource = DTMLFile('dtml/addRRDDataSource',globals()) +#addRRDDataSource = DTMLFile('dtml/addRRDDataSource',globals()) def convertMethodParameter(value, type): @@ -53,40 +49,20 @@ else: raise TypeError('Unsupported method parameter type: %s' % type) -def checkOid(oid): - import string - for c in string.whitespace: - oid = oid.replace(c, '') - oid = oid.strip('.') - numbers = oid.split('.') - map(int, numbers) - if len(numbers) < 3: - raise ValueError("OID too short") - return oid +#class RRDDataSourceError(Exception): pass -class RRDDataSourceError(Exception): pass - class RRDDataSource(ZenModelRM, ZenPackable): meta_type = 'RRDDataSource' - sourcetypes = ('SNMP', 'XMLRPC', 'COMMAND', 'PAGECHECK') paramtypes = ('integer', 'string', 'float') - - sourcetype = 'SNMP' - oid = '' - xmlrpcURL = '' - xmlrpcUsername = '' - xmlrpcPassword = '' - xmlrpcMethodName = '' - # [[param1, int], [param2, string], ...] - xmlrpcMethodParameters = [] - + sourcetypes = () + + sourcetype = None enabled = True - usessh = False component = '' eventClass = '' eventKey = '' @@ -94,36 +70,16 @@ commandTemplate = "" cycletime = 300 - # PAGECHECK-specific attrs - userAgent = '' - recording = None - initialURL = '' - commandHash = '' - _properties = ( {'id':'sourcetype', 'type':'selection', 'select_variable' : 'sourcetypes', 'mode':'w'}, - {'id':'oid', 'type':'string', 'mode':'w'}, - {'id':'xmlrpcURL', 'type':'string', 'mode':'w'}, - {'id':'xmlrpcUsername', 'type':'string', 'mode':'w'}, - {'id':'xmlrpcPassword', 'type':'string', 'mode':'w'}, - {'id':'xmlrpcMethodName', 'type':'string', 'mode':'w'}, - {'id':'xmlrpcMethodParameters', 'type':'lines', 'mode':'w'}, - {'id':'enabled', 'type':'boolean', 'mode':'w'}, - {'id':'usessh', 'type':'boolean', 'mode':'w'}, {'id':'component', 'type':'string', 'mode':'w'}, {'id':'eventClass', 'type':'string', 'mode':'w'}, {'id':'eventKey', 'type':'string', 'mode':'w'}, {'id':'severity', 'type':'int', 'mode':'w'}, {'id':'commandTemplate', 'type':'string', 'mode':'w'}, {'id':'cycletime', 'type':'int', 'mode':'w'}, - - # PAGECHECK-specific props - {'id':'userAgent', 'type':'string', 'mode':'w'}, - {'id':'recording', 'type':'file', 'mode':'w'}, - {'id':'initialURL', 'type':'string', 'mode':'w'}, - ) _relations = ZenPackable._relations + ( @@ -148,7 +104,7 @@ security = ClassSecurityInfo() - + def breadCrumbs(self, terminator='dmd'): """Return the breadcrumb links for this object add ActionRules list. [('url','id'), ...] @@ -157,40 +113,11 @@ crumbs = super(RRDDataSource, self).breadCrumbs(terminator) return crumbspath(self.rrdTemplate(), crumbs, -2) - def getCommandHash(self): - """The hash is used to generate unique ids and file names.""" - md5hash = md5.new() - md5hash.update(self.commandTemplate) - return md5hash.hexdigest() - def getOidOrUrl(self): - if self.sourcetype == "SNMP": - return self.oid - if self.sourcetype == "XMLRPC": - return self.xmlrpcURL+" ("+self.xmlrpcMethodName+")" - if self.sourcetype == "COMMAND": - if self.usessh: - return self.commandTemplate + " over SSH" - else: - return self.commandTemplate - if self.sourcetype == 'PAGECHECK': - md5hash = self.getCommandHash() - url = "%s#%s" % (self.initialURL, md5hash) - return url + def getDescription(self): return None - def getXmlRpcMethodParameters(self): - """Return the list of all parameters as a list. - ["param1 (type)", "param2 (type)", ...] - """ - params = [] - for param in self.xmlrpcMethodParameters: - p = "%s (%s)" % (param[0], param[1]) - params.append(p) - return params - - def getRRDDataPoints(self): return self.datapoints() @@ -202,8 +129,13 @@ from Products.ZenModel.RRDDataPoint import RRDDataPoint dp = RRDDataPoint(id) self.datapoints._setObject(dp.id, dp) - if REQUEST: + if REQUEST: + if dp: + #REQUEST['message'] = "Command Added" + url = '%s/datapoints/%s' % (self.getPrimaryUrlPath(), dp.id) + REQUEST['RESPONSE'].redirect(url) return self.callZenScreen(REQUEST) + return dp def manage_deleteRRDDataPoints(self, ids=(), REQUEST=None): @@ -252,52 +184,20 @@ res = compiled(getEngine().getContext(environ)) if isinstance(res, Exception): raise res - if self.sourcetype == 'PAGECHECK': - exp = "string:" + self.initialURL - compiled = talesCompile(exp) - initialURL = compiled(getEngine().getContext(environ)) - if isinstance(initialURL, Exception): - raise initialURL - go = "go %s\n" % initialURL - if self.userAgent: - go += 'agent "%s"\n' % self.userAgent - res = go + res - elif not res.startswith('/') and not res.startswith('$'): - if not res.startswith(context.zCommandPath): - res = os.path.join(context.zCommandPath, res) + res = self.checkCommandPrefix(context, res) return res + def checkCommandPrefix(self, context, cmd): + if not cmd.startswith('/') and not cmd.startswith('$'): + if not cmd.startswith(context.zCommandPath): + cmd = os.path.join(context.zCommandPath, cmd) + return cmd + + def getSeverityString(self): return self.ZenEventManager.getSeverityString(self.severity) def zmanage_editProperties(self, REQUEST=None): - 'add some validation' - if REQUEST: - oid = REQUEST.get('oid', '') - if oid: - REQUEST.form['oid'] = checkOid(oid) - # convert recording to twill-sh commands; there's no need to save - # the TestGen4Web XML file in the ZODB - if REQUEST.get('sourcetype') == 'COMMAND': - if REQUEST.form.get('eventClass', '/') == '/': - REQUEST.form['eventClass'] = Cmd_Fail - recording = REQUEST.get('recording') - if recording: - from testgen import twillshell - data = recording.read() - initialURL = twillshell.getInitialURL(data) - commands = twillshell.getTwillShellCommands(data, - userAgent=False, debug=False, initialGo=False) - REQUEST.form['initialURL'] = initialURL - REQUEST.form['commandTemplate'] = commands - REQUEST.form['recording'] = '' - # ensure that PAGECHECK has the default datapoint - if REQUEST.get('sourcetype') == 'PAGECHECK': - if not hasattr(self.datapoints, 'totalTime'): - self.manage_addRRDDataPoint('totalTime') - # and eventClass - if REQUEST.form.get('eventClass', '/') == '/': - REQUEST.form['eventClass'] = Status_Web return ZenModelRM.zmanage_editProperties(self, REQUEST) Modified: trunk/Products/ZenModel/RRDTemplate.py =================================================================== --- trunk/Products/ZenModel/RRDTemplate.py 2007-04-13 13:19:21 UTC (rev 4640) +++ trunk/Products/ZenModel/RRDTemplate.py 2007-04-13 13:24:40 UTC (rev 4641) @@ -12,13 +12,13 @@ from ZenModelRM import ZenModelRM from Products.ZenRelations.RelSchema import * - +import Products.ZenModel.RRDDataSource as RRDDataSource +from Products.ZenModel.BasicDataSource import BasicDataSource +from Products.ZenModel.ConfigurationError import ConfigurationError from RRDDataPoint import SEPARATOR from ZenPackable import ZenPackable -class ConfigurationError(Exception): pass - def manage_addRRDTemplate(context, id, REQUEST = None): """make a RRDTemplate""" tt = RRDTemplate(id) @@ -155,15 +155,20 @@ security.declareProtected('Add DMD Objects', 'manage_addRRDDataSource') - def manage_addRRDDataSource(self, id, REQUEST=None): + def manage_addRRDDataSource(self, id, dsOption, REQUEST=None): """Add an RRDDataSource to this DeviceClass. """ - from RRDDataSource import RRDDataSource - if not id: return self.callZenScreen(REQUEST) - org = RRDDataSource(id) - self.datasources._setObject(org.id, org) + ds = None + if id and dsOption: + ds = self.getDataSourceInstance(id, dsOption) + self.datasources._setObject(ds.id, ds) if REQUEST: + if ds: + #REQUEST['message'] = "DataSource Added" + url = '%s/datasources/%s' % (self.getPrimaryUrlPath(), ds.id) + REQUEST['RESPONSE'].redirect(url) return self.callZenScreen(REQUEST) + return ds security.declareProtected('Add Method Parameter', 'manage_addMethodParameter') @@ -173,7 +178,7 @@ if not paramValue: return ds = self.datasources._getOb(newId) try: - from RRDDataSource import convertMethodParameter + #from RRDDataSource import convertMethodParameter convertMethodParameter(paramValue, paramType) except ValueError: REQUEST['message'] = "ERROR: %s could not be stored as type: %s" % (paramValue, paramType) @@ -245,7 +250,12 @@ org = RRDThreshold(id) self.thresholds._setObject(org.id, org) if REQUEST: + if org: + #REQUEST['message'] = "Threshold Added" + url = '%s/thresholds/%s' % (self.getPrimaryUrlPath(), org.id) + REQUEST['RESPONSE'].redirect(url) return self.callZenScreen(REQUEST) + return org def manage_deleteRRDThresholds(self, ids=(), REQUEST=None): @@ -268,12 +278,18 @@ graphs = self.getGraphs() if len(graphs) > 0: nextseq = graphs[-1].sequence + 1 + graph = None if id: graph = RRDGraph(id) graph.sequence = nextseq self.graphs._setObject(graph.id, graph) if REQUEST: + if graph: + #REQUEST['message'] = "Graph Added" + url = '%s/graphs/%s' % (self.getPrimaryUrlPath(), graph.id) + REQUEST['RESPONSE'].redirect(url) return self.callZenScreen(REQUEST) + return graph security.declareProtected('Manage DMD', 'manage_deleteRRDGraphs') @@ -307,6 +323,38 @@ if REQUEST: return self.callZenScreen(REQUEST) + + def getDataSourceClasses(self): + dsClasses = [BasicDataSource] + for zp in self.dmd.packs(): + dsClasses += zp.getDataSourceClasses() + return dsClasses + + def getDataSourceOptions(self): + ''' Returns a list of the available datasource options as a list + of (display name, dsOption) + ''' + dsTypes = [] + for dsClass in self.getDataSourceClasses(): + dsTypes += [(t, '%s.%s' % (dsClass.__name__, t)) + for t in dsClass.sourcetypes] + return dsTypes + + def getDataSourceInstance(self, id, dsOption): + ''' Given one of the dsOptions returned by getDataSourceOptions) + return an instance of the that RRDDataSource subclass. + ''' + dsClassName, dsType = dsOption.split('.') + for c in self.getDataSourceClasses(): + if dsClassName == c.__name__: + ds = c(id) + ds.sourcetype = dsType + break + else: + raise ConfigurationError('Cannot find datasource class' + ' for %s' % dsOption) + return ds + InitializeClass(RRDTemplate) Modified: trunk/Products/ZenModel/data/devices.xml =================================================================== --- trunk/Products/ZenModel/data/devices.xml 2007-04-13 13:19:21 UTC (rev 4640) +++ trunk/Products/ZenModel/data/devices.xml 2007-04-13 13:24:40 UTC (rev 4641) @@ -124,7 +124,7 @@ Basic template that only collects sysUpTime. </property> <tomanycont id='datasources'> -<object id='sysUpTime' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='sysUpTime' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -171,7 +171,7 @@ Monitors for OSProcess object </property> <tomanycont id='datasources'> -<object id='cpu' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='cpu' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -207,7 +207,7 @@ </object> </tomanycont> </object> -<object id='mem' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='mem' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -339,7 +339,7 @@ Standard ethernet interface template with 75% utilization threshold </property> <tomanycont id='datasources'> -<object id='ifInErrors' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='ifInErrors' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -376,7 +376,7 @@ </object> </tomanycont> </object> -<object id='ifInOctets' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='ifInOctets' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -416,7 +416,7 @@ </object> </tomanycont> </object> -<object id='ifInUcastPackets' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='ifInUcastPackets' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -453,7 +453,7 @@ </object> </tomanycont> </object> -<object id='ifOperStatus' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='ifOperStatus' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -489,7 +489,7 @@ </object> </tomanycont> </object> -<object id='ifOutErrors' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='ifOutErrors' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -526,7 +526,7 @@ </object> </tomanycont> </object> -<object id='ifOutOctets' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='ifOutOctets' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -566,7 +566,7 @@ </object> </tomanycont> </object> -<object id='ifOutUcastPackets' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='ifOutUcastPackets' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -766,7 +766,7 @@ Standard ethernet interface template with 75% utilization threshold </property> <tomanycont id='datasources'> -<object id='ifInErrors' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='ifInErrors' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -803,7 +803,7 @@ </object> </tomanycont> </object> -<object id='ifInOctets' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='ifInOctets' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -843,7 +843,7 @@ </object> </tomanycont> </object> -<object id='ifInUcastPackets' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='ifInUcastPackets' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -880,7 +880,7 @@ </object> </tomanycont> </object> -<object id='ifOperStatus' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='ifOperStatus' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -916,7 +916,7 @@ </object> </tomanycont> </object> -<object id='ifOutErrors' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='ifOutErrors' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -953,7 +953,7 @@ </object> </tomanycont> </object> -<object id='ifOutOctets' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='ifOutOctets' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -993,7 +993,7 @@ </object> </tomanycont> </object> -<object id='ifOutUcastPackets' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='ifOutUcastPackets' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -1217,7 +1217,7 @@ Cisco template that collects cpu, free mem, and temp </property> <tomanycont id='datasources'> -<object id='cpu5min' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='cpu5min' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -1253,7 +1253,7 @@ </object> </tomanycont> </object> -<object id='mem5minFree' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='mem5minFree' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -1289,7 +1289,7 @@ </object> </tomanycont> </object> -<object id='sysUpTime' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='sysUpTime' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -1325,7 +1325,7 @@ </object> </tomanycont> </object> -<object id='tempInlet' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='tempInlet' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -1361,7 +1361,7 @@ </object> </tomanycont> </object> -<object id='tempOutlet' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='tempOutlet' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -1522,7 +1522,7 @@ Cisco template that collects cpu and free memory </property> <tomanycont id='datasources'> -<object id='cpu5min' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='cpu5min' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -1558,7 +1558,7 @@ </object> </tomanycont> </object> -<object id='mem5minFree' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='mem5minFree' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -1594,7 +1594,7 @@ </object> </tomanycont> </object> -<object id='sysUpTime' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='sysUpTime' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -1757,7 +1757,7 @@ Net-SNMP template for late vintage unix device. Has CPU threshold. </property> <tomanycont id='datasources'> -<object id='laLoadInt5' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='laLoadInt5' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -1796,7 +1796,7 @@ </object> </tomanycont> </object> -<object id='memAvailReal' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='memAvailReal' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -1835,7 +1835,7 @@ </object> </tomanycont> </object> -<object id='memAvailSwap' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='memAvailSwap' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -1871,7 +1871,7 @@ </object> </tomanycont> </object> -<object id='memBuffer' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='memBuffer' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -1910,7 +1910,7 @@ </object> </tomanycont> </object> -<object id='memCached' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='memCached' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -1949,7 +1949,7 @@ </object> </tomanycont> </object> -<object id='ssCpuRawIdle' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='ssCpuRawIdle' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -1986,7 +1986,7 @@ </object> </tomanycont> </object> -<object id='ssCpuRawSystem' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='ssCpuRawSystem' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -2023,7 +2023,7 @@ </object> </tomanycont> </object> -<object id='ssCpuRawUser' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='ssCpuRawUser' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -2060,7 +2060,7 @@ </object> </tomanycont> </object> -<object id='ssCpuRawWait' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='ssCpuRawWait' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -2097,7 +2097,7 @@ </object> </tomanycont> </object> -<object id='sysUpTime' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='sysUpTime' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -2428,7 +2428,7 @@ Filesystem template that uses HOST-RESOURCES mib. Has a 90% threshold. </property> <tomanycont id='datasources'> -<object id='usedBlocks' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='usedBlocks' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -2552,7 +2552,7 @@ Net-SNMP template for late vintage unix device. Has CPU threshold. </property> <tomanycont id='datasources'> -<object id='laLoadInt5' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='laLoadInt5' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -2591,7 +2591,7 @@ </object> </tomanycont> </object> -<object id='memAvailReal' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='memAvailReal' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -2630,7 +2630,7 @@ </object> </tomanycont> </object> -<object id='memAvailSwap' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='memAvailSwap' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -2666,7 +2666,7 @@ </object> </tomanycont> </object> -<object id='memBuffer' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='memBuffer' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -2705,7 +2705,7 @@ </object> </tomanycont> </object> -<object id='memCached' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='memCached' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -2744,7 +2744,7 @@ </object> </tomanycont> </object> -<object id='ssCpuRawIdle' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='ssCpuRawIdle' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -2781,7 +2781,7 @@ </object> </tomanycont> </object> -<object id='ssCpuRawSystem' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='ssCpuRawSystem' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -2818,7 +2818,7 @@ </object> </tomanycont> </object> -<object id='ssCpuRawUser' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='ssCpuRawUser' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -2855,7 +2855,7 @@ </object> </tomanycont> </object> -<object id='ssCpuRawWait' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='ssCpuRawWait' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -2892,7 +2892,7 @@ </object> </tomanycont> </object> -<object id='sysUpTime' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='sysUpTime' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -3199,7 +3199,7 @@ ZenPlugin template for late vintage unix device. Has CPU threshold. </property> <tomanycont id='datasources'> -<object id='cpu' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='cpu' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > COMMAND </property> @@ -3401,7 +3401,7 @@ </object> </tomanycont> </object> -<object id='mem' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='mem' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > COMMAND </property> @@ -3524,7 +3524,7 @@ </object> </tomanycont> </object> -<object id='uptime' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='uptime' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > COMMAND </property> @@ -3814,7 +3814,7 @@ Filesystem template that uses nagios and zendisk.py </property> <tomanycont id='datasources'> -<object id='disk' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='disk' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > COMMAND </property> @@ -4053,7 +4053,7 @@ Monitors for OSProcess object </property> <tomanycont id='datasources'> -<object id='cpu' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='cpu' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > COMMAND </property> @@ -4093,7 +4093,7 @@ </object> </tomanycont> </object> -<object id='mem' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='mem' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > COMMAND </property> @@ -4229,7 +4229,7 @@ Standard ethernet interface template with 75% utilization threshold </property> <tomanycont id='datasources'> -<object id='intf' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='intf' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > COMMAND </property> @@ -4537,7 +4537,7 @@ Windows template that requires Informant MIB </property> <tomanycont id='datasources'> -<object id='cpuPercentProcessorTime' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='cpuPercentProcessorTime' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -4573,7 +4573,7 @@ </object> </tomanycont> </object> -<object id='memoryAvailableKBytes' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='memoryAvailableKBytes' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -4612,7 +4612,7 @@ </object> </tomanycont> </object> -<object id='memoryPagesPerSec' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='memoryPagesPerSec' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -4648,7 +4648,7 @@ </object> </tomanycont> </object> -<object id='sysUpTime' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='sysUpTime' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -4847,7 +4847,7 @@ HardDisk I/O template that requries Informat MIB </property> <tomanycont id='datasources'> -<object id='lDiskDiskReadBytesPerSec' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='lDiskDiskReadBytesPerSec' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -4883,7 +4883,7 @@ </object> </tomanycont> </object> -<object id='lDiskDiskWriteBytesPerSec' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='lDiskDiskWriteBytesPerSec' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -4980,7 +4980,7 @@ ZenPlugin template for late vintage unix device. Has CPU threshold. </property> <tomanycont id='datasources'> -<object id='cpu' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='cpu' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > COMMAND </property> @@ -5182,7 +5182,7 @@ </object> </tomanycont> </object> -<object id='mem' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='mem' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > COMMAND </property> @@ -5544,7 +5544,7 @@ APC Device Profile that tracks battery capacity, load and runtime </property> <tomanycont id='datasources'> -<object id='batteryCapacity' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='batteryCapacity' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -5580,7 +5580,7 @@ </object> </tomanycont> </object> -<object id='batteryOutputLoad' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='batteryOutputLoad' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -5616,7 +5616,7 @@ </object> </tomanycont> </object> -<object id='batteryRunTimeRemaining' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='batteryRunTimeRemaining' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> @@ -5655,7 +5655,7 @@ </object> </tomanycont> </object> -<object id='sysUpTime' module='Products.ZenModel.RRDDataSource' class='RRDDataSource'> +<object id='sysUpTime' module='Products.ZenModel.BasicDataSource' class='BasicDataSource'> <property select_variable="sourcetypes" type="selection" id="sourcetype" mode="w" > SNMP </property> Modified: trunk/Products/ZenModel/migrate/__init__.py =================================================================== --- trunk/Products/ZenModel/migrate/__init__.py 2007-04-13 13:19:21 UTC (rev 4640) +++ trunk/Products/ZenModel/migrate/__init__.py 2007-04-13 13:24:40 UTC (rev 4641) @@ -71,3 +71,4 @@ import zlocal import evenbetterstandarderrormessage import zCollectorPlugins +import zenpackdatasources Added: trunk/Products/ZenModel/migrate/zenpackdatasources.py Added: trunk/Products/ZenModel/skins/zenmodel/editBasicDataSource.pt Modified: trunk/Products/ZenModel/skins/zenmodel/editRRDDataSource.pt =================================================================== --- trunk/Products/ZenModel/skins/zenmodel/editRRDDataSource.pt 2007-04-13 13:19:21 UTC (rev 4640) +++ trunk/Products/ZenModel/skins/zenmodel/editRRDDataSource.pt 2007-04-13 13:24:40 UTC (rev 4641) @@ -36,23 +36,7 @@ </tr> <tr> <td class="tableheader">Source Type</td> - <td class="tablevalues" tal:condition="editable"> - <select class="tablevalues" name="sourcetype" - tal:define="curtype here/sourcetype" - onChange="var input = document.createElement('INPUT'); - input.type = 'hidden'; - input.name = 'zmanage_editProperties:method'; - input.value = ' Save '; - form.appendChild(input); - this.form.submit();"> - <option tal:repeat="type here/sourcetypes" - tal:attributes="value type; - selected python:curtype == type" - tal:content="python:type">localhost</option> - </select> - </td> - <td class="tablevalues" tal:condition="not:editable" - tal:content="here/sourcetype"/> + <td class="tablevalues" tal:content="here/sourcetype"></td> </tr> <tr> <td class="tableheader">Enabled</td> @@ -65,93 +49,8 @@ <td class="tablevalues" tal:condition="not:editable" tal:content="here/enabled"/> </tr> - <tr tal:condition="python:here.sourcetype=='SNMP'"> - <td class="tableheader">OID</td> - <td class="tablevalues" tal:condition="editable"> - <input class="tablevalues" type="text" name="oid" size="40" - tal:attributes="value here/oid" /> - </td> - <td class="tablevalues" tal:condition="not:editable" - tal:content="here/oid"/> - </tr> - <span tal:condition="python:here.sourcetype=='XMLRPC'"> <tr> - <td class="tableheader">URL</td> - <td class="tablevalues" tal:condition="editable"> - <input class="tablevalues" type="text" name="xmlrpcURL" size="40" - tal:attributes="value here/xmlrpcURL" /> - </td> - <td class="tablevalues" tal:condition="not:editable" - tal:content="here/xmlrpcURL"/> - </tr> - <tr> - <td class="tableheader">Username</td> - <td class="tablevalues" tal:condition="editable"> - <input class="tablevalues" type="text" name="xmlrpcUsername" size="40" - tal:attributes="value here/xmlrpcUsername" /> - </td> - <td class="tablevalues" tal:condition="not:editable" - tal:content="here/xmlrpcUsername"/> - </tr> - <tr> - <td class="tableheader">Password</td> - <td class="tablevalues" tal:condition="editable"> - <input class="tablevalues" type="text" name="xmlrpcPassword" size="40" - tal:attributes="value here/xmlrpcPassword" /> - </td> - <td class="tablevalues" tal:condition="not:editable" - tal:content="here/xmlrpcPassword"/> - </tr> - <tr> - <td class="tableheader">Method Name</td> - <td class="tablevalues" tal:condition="editable"> - <input class="tablevalues" type="text" name="xmlrpcMethodName" size="40" - tal:attributes="value here/xmlrpcMethodName" /> - </td> - <td class="tablevalues" tal:condition="not:editable" - tal:content="here/xmlrpcMethodName"/> - </tr> - <tr> - <td class="tableheader">Method Parameters</td> - <td class="tablevalues" tal:condition="editable"> - <select width="200" style="width: 200px" - class="tablevalues" name="xmlrpcMethodParameters:list" multiple - tal:define="curparams here/xmlrpcMethodParameters"> - <option tal:repeat="dp here/getXmlRpcMethodParameters" - tal:content="dp">content</option> - </select> - <br /> - <input class="tablevalues" type="text" name="paramValue" size="10" /> - <select class="tablevalues" name="paramType"> - <option tal:repeat="type here/paramtypes" - tal:content="python:type">localhost</option> - </select> - <input class="tableheader" type="submit" value=" Add " - name="manage_addMethodParameter:method" /> - <input class="tableheader" type="submit" value=" Delete Last " - name="manage_deleteMethodParameter:method" /> - </td> - <td class="tablevalues" tal:condition="not:editable" - tal:content="python:', '.join(here.xmlrpcMethodParameters)"/> - - </tr> - </span> - - <span tal:condition="python:here.sourcetype in ('COMMAND')"> - <tr> - <td class="tableheader">Use SSH</td> - <td class="tablevalues" tal:condition="editable"> - <select class="tablevalues" name="usessh:boolean"> - <option tal:repeat="e python:(True,False)" tal:content="e" - tal:attributes="value e; selected python:e==here.usessh"/> - </select> - </td> - <td class="tablevalues" tal:condition="not:editable" - tal:content="here/usessh"/> - </tr> - - <tr> <td class="tableheader">Component</td> <td class="tablevalues" tal:condition="editable"> <input class="tablevalues" type="text" name="component" size="50" @@ -219,107 +118,8 @@ </span> - <span tal:condition="python:here.sourcetype in ('PAGECHECK')"> <tr> - <td class="tableheader">Component</td> - <td class="tablevalues" tal:condition="editable"> - <input class="tablevalues" type="text" name="component" size="50" - tal:attributes="value here/component" /> - </td> - <td class="tablevalues" tal:condition="not:editable" - tal:content="here/component"/> - </tr> - <tr> - <td class="tableheader">Event Class</td> - <td class="tablevalues" tal:condition="editable"> - <select class="tablevalues" name="eventClass"> - <option tal:repeat="evtcls here/Events/getOrganizerNames" - tal:content="evtcls" - tal:attributes="selected python:evtcls==here.eventClass"/> - </select> - </td> - <td class="tablevalues" tal:condition="not:editable" - tal:content="here/eventClass"/> - </tr> - <tr> - <td class="tableheader">Event Key</td> - <td class="tablevalues" tal:condition="editable"> - <input class="tablevalues" type="text" name="eventKey" size="50" - tal:attributes="value here/eventKey" /> - </td> - <td class="tablevalues" tal:condition="not:editable" - tal:content="here/eventKey"/> - </tr> - <tr tal:condition="python:here.sourcetype=='COMMAND'"> - <td class="tableheader">Severity</td> - <td class="tablevalues" tal:condition="editable"> - <select class="tablevalues" name="severity:int"> - <option tal:repeat="sev here/ZenEventManager/getSeverities" - tal:content="python:sev[0]" - tal:attributes="selected python:sev[1]==here.severity; value python:sev[1]"/> - </select> - </td> - <td class="tablevalues" tal:condition="not:editable" - tal:content="here/getSeverityString"/> - </tr> - <tr> - <td class="tableheader">Cycle Time</td> - <td class="tablevalues" tal:condition="editable"> - <input class="tablevalues" type="text" name="cycletime:int" size="10" - tal:attributes="value here/cycletime" /> - </td> - <td class="tablevalues" tal:condition="not:editable" - tal:content="here/cycletime"/> - </tr> - - <tr> - <td class="tableheader">User Agent</td> - <td class="tablevalues" tal:condition="editable"> - <input class="tablevalues" type="text" name="userAgent:string" size="50" - tal:attributes="value here/userAgent" /> - </td> - <td class="tablevalues" tal:condition="not:editable" - tal:content="here/userAgent"/> - </tr> - - <tr> - <td class="tableheader">Initial URL</td> - <td class="tablevalues" tal:condition="editable"> - <input class="tablevalues" type="text" name="initialURL:string" size="50" - tal:attributes="value here/initialURL" /> - </td> - <td class="tablevalues" tal:condition="not:editable" - tal:content="here/initialURL"/> - </tr> - - <tr tal:condition="editable"> - <td class="tableheader">Upload Recording</td> - <td class="tablevalues"> - <input class="tablevalues" type="file" name="recording:file" size="40" /> (<i>TestGen4Web .xml File</i>) - </td> - </tr> - - <tr> - <td class="tableheader" colspan="2">Twill Shell Commands - (See <a href='http://twill.idyll.org'>the Twill Web Site</a>, - especially the <a href='http://twill.idyll.org/examples.html'>examples</a>) - </td> - </tr> - <tr> - <td class="tablevalues" colspan="2" tal:condition='editable'> - <textarea class="tablevalues" rows="10" cols="80" - name="commandTemplate:text" - tal:content="here/commandTemplate"> - </textarea> - </td> - <td class="tablevalues" tal:condition="not:editable" - tal:content="here/commandTemplate"/> - </tr> - - </span> - - <tr> <td class=tableheader align="left" > </td> <td align="left" class="tableheader" colspan=3> |
From: <sv...@ze...> - 2007-04-13 13:20:45
|
Author: jstevens Date: 2007-04-13 09:19:21 -0400 (Fri, 13 Apr 2007) New Revision: 4640 Added: trunk/Products/ZenModel/ConfigurationError.py Modified: trunk/Products/ZenModel/RRDView.py Log: Moving ConfigurationError into it's own file to avoid include loops Added: trunk/Products/ZenModel/ConfigurationError.py Modified: trunk/Products/ZenModel/RRDView.py =================================================================== --- trunk/Products/ZenModel/RRDView.py 2007-04-13 13:16:57 UTC (rev 4639) +++ trunk/Products/ZenModel/RRDView.py 2007-04-13 13:19:21 UTC (rev 4640) @@ -18,15 +18,15 @@ from Products.ZenUtils import Map from Products.ZenUtils.ZenTales import talesEval +from Products.ZenModel.ConfigurationError import ConfigurationError -from RRDTemplate import ConfigurationError - CACHE_TIME = 60. _cache = Map.Locked(Map.Timed({}, CACHE_TIME)) class RRDViewError(Exception): pass + class RRDView(object): """ Mixin to provide hooks to RRD management functions |
From: <sv...@ze...> - 2007-04-13 13:16:55
|
Author: jstevens Date: 2007-04-13 09:16:57 -0400 (Fri, 13 Apr 2007) New Revision: 4639 Modified: trunk/Products/ZenModel/ZenPack.py Log: * fixed a bug with the mkdir call * Added method to return available datasources Modified: trunk/Products/ZenModel/ZenPack.py =================================================================== --- trunk/Products/ZenModel/ZenPack.py 2007-04-13 13:15:11 UTC (rev 4638) +++ trunk/Products/ZenModel/ZenPack.py 2007-04-13 13:16:57 UTC (rev 4639) @@ -9,7 +9,7 @@ from Products.ZenModel.ZenModelRM import ZenModelRM from Products.ZenModel import interfaces from Products.ZenRelations.RelSchema import * - +from Products.ZenUtils.Utils import importClass import transaction import os @@ -94,7 +94,7 @@ xml.write("</objects>\n") path = zenPackPath(self.id, 'objects') if not os.path.isdir(path): - os.makeDirs(path) + os.mkdir(path) objects = file(os.path.join(path, 'objects.xml'), 'w') objects.write(xml.getvalue()) objects.close() @@ -140,6 +140,21 @@ REQUEST['message'] = '%s has been exported' % self.id return self.callZenScreen(REQUEST) + + def getDataSourceClasses(self): + dsClasses = [] + for path, dirs, files in os.walk(self.path('datasources')): + dirs[:] = [d for d in dirs if not d.startswith('.')] + for f in files: + if not f.startswith('.') \ + and f.endswith('.py') \ + and not f == '__init__.py': + parts = path.split('/') + [f[:-3]] + parts = parts[parts.index('Products'):] + dsClasses.append(importClass('.'.join(parts))) + return dsClasses + + from Products.ZenModel.ZenPackLoader import * def zenPackPath(*parts): @@ -183,6 +198,6 @@ result.append((loader.name, [item for item in loader.list(self, app)])) return result + - InitializeClass(ZenPack) |
From: <sv...@ze...> - 2007-04-13 13:15:09
|
Author: jstevens Date: 2007-04-13 09:15:11 -0400 (Fri, 13 Apr 2007) New Revision: 4638 Modified: trunk/Products/ZenModel/migrate/Migrate.py Log: If --step= is given on the command line then: 1) We no longer do the report loading stuff 2) We give an error if no matching steps are found Modified: trunk/Products/ZenModel/migrate/Migrate.py =================================================================== --- trunk/Products/ZenModel/migrate/Migrate.py 2007-04-13 13:11:33 UTC (rev 4637) +++ trunk/Products/ZenModel/migrate/Migrate.py 2007-04-13 13:15:11 UTC (rev 4638) @@ -164,9 +164,10 @@ cleanup() - rl = ReportLoader(noopts=True, app=self.app) - rl.options.force = True - rl.loadDatabase() + if not self.options.steps: + rl = ReportLoader(noopts=True, app=self.app) + rl.options.force = True + rl.loadDatabase() def cutover(self): @@ -293,6 +294,9 @@ return True return False self.allSteps = [s for s in self.allSteps if matches(s.name())] + if not self.allSteps: + log.error('No steps matching %s found' % self.options.steps) + return self.useDatabaseVersion = False log.debug("Level %s, steps = %s", self.options.level, self.options.steps) |
From: <sv...@ze...> - 2007-04-13 13:11:38
|
Author: jstevens Date: 2007-04-13 09:11:33 -0400 (Fri, 13 Apr 2007) New Revision: 4637 Modified: trunk/bin/zenpack Log: zenpack is now subclass of ZenScriptBase, so no need to call it as if it were a daemon. Modified: trunk/bin/zenpack =================================================================== --- trunk/bin/zenpack 2007-04-13 13:10:43 UTC (rev 4636) +++ trunk/bin/zenpack 2007-04-13 13:11:33 UTC (rev 4637) @@ -1,12 +1,4 @@ #! /usr/bin/env bash . $ZENHOME/bin/zenfunctions - -NAME=zenpack -PRGHOME=$ZENHOME/Products/ZenUtils -PRGNAME=$NAME.py -CFGFILE=$CFGDIR/$NAME.conf -PIDFILE=$VARDIR/$PRGNAME.pid - -notdaemon "$@" - +$PYTHON $ZENHOME/Products/ZenUtils/zenpack.py "$CMD" $* |
From: <sv...@ze...> - 2007-04-13 13:10:44
|
Author: jstevens Date: 2007-04-13 09:10:43 -0400 (Fri, 13 Apr 2007) New Revision: 4636 Modified: trunk/Products/ZenUtils/zenpack.py Log: zenpack now subclasses ZenScriptBase instead of ZCmdBase Modified: trunk/Products/ZenUtils/zenpack.py =================================================================== --- trunk/Products/ZenUtils/zenpack.py 2007-04-13 13:09:54 UTC (rev 4635) +++ trunk/Products/ZenUtils/zenpack.py 2007-04-13 13:10:43 UTC (rev 4636) @@ -7,16 +7,17 @@ import Globals from Products.ZenModel.ZenPack import ZenPackBase, zenPackPath -from Products.ZenUtils.ZCmdBase import ZCmdBase +from Products.ZenUtils.ZenScriptBase import ZenScriptBase import transaction import os, sys -class ZenPackCmd(ZCmdBase): +class ZenPackCmd(ZenScriptBase): "Manage ZenPacks" def run(self): "Execute the user's request" + self.connect() if self.options.installPackName: self.install(self.extract(self.options.installPackName)) @@ -113,7 +114,6 @@ def buildOptions(self): - ZCmdBase.buildOptions(self) self.parser.add_option('--install', dest='installPackName', default=None, @@ -132,6 +132,7 @@ action="store_true", default=False, help="ignore an existing pack installation") + ZenScriptBase.buildOptions(self) if __name__ == '__main__': zp = ZenPackCmd() |
From: <sv...@ze...> - 2007-04-13 13:09:55
|
Author: jstevens Date: 2007-04-13 09:09:54 -0400 (Fri, 13 Apr 2007) New Revision: 4635 Added: trunk/Products/ZenWidgets/skins/zenui/dialog_addDataPoint.pt trunk/Products/ZenWidgets/skins/zenui/dialog_addDataSource.pt trunk/Products/ZenWidgets/skins/zenui/dialog_addGraph.pt trunk/Products/ZenWidgets/skins/zenui/dialog_addThreshold.pt trunk/Products/ZenWidgets/skins/zenui/dialog_deleteDataPoint.pt trunk/Products/ZenWidgets/skins/zenui/dialog_deleteDataSource.pt trunk/Products/ZenWidgets/skins/zenui/dialog_deleteGraph.pt trunk/Products/ZenWidgets/skins/zenui/dialog_deleteThreshold.pt Modified: trunk/Products/ZenModel/migrate/menus.py trunk/Products/ZenModel/skins/zenmodel/viewRRDTemplate.pt Log: Adding menus for the datasources, thresholds and graphs on the view template page. Modified: trunk/Products/ZenModel/migrate/menus.py =================================================================== --- trunk/Products/ZenModel/migrate/menus.py 2007-04-12 21:24:14 UTC (rev 4634) +++ trunk/Products/ZenModel/migrate/menus.py 2007-04-13 13:09:54 UTC (rev 4635) @@ -701,6 +701,77 @@ isdialog = True ) ], + 'DataSource_list':[ + dict( + id = 'addDataSource', + description = 'Add DataSource...', + action = 'dialog_addDataSource', + permissions= ('Change Device',), + isdialog = True, + ), + dict( + id = 'deleteDataSource', + description = 'Delete DataSource...', + action = 'dialog_deleteDataSource', + permissions= ('Change Device',), + isdialog = True, + ), + ], + 'DataPoint_list':[ + dict( + id = 'addDataPoint', + description = 'Add DataPoint...', + action = 'dialog_addDataPoint', + permissions= ('Change Device',), + isdialog = True, + ), + dict( + id = 'deleteDataPoint', + description = 'Delete DataPoint...', + action = 'dialog_deleteDataPoint', + permissions= ('Change Device',), + isdialog = True, + ), + ], + 'Threshold_list':[ + dict( + id = 'addThreshold', + description = 'Add Threshold...', + action = 'dialog_addThreshold', + permissions= ('Change Device',), + isdialog = True, + ), + dict( + id = 'deleteThreshold', + description = 'Delete Threshold...', + action = 'dialog_deleteThreshold', + permissions= ('Change Device',), + isdialog = True, + ), + ], + 'Graph_list':[ + dict( + id = 'addGraph', + description = 'Add Graph...', + action = 'dialog_addGraph', + permissions= ('Change Device',), + isdialog = True, + ), + dict( + id = 'deleteGraph', + description = 'Delete Graph...', + action = 'dialog_deleteGraph', + permissions= ('Change Device',), + isdialog = True, + ), + dict( + id = 'resequenceGraphs', + description = 'Re-sequence Graphs', + action = 'manage_resequenceRRDGraphs', + permissions= ('Change Device',), + isdialog = True, + ), + ], 'Subnetworks':[ dict( id= 'deleteNetwork', Modified: trunk/Products/ZenModel/skins/zenmodel/viewRRDTemplate.pt =================================================================== --- trunk/Products/ZenModel/skins/zenmodel/viewRRDTemplate.pt 2007-04-12 21:24:14 UTC (rev 4634) +++ trunk/Products/ZenModel/skins/zenmodel/viewRRDTemplate.pt 2007-04-13 13:09:54 UTC (rev 4635) @@ -1,7 +1,7 @@ <tal:block metal:use-macro="here/templates/macros/page2"> <tal:block metal:fill-slot="contentPane" tal:define="editable python:here.isEditable(here)"> -<form method="post" tal:attributes="action here/absolute_url_path"> +<form method="POST" tal:attributes="action here/absolute_url_path"> <input type="hidden" name="zenScreenName" tal:attributes="value template/id"/> @@ -67,14 +67,15 @@ </form> <br/> -<form method="post" tal:attributes="action here/absolute_url_path"> +<form method="POST" tal:attributes="action here/absolute_url_path"> <input type="hidden" name="zenScreenName" tal:attributes="value template/id"/> <tal:block tal:define="tableName string:rrdtempdslist; objects here/getRRDDataSources; batch python:here.ZenTableManager.getBatch(tableName,objects); - tabletitle string:Data Sources"> + tabletitle string:Data Sources; + menu_id string:DataSource_list;"> <tal:block metal:use-macro="here/zenuimacros/macros/zentable"> <!--====Optional titlebar slots============= @@ -112,7 +113,7 @@ tal:content="ds/getId">name</a> <tal:block tal:condition="not:editable" tal:content="ds/getId"/> </td> - <td tal:content="ds/getOidOrUrl"/> + <td tal:content="ds/getDescription"/> <td tal:content="ds/sourcetype"/> <td tal:content="ds/enabled"/> </tr> @@ -123,14 +124,6 @@ </tr> <tr class="tableheader" tal:condition="editable"> <td colspan="5"> - <input class="tableheader" type="text" name="id"/> - <input class="tableheader" type="submit" - onkeypress="return submitViaEnter(event,'manage_addRRDDataSource');" - name="manage_addRRDDataSource:method" value=" Add " /> - | - <input class="tableheader" type="submit" - name="manage_deleteRRDDataSources:method" value=" Delete " /> - | <input class="tableheader" type="submit" name="SelectButton" value="Select All" onClick="toggleSelect(this.form);return false"/> @@ -147,14 +140,15 @@ </form> <br/> -<form method="post" tal:attributes="action here/absolute_url_path"> +<form method="POST" tal:attributes="action here/absolute_url_path"> <input type="hidden" name="zenScreenName" tal:attributes="value template/id"/> <tal:block tal:define="tableName string:rrdthreshsoldist; objects here/thresholds; batch python:here.ZenTableManager.getBatch(tableName,objects); - tabletitle string:Thresholds"> + tabletitle string:Thresholds; + menu_id string:Threshold_list"> <tal:block metal:use-macro="here/zenuimacros/macros/zentable"> <!--====Optional titlebar slots============= @@ -206,14 +200,6 @@ </tr> <tr class="tableheader" tal:condition="editable"> <td colspan="5"> - <input class="tableheader" type="text" name="id"/> - <input class="tableheader" type="submit" - onkeypress="return submitViaEnter(event,'manage_addRRDThreshold');" - name="manage_addRRDThreshold:method" value=" Add " /> - | - <input class="tableheader" type="submit" - name="manage_deleteRRDThresholds:method" value=" Delete " /> - | <input class="tableheader" type="submit" name="SelectButton" value="Select All" onClick="toggleSelect(this.form);return false"/> @@ -230,7 +216,7 @@ </form> <br/> -<form method="post" tal:attributes="action here/absolute_url_path"> +<form method="POST" tal:attributes="action here/absolute_url_path"> <input type="hidden" name="zenScreenName" tal:attributes="value template/id"/> @@ -238,7 +224,8 @@ objects here/getGraphs; batch python:here.ZenTableManager.getBatch(tableName,objects, sortedHeader='sequence'); - tabletitle string:Graphs"> + tabletitle string:Graphs; + menu_id string:Graph_list"> <tal:block metal:use-macro="here/zenuimacros/macros/zentable"> <!--====Optional titlebar slots============= @@ -307,20 +294,9 @@ </tr> <tr class="tableheader" tal:condition="editable"> <td colspan="6"> - <input class="tableheader" type="text" name="id"/> - <input class="tableheader" type="submit" - onkeypress="return submitViaEnter(event,'manage_addRRDGraph');" - name="manage_addRRDGraph:method" value=" Add " /> - | - <input class="tableheader" type="submit" - name="manage_deleteRRDGraphs:method" value=" Delete " /> - | <input class="tableheader" type="submit" name="SelectButton" value="Select All" onClick="toggleSelect(this.form);return false"/> - | - <input class="tableheader" type="submit" - name="manage_resequenceRRDGraphs:method" value=" Re-Sequence " /> </td> </tr> </tal:block> Added: trunk/Products/ZenWidgets/skins/zenui/dialog_addDataPoint.pt Added: trunk/Products/ZenWidgets/skins/zenui/dialog_addDataSource.pt Added: trunk/Products/ZenWidgets/skins/zenui/dialog_addGraph.pt Added: trunk/Products/ZenWidgets/skins/zenui/dialog_addThreshold.pt Added: trunk/Products/ZenWidgets/skins/zenui/dialog_deleteDataPoint.pt Added: trunk/Products/ZenWidgets/skins/zenui/dialog_deleteDataSource.pt Added: trunk/Products/ZenWidgets/skins/zenui/dialog_deleteGraph.pt Added: trunk/Products/ZenWidgets/skins/zenui/dialog_deleteThreshold.pt |
From: <sv...@ze...> - 2007-04-12 21:24:14
|
Author: marc Date: 2007-04-12 17:24:14 -0400 (Thu, 12 Apr 2007) New Revision: 4634 Modified: trunk/Products/ZenEvents/MySqlSendEvent.py trunk/Products/ZenUtils/Utils.py Log: #1121 * fixed zdecode Modified: trunk/Products/ZenEvents/MySqlSendEvent.py =================================================================== --- trunk/Products/ZenEvents/MySqlSendEvent.py 2007-04-12 21:19:42 UTC (rev 4633) +++ trunk/Products/ZenEvents/MySqlSendEvent.py 2007-04-12 21:24:14 UTC (rev 4634) @@ -117,7 +117,7 @@ execute(curs, self.buildDetailInsert(evid, detaildata)) if rescount != 1: sql = ('select evid from %s where dedupid="%s"' % ( - event._action, decode(event.dedupid))) + event._action, decode(self, event.dedupid))) execute(curs, sql) rs = curs.fetchone() if rs: @@ -231,7 +231,7 @@ if statusdata.has_key('prodState'): insert += "prodState=%d," % statusdata['prodState'] insert += "summary='%s',%s=%s+1,%s=%.3f" % ( - self.escape(decode(statusdata.get('summary',''))), + self.escape(decode(self, statusdata.get('summary',''))), self.countField, self.countField, self.lastTimeField,statusdata['lastTime']) return insert Modified: trunk/Products/ZenUtils/Utils.py =================================================================== --- trunk/Products/ZenUtils/Utils.py 2007-04-12 21:19:42 UTC (rev 4633) +++ trunk/Products/ZenUtils/Utils.py 2007-04-12 21:24:14 UTC (rev 4634) @@ -468,7 +468,7 @@ def zdecode(context, value): if type(value) in types.StringTypes: - decoding = getattr(obj, 'zCollectorDecoding', 'latin-1') + decoding = getattr(context, 'zCollectorDecoding', 'latin-1') value = value.decode(decoding) return value |
From: <sv...@ze...> - 2007-04-12 21:19:42
|
Author: marc Date: 2007-04-12 17:19:42 -0400 (Thu, 12 Apr 2007) New Revision: 4633 Modified: trunk/Products/ZenEvents/MySqlSendEvent.py Log: #1121 * New import Modified: trunk/Products/ZenEvents/MySqlSendEvent.py =================================================================== --- trunk/Products/ZenEvents/MySqlSendEvent.py 2007-04-12 20:47:59 UTC (rev 4632) +++ trunk/Products/ZenEvents/MySqlSendEvent.py 2007-04-12 21:19:42 UTC (rev 4633) @@ -9,7 +9,7 @@ from ZEO.Exceptions import ClientDisconnected import Products.ZenUtils.guid as guid -import Products.ZenUtils.Utils.zdecode as decode +from Products.ZenUtils.Utils import zdecode as decode from Event import Event, EventHeartbeat, buildEventFromDict from ZenEventClasses import Heartbeat, Unknown from Products.ZenEvents.Exceptions import * |
From: <sv...@ze...> - 2007-04-12 20:48:37
|
Author: marc Date: 2007-04-12 16:47:59 -0400 (Thu, 12 Apr 2007) New Revision: 4632 Modified: trunk/Products/ZenEvents/MySqlSendEvent.py Log: #1121 * Using decode method Modified: trunk/Products/ZenEvents/MySqlSendEvent.py =================================================================== --- trunk/Products/ZenEvents/MySqlSendEvent.py 2007-04-12 15:54:20 UTC (rev 4631) +++ trunk/Products/ZenEvents/MySqlSendEvent.py 2007-04-12 20:47:59 UTC (rev 4632) @@ -9,6 +9,7 @@ from ZEO.Exceptions import ClientDisconnected import Products.ZenUtils.guid as guid +import Products.ZenUtils.Utils.zdecode as decode from Event import Event, EventHeartbeat, buildEventFromDict from ZenEventClasses import Heartbeat, Unknown from Products.ZenEvents.Exceptions import * @@ -116,7 +117,7 @@ execute(curs, self.buildDetailInsert(evid, detaildata)) if rescount != 1: sql = ('select evid from %s where dedupid="%s"' % ( - event._action, event.dedupid)) + event._action, decode(event.dedupid))) execute(curs, sql) rs = curs.fetchone() if rs: @@ -230,7 +231,7 @@ if statusdata.has_key('prodState'): insert += "prodState=%d," % statusdata['prodState'] insert += "summary='%s',%s=%s+1,%s=%.3f" % ( - self.escape(statusdata.get('summary','')), + self.escape(decode(statusdata.get('summary',''))), self.countField, self.countField, self.lastTimeField,statusdata['lastTime']) return insert |
From: <sv...@ze...> - 2007-04-12 15:54:21
|
Author: marc Date: 2007-04-12 11:54:20 -0400 (Thu, 12 Apr 2007) New Revision: 4631 Added: trunk/Products/ZenModel/skins/zenmodel/dialog_deleteIpAddress.pt Modified: trunk/Products/ZenModel/IpNetwork.py trunk/Products/ZenModel/migrate/menus.py trunk/Products/ZenModel/skins/zenmodel/viewNetworkOverview.pt Log: #1192 * Added delete menu and dialog for IpAddress Modified: trunk/Products/ZenModel/IpNetwork.py =================================================================== --- trunk/Products/ZenModel/IpNetwork.py 2007-04-12 14:42:41 UTC (rev 4630) +++ trunk/Products/ZenModel/IpNetwork.py 2007-04-12 15:54:20 UTC (rev 4631) @@ -292,6 +292,15 @@ """get an ip on this network""" return self.ipaddresses._getOb(ip, None) + security.declareProtected('Change Network', 'manage_deleteIpAddresses') + def manage_deleteIpAddresses(self, ipaddresses=(), REQUEST=None): + """Delete ipaddresses by id from this network. + """ + for ipaddress in ipaddresses: + ip = self.getIpAddress(ipaddress) + self.ipaddresses.removeRelation(ip) + if REQUEST: + return self.callZenScreen(REQUEST) security.declareProtected('View', 'countIpAddresses') def countIpAddresses(self, inuse=True): Modified: trunk/Products/ZenModel/migrate/menus.py =================================================================== --- trunk/Products/ZenModel/migrate/menus.py 2007-04-12 14:42:41 UTC (rev 4630) +++ trunk/Products/ZenModel/migrate/menus.py 2007-04-12 15:54:20 UTC (rev 4631) @@ -704,12 +704,21 @@ 'Subnetworks':[ dict( id= 'deleteNetwork', - description='Delete Network...', + description='Delete Networks...', action= 'dialog_deleteNetwork', isdialog = True, permissions=('Change Device',), ), ], + 'IpAddresses':[ + dict( + id= 'deleteIpAddress', + description='Delete IpAddresses...', + action= 'dialog_deleteIpAddress', + isdialog = True, + permissions=('Change Device',), + ), + ], }) Added: trunk/Products/ZenModel/skins/zenmodel/dialog_deleteIpAddress.pt Modified: trunk/Products/ZenModel/skins/zenmodel/viewNetworkOverview.pt =================================================================== --- trunk/Products/ZenModel/skins/zenmodel/viewNetworkOverview.pt 2007-04-12 14:42:41 UTC (rev 4630) +++ trunk/Products/ZenModel/skins/zenmodel/viewNetworkOverview.pt 2007-04-12 15:54:20 UTC (rev 4631) @@ -157,7 +157,8 @@ <tal:block tal:define="objects here/ipaddresses/objectValuesAll; tableName string:networkoverviewipaddresses; tabletitle string:IP Addresses; - batch python:here.ZenTableManager.getBatch(tableName,objects);" + batch python:here.ZenTableManager.getBatch(tableName,objects); + menu_id string:IpAddresses" tal:condition="objects"> <tal:block metal:use-macro="here/zenuimacros/macros/zentable"> <tal:block metal:fill-slot="zentablecontents"> @@ -192,6 +193,9 @@ </tr> <tr tal:repeat="ip batch"> <td class="tablevalues" align="left"> + <input tal:condition="here/isManager" + type="checkbox" name="ipaddresses:list" + tal:attributes="value ip/getId"/> <a href="_" tal:attributes="href ip/absolute_url" tal:content="ip/getIpAddress">1.1.1.1/24</a> |
From: <sv...@ze...> - 2007-04-12 14:45:16
|
Author: marc Date: 2007-04-12 10:42:41 -0400 (Thu, 12 Apr 2007) New Revision: 4630 Added: trunk/Products/ZenModel/skins/zenmodel/dialog_deleteNetwork.pt Modified: trunk/Products/ZenModel/migrate/menus.py trunk/Products/ZenModel/skins/zenmodel/viewNetworkOverview.pt Log: #1194 * Added delete network menu item and dialog Modified: trunk/Products/ZenModel/migrate/menus.py =================================================================== --- trunk/Products/ZenModel/migrate/menus.py 2007-04-12 13:18:38 UTC (rev 4629) +++ trunk/Products/ZenModel/migrate/menus.py 2007-04-12 14:42:41 UTC (rev 4630) @@ -701,6 +701,15 @@ isdialog = True ) ], + 'Subnetworks':[ + dict( + id= 'deleteNetwork', + description='Delete Network...', + action= 'dialog_deleteNetwork', + isdialog = True, + permissions=('Change Device',), + ), + ], }) Added: trunk/Products/ZenModel/skins/zenmodel/dialog_deleteNetwork.pt Modified: trunk/Products/ZenModel/skins/zenmodel/viewNetworkOverview.pt =================================================================== --- trunk/Products/ZenModel/skins/zenmodel/viewNetworkOverview.pt 2007-04-12 13:18:38 UTC (rev 4629) +++ trunk/Products/ZenModel/skins/zenmodel/viewNetworkOverview.pt 2007-04-12 14:42:41 UTC (rev 4630) @@ -85,7 +85,8 @@ <tal:block tal:define="objects here/children; tableName string:networkoverviewsubnets; tabletitle string:Subnetworks; - batch python:here.ZenTableManager.getBatch(tableName,objects);"> + batch python:here.ZenTableManager.getBatch(tableName,objects); + menu_id string:Subnetworks"> <tal:block metal:use-macro="here/zenuimacros/macros/zentable"> <tal:block metal:fill-slot="zentablecontents"> |
From: <sv...@ze...> - 2007-04-12 13:19:06
|
Author: ian Date: 2007-04-12 09:18:38 -0400 (Thu, 12 Apr 2007) New Revision: 4629 Modified: trunk/Products/ZenUtils/js/zenui.js trunk/Products/ZenWidgets/skins/zenui/javascript/dialog.js trunk/Products/ZenWidgets/skins/zenui/javascript/menus.js trunk/Products/ZenWidgets/skins/zenui/javascript/selection.js Log: * Switched all console.log calls to use MochiKit's log() Modified: trunk/Products/ZenUtils/js/zenui.js =================================================================== --- trunk/Products/ZenUtils/js/zenui.js 2007-04-11 15:31:34 UTC (rev 4628) +++ trunk/Products/ZenUtils/js/zenui.js 2007-04-12 13:18:38 UTC (rev 4629) @@ -191,6 +191,7 @@ function cancelHover() { var leftPane = $('leftPane'); var paneToggle = $('paneToggle'); + if (leftPane && paneToggle) { disconnectAll(paneToggle); disconnectAll(leftPane); disconnectAll('leftPaneToggle'); @@ -211,11 +212,12 @@ deleteCookie('Zenoss_Collapsed_Menu','/',''); updateNodeAttributes(leftPane, { 'style':'display:block' - }); + });} } function checkForCollapsed() { var x = getCookie('Zenoss_Collapsed_Menu'); + if ($('leftPaneToggle')){ if (!x){ disconnectAll('leftPaneToggle'); connect('leftPaneToggle','onclick',toggleLeftPane); @@ -234,7 +236,8 @@ } else { hideLeftPane(); } + } } addLoadEvent(checkForCollapsed); -console.log("Left pane toggle javascript loaded."); +log("Left pane toggle javascript loaded."); Modified: trunk/Products/ZenWidgets/skins/zenui/javascript/dialog.js =================================================================== --- trunk/Products/ZenWidgets/skins/zenui/javascript/dialog.js 2007-04-11 15:31:34 UTC (rev 4628) +++ trunk/Products/ZenWidgets/skins/zenui/javascript/dialog.js 2007-04-12 13:18:38 UTC (rev 4629) @@ -49,13 +49,11 @@ }, show: function(form, url) { if (url) this.fetch(url); - console.log('52'); this.form = form; var dims = getViewportDimensions(); var vPos = getViewportPosition(); setStyle(this.box, {'z-index':'1','display':'block'}); var bdims = getElementDimensions(this.box); - console.log(this.box); setStyle(this.box, {'z-index':'10002','display':'none'}); map(function(menu) {setStyle(menu, {'z-index':'3000'})}, concat($$('.menu'), $$('.devmovemenu'))); @@ -94,4 +92,4 @@ } } -console.log("Dialog javascript loaded.") +log("Dialog javascript loaded.") Modified: trunk/Products/ZenWidgets/skins/zenui/javascript/menus.js =================================================================== --- trunk/Products/ZenWidgets/skins/zenui/javascript/menus.js 2007-04-11 15:31:34 UTC (rev 4628) +++ trunk/Products/ZenWidgets/skins/zenui/javascript/menus.js 2007-04-12 13:18:38 UTC (rev 4629) @@ -94,6 +94,9 @@ smto[submenu] = setTimeout('hideSubMenu("'+submenu+'")', 500); }); connect(submenu, 'onmouseout', function() { smto[submenu] = setTimeout('hideSubMenu("'+submenu+'")', 500); }); + connect(submenu, 'onclick', function() { + hideSubMenu(submenu); + }); } var registerMenu = function(button, menu) { @@ -130,4 +133,4 @@ } -console.log('Menu javascript loaded.'); +log('Menu javascript loaded.'); Modified: trunk/Products/ZenWidgets/skins/zenui/javascript/selection.js =================================================================== --- trunk/Products/ZenWidgets/skins/zenui/javascript/selection.js 2007-04-11 15:31:34 UTC (rev 4628) +++ trunk/Products/ZenWidgets/skins/zenui/javascript/selection.js 2007-04-12 13:18:38 UTC (rev 4629) @@ -46,4 +46,4 @@ } addLoadEvent(connectCheckboxListeners); -console.log("Checkbox javascript loaded."); +log("Checkbox javascript loaded."); |
From: <sv...@ze...> - 2007-04-11 15:31:53
|
Author: ecn Date: 2007-04-11 11:31:34 -0400 (Wed, 11 Apr 2007) New Revision: 4628 Modified: trunk/inst/GNUmakefile Log: * clean up the make file a little Modified: trunk/inst/GNUmakefile =================================================================== --- trunk/inst/GNUmakefile 2007-04-11 13:08:20 UTC (rev 4627) +++ trunk/inst/GNUmakefile 2007-04-11 15:31:34 UTC (rev 4628) @@ -82,7 +82,6 @@ ELEMENTTREE= $(call ROOT, elementtree) PYNETSNMP= $(call ROOT, pynetsnmp) CTYPES= $(call ROOT, ctypes) -QUEUE= $(call ROOT, zc.queue) # optional packages SENDPAGE= $(call ROOT, sendpage) @@ -137,11 +136,10 @@ # don't build winexe-install on a mac -ifeq ($(DARWIN),1) - products-install: \ +EVERYTHING = \ zope-install \ - zc.queue-install \ - twistedsnmp-install \ + twistedsnmp-install \ + pynetsnmp-install \ mysql-python-install \ rrdtool-install \ epydoc-install \ @@ -149,21 +147,13 @@ yapps-install \ nagios-install \ libsmi-install \ - simplejson-install -else - products-install: \ - zope-install \ - zc.queue-install \ - twistedsnmp-install \ - mysql-python-install \ - rrdtool-install \ - epydoc-install \ - snpp-install \ - yapps-install \ - nagios-install \ - libsmi-install \ - simplejson-install \ + simplejson-install \ winexe-install + +ifeq ($(DARWIN),1) + products-install: $(filter-out $(EVERYTHING) winexe-install) +else + products-install: $(EVERYTHING) endif # twill provides pyparsing @@ -226,10 +216,6 @@ elementtree-install: build/$(ELEMENTTREE)/.unpacked $(PYINSTALL) -zc.queue-install: build/$(QUEUE)/.unpacked - $(PYINSTALL) - @touch $(DESTDIR)$(ZENHOME)/lib/python/zc/__init__.py - PYTHONVERSION=$(shell $(PYTHON) -c 'import sys; print "python%d.%d"%sys.version_info[:2]') BB=$(INSTDIR)/build/$(ZOPE)/build-base/$(PYTHONVERSION) zope-install: build/$(ZOPE)/.unpacked build/$(ZOPE)/makefile zenoss-install |
From: <sv...@ze...> - 2007-04-11 13:08:19
|
Author: edahl Date: 2007-04-11 09:08:20 -0400 (Wed, 11 Apr 2007) New Revision: 4627 Modified: trunk/Products/ZenModel/migrate/__init__.py Log: * cleanup migrate init eric and marc stepped on each other :) Modified: trunk/Products/ZenModel/migrate/__init__.py =================================================================== --- trunk/Products/ZenModel/migrate/__init__.py 2007-04-11 12:58:47 UTC (rev 4626) +++ trunk/Products/ZenModel/migrate/__init__.py 2007-04-11 13:08:20 UTC (rev 4627) @@ -71,6 +71,3 @@ import zlocal import evenbetterstandarderrormessage import zCollectorPlugins -import zWinServices -import hubqueue - |
From: <sv...@ze...> - 2007-04-11 12:58:52
|
Author: ian Date: 2007-04-11 08:58:47 -0400 (Wed, 11 Apr 2007) New Revision: 4626 Modified: trunk/Products/ZenWidgets/skins/zenui/javascript/dialog.js Log: * Fixes a z-index bug on menus and dialogs Modified: trunk/Products/ZenWidgets/skins/zenui/javascript/dialog.js =================================================================== --- trunk/Products/ZenWidgets/skins/zenui/javascript/dialog.js 2007-04-11 12:02:32 UTC (rev 4625) +++ trunk/Products/ZenWidgets/skins/zenui/javascript/dialog.js 2007-04-11 12:58:47 UTC (rev 4626) @@ -57,7 +57,7 @@ var bdims = getElementDimensions(this.box); console.log(this.box); setStyle(this.box, {'z-index':'10002','display':'none'}); - map(function(menu) {setStyle(menu, {'z-index':'9000'})}, + map(function(menu) {setStyle(menu, {'z-index':'3000'})}, concat($$('.menu'), $$('.devmovemenu'))); setElementDimensions(this.dimbg, getViewportDimensions()); setElementPosition(this.dimbg, getViewportPosition()); |
From: <sv...@ze...> - 2007-04-11 12:02:31
|
Author: ecn Date: 2007-04-11 08:02:32 -0400 (Wed, 11 Apr 2007) New Revision: 4625 Added: trunk/inst/externallibs/TwistedSNMP-0.3.13.patch05 Log: * patch to make twistedsnmp go faster Added: trunk/inst/externallibs/TwistedSNMP-0.3.13.patch05 |
From: <sv...@ze...> - 2007-04-11 02:30:18
|
Author: ecn Date: 2007-04-10 22:30:20 -0400 (Tue, 10 Apr 2007) New Revision: 4624 Modified: trunk/Products/ZenHub/services/ZenRender.py trunk/Products/ZenRRD/zenrender.py Log: * support a whole lot more renderserver features Modified: trunk/Products/ZenHub/services/ZenRender.py =================================================================== --- trunk/Products/ZenHub/services/ZenRender.py 2007-04-11 02:29:28 UTC (rev 4623) +++ trunk/Products/ZenHub/services/ZenRender.py 2007-04-11 02:30:20 UTC (rev 4624) @@ -9,6 +9,8 @@ from twisted.web import resource, server from twisted.internet import reactor +import xmlrpclib + htmlResource = None import logging @@ -26,13 +28,18 @@ def render_GET(self, request): - gopts = request.args['gopts'][0] - drange = request.args['drange'][0] - ftype = request.args.get('ftype', ['PNG'])[0] + "Deal with http requests" + args = request.args.copy() + for k, v in args.items(): + if len(v) == 1: + args[k] = v[0] for instance, renderer in self.renderers.items(): for listener in renderer.listeners: try: - d = listener.callRemote('render', gopts, drange, ftype) + command = request.postpath[-1] + args.setdefault('ftype', 'PNG') + ftype = args['ftype'] + del args['ftype'] request.setHeader('Content-type', 'image/%s' % ftype) def write(result): request.write(result) @@ -40,12 +47,36 @@ def error(reason): log.error("Unable to fetch graph: %s", reason) request.finish() + d = listener.callRemote(command, **args) d.addCallbacks(write, error) return server.NOT_DONE_YET except Exception, ex: + log.exception(ex) log.warning("Skipping renderer %s" % instance) raise Exception("No renderer registered") + def render_POST(self, request): + "Deal with XML-RPC requests" + for instance, renderer in self.renderers.items(): + for listener in renderer.listeners: + try: + args, command = xmlrpclib.loads(request.content.read()) + request.setHeader('Content-type', 'text/xml') + d = listener.callRemote(str(command), *args) + def write(result): + response = xmlrpclib.dumps((result,), + methodresponse=True) + request.write(response) + request.finish() + def error(reason): + log.error("Unable to fetch graph: %s", reason) + request.finish() + d.addCallbacks(write, error) + return server.NOT_DONE_YET + except Exception, ex: + log.exception(ex) + log.warning("Skipping renderer %s" % instance) + raise Exception("No renderer registered") def getChild(self, path, request): "Handle all paths" Modified: trunk/Products/ZenRRD/zenrender.py =================================================================== --- trunk/Products/ZenRRD/zenrender.py 2007-04-11 02:29:28 UTC (rev 4623) +++ trunk/Products/ZenRRD/zenrender.py 2007-04-11 02:30:20 UTC (rev 4624) @@ -1,3 +1,10 @@ +#! /usr/bin/env python +################################################################# +# +# Copyright (c) 2007 Zenoss, Inc. All rights reserved. +# +################################################################# + import Globals from Products.ZenHub.PBDaemon import PBDaemon @@ -27,9 +34,34 @@ PBDaemon.__init__(self, 'zenrender') self.rs = RenderServer(self.name) - def remote_render(self, gopts, drange, ftype): - return self.rs.render(gopts, drange, ftype=ftype) + def remote_render(self, *args, **kw): + return self.rs.render(*args, **kw) + def remote_packageRRDFiles(self, *args, **kw): + return self.rs.packageRRDFiles(*args, **kw) + + def remote_unpackageRRDFiles(self, *args, **kw): + return self.rs.unpackageRRDFiles(*args, **kw) + + def remote_receiveRRDFiles(self, *args, **kw): + return self.rs.receiveRRDFiles(*args, **kw) + + def remote_sendRRDFiles(self, *args, **kw): + return self.rs.sendRRDFiles(*args, **kw) + + def remote_moveRRDFiles(self, *args, **kw): + return self.rs.moveRRDFiles(*args, **kw) + + def remote_plugin(self, *args, **kw): + return self.rs.plugin(*args, **kw) + + def remote_summary(self, *args, **kw): + return self.rs.summary(*args, **kw) + + def remote_currentValues(self, *args, **kw): + return self.rs.currentValues(*args, **kw) + + if __name__ == '__main__': zr = zenrender() zr.run() |
From: <sv...@ze...> - 2007-04-11 02:29:29
|
Author: ecn Date: 2007-04-10 22:29:28 -0400 (Tue, 10 Apr 2007) New Revision: 4623 Modified: trunk/Products/ZenModel/PerformanceConf.py trunk/Products/ZenRRD/RenderServer.py Log: * compress the url better Modified: trunk/Products/ZenModel/PerformanceConf.py =================================================================== --- trunk/Products/ZenModel/PerformanceConf.py 2007-04-11 00:38:45 UTC (rev 4622) +++ trunk/Products/ZenModel/PerformanceConf.py 2007-04-11 02:29:28 UTC (rev 4623) @@ -292,7 +292,8 @@ width = o.split('=')[1].strip() continue ngopts.append(o) - gopts = url_quote(zlib.compress('|'.join(ngopts))) + import base64 + gopts = base64.urlsafe_b64encode(zlib.compress('|'.join(ngopts), 9)) url = "%s/render?gopts=%s&drange=%d&width=%s" % ( self.renderurl,gopts,drange, width) if self.renderurl.startswith("http"): Modified: trunk/Products/ZenRRD/RenderServer.py =================================================================== --- trunk/Products/ZenRRD/RenderServer.py 2007-04-11 00:38:45 UTC (rev 4622) +++ trunk/Products/ZenRRD/RenderServer.py 2007-04-11 02:29:28 UTC (rev 4623) @@ -71,7 +71,8 @@ def render(self, gopts=None, drange=None, remoteUrl=None, width=None, ftype='PNG', REQUEST=None): """render a graph and return it""" - gopts = zlib.decompress(gopts) + import base64 + gopts = zlib.decompress(base64.urlsafe_b64decode(gopts)) gopts = gopts.split('|') gopts = [g for g in gopts if g] gopts.append('--width=%s' % width) |
From: <sv...@ze...> - 2007-04-11 00:38:46
|
Author: ecn Date: 2007-04-10 20:38:45 -0400 (Tue, 10 Apr 2007) New Revision: 4622 Removed: trunk/Products/ZenModel/migrate/hubqueue.py Modified: trunk/Products/ZenHub/HubService.py trunk/Products/ZenHub/services/Beat.py trunk/Products/ZenHub/services/CommandConfig.py trunk/Products/ZenHub/services/EventService.py trunk/Products/ZenHub/services/PerformanceConfig.py trunk/Products/ZenHub/services/ProcessConfig.py trunk/Products/ZenHub/services/SnmpPerfConfig.py trunk/Products/ZenHub/services/XmlRPCConfig.py trunk/Products/ZenHub/services/ZenRender.py trunk/Products/ZenHub/services/__init__.py trunk/Products/ZenHub/zenhub.py trunk/Products/ZenModel/DataRoot.py trunk/Products/ZenModel/Device.py trunk/Products/ZenModel/DeviceClass.py trunk/Products/ZenModel/PerformanceConf.py trunk/Products/ZenModel/RRDTemplate.py trunk/Products/ZenModel/ZenDate.py trunk/Products/ZenModel/ZenModelRM.py trunk/Products/ZenModel/migrate/__init__.py trunk/Products/ZenModel/migrate/menus.py trunk/Products/ZenRRD/RRDDaemon.py trunk/Products/ZenRRD/zencommand.py trunk/Products/ZenRRD/zenperfsnmp.py trunk/Products/ZenRRD/zenprocess.py trunk/Products/ZenRelations/PrimaryPathObjectManager.py trunk/Products/ZenRelations/RelationshipBase.py trunk/Products/ZenRelations/ZenPropertyManager.py trunk/Products/ZenUtils/ZCmdBase.py Log: ZenHub improvements: * switched to listening to object changes using Zeo object invalidations * started incremental loading in zencommand, zenprocess * added menu item to push devices * added copyright headers and doc strings Modified: trunk/Products/ZenHub/HubService.py =================================================================== --- trunk/Products/ZenHub/HubService.py 2007-04-10 22:58:01 UTC (rev 4621) +++ trunk/Products/ZenHub/HubService.py 2007-04-11 00:38:45 UTC (rev 4622) @@ -15,7 +15,7 @@ def update(self, object): pass - def deleted(self, path): + def deleted(self, object): pass def addListener(self, remote): Modified: trunk/Products/ZenHub/services/Beat.py =================================================================== --- trunk/Products/ZenHub/services/Beat.py 2007-04-10 22:58:01 UTC (rev 4621) +++ trunk/Products/ZenHub/services/Beat.py 2007-04-11 00:38:45 UTC (rev 4622) @@ -1,3 +1,10 @@ +#! /usr/bin/env python +################################################################# +# +# Copyright (c) 2007 Zenoss, Inc. All rights reserved. +# +################################################################# + from HubService import HubService from twisted.internet import reactor from twisted.spread import pb Modified: trunk/Products/ZenHub/services/CommandConfig.py =================================================================== --- trunk/Products/ZenHub/services/CommandConfig.py 2007-04-10 22:58:01 UTC (rev 4621) +++ trunk/Products/ZenHub/services/CommandConfig.py 2007-04-11 00:38:45 UTC (rev 4622) @@ -1,3 +1,10 @@ +#! /usr/bin/env python +################################################################# +# +# Copyright (c) 2007 Zenoss, Inc. All rights reserved. +# +################################################################# + from PerformanceConfig import PerformanceConfig class CommandConfig(PerformanceConfig): @@ -5,12 +12,15 @@ def remote_getDataSourceCommands(self, *args, **kwargs): return self.config.getDataSourceCommands(*args, **kwargs) + def getDeviceConfig(self, device): return device.getDataSourceCommands() + def sendDeviceConfig(self, listener, config): - listener.callRemote('updateConfig', config) + return listener.callRemote('updateConfig', config) + def update(self, object): from Products.ZenModel.RRDDataSource import RRDDataSource if isinstance(object, RRDDataSource): Modified: trunk/Products/ZenHub/services/EventService.py =================================================================== --- trunk/Products/ZenHub/services/EventService.py 2007-04-10 22:58:01 UTC (rev 4621) +++ trunk/Products/ZenHub/services/EventService.py 2007-04-11 00:38:45 UTC (rev 4622) @@ -1,3 +1,10 @@ +#! /usr/bin/env python +################################################################# +# +# Copyright (c) 2007 Zenoss, Inc. All rights reserved. +# +################################################################# + from twisted.spread import pb from Products.ZenEvents.Event import Event @@ -11,9 +18,11 @@ 'XMLRPC requests are processed asynchronously in a thread' return self.zem.sendEvent(evt) + def remote_sendEvents(self, evts): return self.zem.sendEvents(evts) + def remote_getDevicePingIssues(self, *args, **kwargs): return self.zem.getDevicePingIssues(*args, **kwargs) Modified: trunk/Products/ZenHub/services/PerformanceConfig.py =================================================================== --- trunk/Products/ZenHub/services/PerformanceConfig.py 2007-04-10 22:58:01 UTC (rev 4621) +++ trunk/Products/ZenHub/services/PerformanceConfig.py 2007-04-11 00:38:45 UTC (rev 4622) @@ -1,10 +1,46 @@ +#! /usr/bin/env python +################################################################# +# +# Copyright (c) 2007 Zenoss, Inc. All rights reserved. +# +################################################################# + from HubService import HubService +from Products.ZenModel.Device import Device +from Acquisition import aq_parent, aq_base + +from twisted.internet import reactor, defer +from sets import Set + +class Procrastinate: + "A class to delay executing a change to a device" + + def __init__(self, cback): + self.cback = cback + self.devices = Set() + self.timer = None + + + def doLater(self, device): + if self.timer and not self.timer.called: + self.timer.cancel() + self.devices.add(device) + self.timer = reactor.callLater(5, self._doNow) + + + def _doNow(self, *unused): + if self.devices: + device = self.devices.pop() + self.cback(device).addBoth(self._doNow) + + class PerformanceConfig(HubService): def __init__(self, dmd, instance): HubService.__init__(self, dmd, instance) self.config = self.dmd.Monitors.Performance._getOb(self.instance) + self.procrastinator = Procrastinate(self.pushConfig) def remote_propertyItems(self): return self.config.propertyItems() @@ -17,11 +53,17 @@ def notifyAll(self, device): if device.perfServer().id == self.instance: - cfg = self.getDeviceConfig(device) - if cfg is not None: - for listener in self.listeners: - self.sendDeviceConfig(listener, cfg) + self.procrastinator.doLater(device) + def pushConfig(self, device): + deferreds = [] + cfg = self.getDeviceConfig(device) + if cfg is not None: + for listener in self.listeners: + print 'sending %s config' % device + deferreds.append(self.sendDeviceConfig(listener, cfg)) + return defer.DeferredList(deferreds) + def getDeviceConfig(self, device): "How to get the config for a device" return None @@ -39,26 +81,36 @@ if isinstance(object, PerformanceConf): for listener in self.listeners: listener.callRemote('setPropertyItems', object.propertyItems()) + devices = [ + (d.id, float(d.getLastChange())) for d in object.devices() + ] + # listener.callRemote('updateDeviceList', devices) + + # device has been changed: + if isinstance(object, Device): + self.notifyAll(object) + return - # somethinge else... hunt around for some devices - from Products.ZenModel.Device import Device + # somethinge else... mark the devices as out-of-date from Products.ZenModel.DeviceClass import DeviceClass - from Acquisition import aq_parent + import transaction while object: # walk up until you hit an organizer or a device if isinstance(object, DeviceClass): for device in object.getSubDevices(): - self.notifyAll(device) + device.setLastChange() + transaction.commit() break if isinstance(object, Device): - self.notifyAll(object) + object.setLastChange() + transaction.commit() break object = aq_parent(object) - def deleted(self, path): + def deleted(self, obj): for listener in self.listeners: - if 'Devices' in path: - listener.callRemote('deleteDevice', path[-1]) + if isinstance(obj, Device): + listener.callRemote('deleteDevice', obj.id) Modified: trunk/Products/ZenHub/services/ProcessConfig.py =================================================================== --- trunk/Products/ZenHub/services/ProcessConfig.py 2007-04-10 22:58:01 UTC (rev 4621) +++ trunk/Products/ZenHub/services/ProcessConfig.py 2007-04-11 00:38:45 UTC (rev 4622) @@ -1,3 +1,10 @@ +#! /usr/bin/env python +################################################################# +# +# Copyright (c) 2007 Zenoss, Inc. All rights reserved. +# +################################################################# + from PerformanceConfig import PerformanceConfig class ProcessConfig(PerformanceConfig): @@ -12,5 +19,5 @@ return device.getOSProcessConf() def sendDeviceConfig(self, listener, config): - listener.callRemote('updateDevice', config) + return listener.callRemote('updateDevice', config) Modified: trunk/Products/ZenHub/services/SnmpPerfConfig.py =================================================================== --- trunk/Products/ZenHub/services/SnmpPerfConfig.py 2007-04-10 22:58:01 UTC (rev 4621) +++ trunk/Products/ZenHub/services/SnmpPerfConfig.py 2007-04-11 00:38:45 UTC (rev 4622) @@ -1,3 +1,10 @@ +#! /usr/bin/env python +################################################################# +# +# Copyright (c) 2007 Zenoss, Inc. All rights reserved. +# +################################################################# + from PerformanceConfig import PerformanceConfig class SnmpPerfConfig(PerformanceConfig): @@ -5,15 +12,19 @@ def remote_getDevices(self, devices=None): return self.config.getDevices(devices) + def remote_getDeviceUpdates(self, devices): return self.config.getDeviceUpdates(devices) + def getDeviceConfig(self, device): return device.getSnmpOidTargets() + def sendDeviceConfig(self, listener, config): - listener.callRemote('updateDeviceConfig', config) + return listener.callRemote('updateDeviceConfig', config) + def update(self, object): from Products.ZenModel.RRDDataSource import RRDDataSource if isinstance(object, RRDDataSource): Modified: trunk/Products/ZenHub/services/XmlRPCConfig.py =================================================================== --- trunk/Products/ZenHub/services/XmlRPCConfig.py 2007-04-10 22:58:01 UTC (rev 4621) +++ trunk/Products/ZenHub/services/XmlRPCConfig.py 2007-04-11 00:38:45 UTC (rev 4622) @@ -1,3 +1,10 @@ +#! /usr/bin/env python +################################################################# +# +# Copyright (c) 2007 Zenoss, Inc. All rights reserved. +# +################################################################# + from PerformanceConfig import PerformanceConfig class XmlRPCConfig(PerformanceConfig): @@ -5,15 +12,19 @@ def remote_getDevices(self, devices=None): return self.config.getDevices(devices) + def remote_getDeviceUpdates(self, devices): return self.config.getDeviceUpdates(devices) + def remote_getXmlRpcDevices(self, *args, **kwargs): return self.config.getXmlRpcDevices(*args, **kwargs) + def getDeviceConfig(self, device): return device.getXmlRpcTargets() + def sendDeviceConfig(self, listener, config): - listener.callRemote('updateDeviceConfig', config) + return listener.callRemote('updateDeviceConfig', config) Modified: trunk/Products/ZenHub/services/ZenRender.py =================================================================== --- trunk/Products/ZenHub/services/ZenRender.py 2007-04-10 22:58:01 UTC (rev 4621) +++ trunk/Products/ZenHub/services/ZenRender.py 2007-04-11 00:38:45 UTC (rev 4622) @@ -1,3 +1,9 @@ +#! /usr/bin/env python +################################################################# +# +# Copyright (c) 2007 Zenoss, Inc. All rights reserved. +# +################################################################# from Products.ZenHub.HubService import HubService from twisted.web import resource, server @@ -8,6 +14,8 @@ import logging log = logging.getLogger("zenrender") +__doc__ = "Provide a simple web server to forward render requests" + class Render(resource.Resource): isLeaf = True @@ -16,6 +24,7 @@ resource.Resource.__init__(self) self.renderers = {} + def render_GET(self, request): gopts = request.args['gopts'][0] drange = request.args['drange'][0] @@ -37,10 +46,12 @@ log.warning("Skipping renderer %s" % instance) raise Exception("No renderer registered") + def getChild(self, path, request): "Handle all paths" return self, () + def addRenderer(self, renderer): self.renderers[renderer.instance] = renderer Modified: trunk/Products/ZenHub/services/__init__.py =================================================================== --- trunk/Products/ZenHub/services/__init__.py 2007-04-10 22:58:01 UTC (rev 4621) +++ trunk/Products/ZenHub/services/__init__.py 2007-04-11 00:38:45 UTC (rev 4622) @@ -1 +1,8 @@ +#! /usr/bin/env python +################################################################# +# +# Copyright (c) 2007 Zenoss, Inc. All rights reserved. +# +################################################################# + "" Modified: trunk/Products/ZenHub/zenhub.py =================================================================== --- trunk/Products/ZenHub/zenhub.py 2007-04-10 22:58:01 UTC (rev 4621) +++ trunk/Products/ZenHub/zenhub.py 2007-04-11 00:38:45 UTC (rev 4622) @@ -1,7 +1,7 @@ #! /usr/bin/env python ################################################################# # -# Copyright (c) 2006 Zenoss, Inc. All rights reserved. +# Copyright (c) 2007 Zenoss, Inc. All rights reserved. # ################################################################# @@ -43,18 +43,25 @@ PB_PORT = 8789 class AuthXmlRpcService(XmlRpcService): + "Provide some level of authentication for XML/RPC calls" def __init__(self, dmd, checker): XmlRpcService.__init__(self, dmd) self.checker = checker + def doRender(self, avatar, request): + "Render after authentication" return XmlRpcService.render(self, request) + def unauthorized(self, request): + "Give a hint to the user that their credentials were bad" self._cbRender(xmlrpc.Fault(self.FAILURE, "Unauthorized"), request) + def render(self, request): + "unpack the authorization header and check the credentials" auth = request.received_headers.get('authorization', None) if not auth: self.unauthorized(request) @@ -75,11 +82,14 @@ self.unauthorized() return server.NOT_DONE_YET + class HubAvitar(pb.Avatar): + "Connect collectors to their configuration Services" def __init__(self, hub): self.hub = hub + def perspective_getService(self, serviceName, instance = None, @@ -91,18 +101,22 @@ class HubRealm(object): + "Gunk needed to connect PB to a login" implements(portal.IRealm) + def __init__(self, hub): self.hubAvitar = HubAvitar(hub) + def requestAvatar(self, collName, mind, *interfaces): if pb.IPerspective not in interfaces: raise NotImplementedError - return pb.IPerspective, self.hubAvitar, lambda:None + return pb.IPerspective, self.hubAvitar, lambda:None + class ZenHub(ZCmdBase): - 'Listen for xmlrpc requests and turn them into events' + 'Listen for change requests provide them to collectors' totalTime = 0. totalEvents = 0 @@ -110,6 +124,7 @@ name = 'zenhub' def __init__(self): + self.changes = [] ZCmdBase.__init__(self) self.zem = self.dmd.ZenEventManager self.services = {} @@ -125,33 +140,63 @@ self.sendEvent(eventClass=App_Start, summary="%s started" % self.name, severity=0) - self.processQueue() + reactor.callLater(5, self.processQueue) + + def zeoConnect(self): + """override the kind of zeo connection we have so we + can get OID invalidations""" + from ZEO.cache import ClientCache as ClientCacheBase + class ClientCache(ClientCacheBase): + def invalidate(s, oid, version, tid): + self.changes.insert(0, oid) + ClientCacheBase.invalidate(s, oid, version, tid) + + from ZEO.ClientStorage import ClientStorage as ClientStorageBase + class ClientStorage(ClientStorageBase): + ClientCacheClass = ClientCache + + # the cache needs to be persistent to get changes + # made when it was not running + if self.options.pcachename is None: + self.options.pcachename = 'zenhub' + storage = ClientStorage((self.options.host, self.options.port), + client=self.options.pcachename, + var=self.options.pcachedir, + cache_size=self.options.pcachesize*1024*1024) + from ZODB import DB + self.db = DB(storage, cache_size=self.options.cachesize) + + def processQueue(self): + "Process detected object changes" self.syncdb() try: - if self.dmd.hubQueue: - self.doProcessQueue(self.dmd.hubQueue) - except Exception: - self.log.exception("Exception processing queue") - transaction.commit() + self.doProcessQueue() + except Exception, ex: + self.log.exception(ex) reactor.callLater(1, self.processQueue) - def doProcessQueue(self, q): - while self.dmd.hubQueue: - path = q.pull() - from Products.ZenUtils.Utils import getObjByPath + + def doProcessQueue(self): + "Process the changes" + while self.changes: + oid = self.changes.pop() + self.log.debug("Got oid %r" % oid) + obj = self.dmd._p_jar[oid] + self.log.debug("Object %r changed" % obj) try: - object = getObjByPath(self.dmd, path) - except NotFound: - self.log.debug("Object %s deleted", "/".join(path)) + obj = obj.__of__(self.dmd).primaryAq() + print "Noticing object %s changed" %obj.getPrimaryUrlPath() + except AttributeError, ex: + print "Noticing object %s" %obj for s in self.services.values(): - s.deleted(path) + s.deleted(obj) else: - self.log.debug("Object %s changed", "/".join(path)) for s in self.services.values(): - s.update(object) + s.update(obj) + def sendEvent(self, **kw): if not 'device' in kw: kw['device'] = getfqdn() @@ -159,15 +204,18 @@ kw['component'] = self.name self.zem.sendEvent(Event(**kw)) + def loadChecker(self): + "Load the password file" try: return checkers.FilePasswordDB(self.options.passwordfile) except Exception, ex: - log.exception("Unable to load %s", self.options.passwordfile) + self.log.exception("Unable to load %s", self.options.passwordfile) return [] def getService(self, name, instance): + "Load services dynamically" try: return self.services[name, instance] except KeyError: @@ -190,24 +238,19 @@ reactor.callLater(seconds, self.heartbeat) - def finish(self): - 'things to do at shutdown: thread cleanup, logs and events' - #self.report() - self.sendEvent(eventClass=App_Stop, - summary="%s stopped" % self.name, - severity=4) - - def sigTerm(self, signum, frame): 'controlled shutdown of main loop on interrupt' try: ZCmdBase.sigTerm(self, signum, frame) except SystemExit: + self.sendEvent(eventClass=App_Stop, + summary="%s stopped" % self.name, + severity=4) if reactor.running: - reactor.stop() + reactor.callLater(1, reactor.stop) + def main(self): - reactor.addSystemEventTrigger('before', 'shutdown', self.finish) reactor.run(installSignalHandlers=False) Modified: trunk/Products/ZenModel/DataRoot.py =================================================================== --- trunk/Products/ZenModel/DataRoot.py 2007-04-10 22:58:01 UTC (rev 4621) +++ trunk/Products/ZenModel/DataRoot.py 2007-04-11 00:38:45 UTC (rev 4622) @@ -204,8 +204,6 @@ def __init__(self, id, title=None): ZenModelRM.__init__(self, id, title) - from zc.queue import PersistentQueue - self.hubQueue = PersistentQueue() def getResultFields(self): """Result fields for dashboard. @@ -463,9 +461,4 @@ if REQUEST is not None: return self.callZenScreen(REQUEST) - def notifyObjectChange(self, object): - path = object.getPrimaryPath() - if len(path) > 2: - self.hubQueue.put(path) - InitializeClass(DataRoot) Modified: trunk/Products/ZenModel/Device.py =================================================================== --- trunk/Products/ZenModel/Device.py 2007-04-10 22:58:01 UTC (rev 4621) +++ trunk/Products/ZenModel/Device.py 2007-04-11 00:38:45 UTC (rev 4622) @@ -27,6 +27,7 @@ from Products.ZenStatus import pingtree from Products.ZenUtils.Graphics import NetworkGraph from Products.ZenUtils.Utils import setWebLoggingStream, clearWebLoggingStream +from Products.ZenUtils import Time import RRDView # base classes for device @@ -58,7 +59,6 @@ from DeviceHW import DeviceHW from ZenStatus import ZenStatus -from ZenDate import ZenDate from Exceptions import * def manage_createDevice(context, deviceName, devicePath="/Discovered", @@ -331,8 +331,8 @@ self._setObject(hw.id, hw) #self.commandStatus = "Not Tested" self._lastPollSnmpUpTime = ZenStatus(0) - self._snmpLastCollection = ZenDate('1968/1/8') - self._lastChange = ZenDate('1968/1/8') + self._snmpLastCollection = 0 + self._lastChange = 0 @@ -378,16 +378,16 @@ if name == 'lastPollSnmpUpTime': return self._lastPollSnmpUpTime.getStatus() elif name == 'snmpLastCollection': - return self._snmpLastCollection.getDate() + return DateTime(self._snmpLastCollection) else: raise AttributeError, name def _setPropValue(self, id, value): - """override from PerpertyManager to handle checks and ip creation""" + """override from PropertyManager to handle checks and ip creation""" self._wrapperCheck(value) if id == 'snmpLastCollection': - self.setSnmpLastCollection(value) + self._snmpLastCollection = float(value) else: ManagedEntity._setPropValue(self, id, value) @@ -440,7 +440,7 @@ procs = [ o.getOSProcessConf() for o in self.os.processes() \ if o.monitored() ] if not procs: return None - return (self.getSnmpConnInfo(), procs) + return (float(self.getLastChange()), self.getSnmpConnInfo(), procs) def getSnmpOidTargets(self): @@ -466,7 +466,8 @@ for o in self.getMonitoredComponents(): cmds.extend(o.getDataSourceCommands()) if cmds: - return (self.id, self.getManageIp(), self.zCommandPort, + return (float(self.getLastChange()), + self.id, self.getManageIp(), self.zCommandPort, self.zCommandUsername, self.zCommandPassword, self.zCommandLoginTimeout, self.zCommandCommandTimeout, self.zKeyPath,self.zMaxOIDPerRequest, @@ -612,24 +613,24 @@ def getLastChange(self): """Return DateTime of last change detected on this device. """ - return self._lastChange.getDate() + return DateTime(float(self._lastChange)) security.declareProtected('View', 'getLastChangeString') def getLastChangeString(self): """Return date string of last change detected on this device. """ - return self._lastChange.getString() + return Time.LocalDateTime(float(self._lastChange)) security.declareProtected('View', 'getSnmpLastCollection') def getSnmpLastCollection(self): - return self._snmpLastCollection.getDate() + return DateTime(float(self._snmpLastCollection)) security.declareProtected('View', 'getSnmpLastCollectionString') def getSnmpLastCollectionString(self): - return self._snmpLastCollection.getString() + return Time.LocalDateTime(float(self._snmpLastCollection)) security.declareProtected('Change Device', 'setManageIp') @@ -879,15 +880,17 @@ def setLastChange(self, value=None): """Set the changed datetime for this device. value default is now. """ - self._lastChange.setDate(value) - self.notifyObjectChange(self) + if value is None: + value = time.time() + self._lastChange = float(value) - security.declareProtected('Change Device', 'setSnmpLastCollection') def setSnmpLastCollection(self, value=None): """Set the last time snmp collection occurred. value default is now. """ - self._snmpLastCollection.setDate(value) + if value is None: + value = time.time() + self._snmpLastCollection = float(value) security.declareProtected('Change Device', 'addManufacturer') @@ -1248,9 +1251,7 @@ """ map(lambda o: o.exportXml(ofile, ignorerels), (self.hw, self.os)) - def zenPropertyOptions(self, propname): - "Provide a set of default options for a ZProperty" if propname == 'zCollectorPlugins': from Products.DataCollector.Plugins import loadPlugins names = loadPlugins(self.dmd).keys() @@ -1258,4 +1259,5 @@ return names return ManagedEntity.zenPropertyOptions(self, propname) + InitializeClass(Device) Modified: trunk/Products/ZenModel/DeviceClass.py =================================================================== --- trunk/Products/ZenModel/DeviceClass.py 2007-04-10 22:58:01 UTC (rev 4621) +++ trunk/Products/ZenModel/DeviceClass.py 2007-04-11 00:38:45 UTC (rev 4622) @@ -673,4 +673,17 @@ if REQUEST: return self.callZenScreen(REQUEST) + def zenPropertyOptions(self, propname): + "Provide a set of default options for a ZProperty" + if propname == 'zCollectorPlugins': + from Products.DataCollector.Plugins import loadPlugins + names = loadPlugins(self.dmd).keys() + names.sort() + return names + return DeviceOrganizer.zenPropertyOptions(self, propname) + + def pushConfig(self): + "This will result in a push of all the devices to live collectors" + self._p_changed = True + InitializeClass(DeviceClass) Modified: trunk/Products/ZenModel/PerformanceConf.py =================================================================== --- trunk/Products/ZenModel/PerformanceConf.py 2007-04-10 22:58:01 UTC (rev 4621) +++ trunk/Products/ZenModel/PerformanceConf.py 2007-04-11 00:38:45 UTC (rev 4622) @@ -215,12 +215,12 @@ pass return result - def getOSProcessConf(self, devname=None): + def getOSProcessConf(self, devices = None): '''Get the OS Process configuration for all devices. ''' result = [] for dev in self.devices(): - if devname and dev.id != devname: continue + if devices and dev.id not in devices: continue dev = dev.primaryAq() if dev.snmpMonitorDevice(): try: @@ -233,12 +233,12 @@ return result - def getDataSourceCommands(self, devname=None): + def getDataSourceCommands(self, devices = None): '''Get the command configuration for all devices. ''' result = [] for dev in self.devices(): - if devname and dev.id != devname: continue + if devices and dev.id not in devices: continue dev = dev.primaryAq() if dev.monitorDevice(): try: Modified: trunk/Products/ZenModel/RRDTemplate.py =================================================================== --- trunk/Products/ZenModel/RRDTemplate.py 2007-04-10 22:58:01 UTC (rev 4621) +++ trunk/Products/ZenModel/RRDTemplate.py 2007-04-11 00:38:45 UTC (rev 4622) @@ -218,6 +218,7 @@ if not ids: return self.callZenScreen(REQUEST) for id in ids: + self._p_changed = True if getattr(self.datasources,id,False): if getattr(self, 'device', False): perfConf = self.device().getPerformanceServer() Modified: trunk/Products/ZenModel/ZenDate.py =================================================================== --- trunk/Products/ZenModel/ZenDate.py 2007-04-10 22:58:01 UTC (rev 4621) +++ trunk/Products/ZenModel/ZenDate.py 2007-04-11 00:38:45 UTC (rev 4622) @@ -24,6 +24,9 @@ date = DateTime(date) self.date = date + def __float__(self): + return float(self.date) + def getDate(self): return self.date Modified: trunk/Products/ZenModel/ZenModelRM.py =================================================================== --- trunk/Products/ZenModel/ZenModelRM.py 2007-04-10 22:58:01 UTC (rev 4621) +++ trunk/Products/ZenModel/ZenModelRM.py 2007-04-11 00:38:45 UTC (rev 4622) @@ -70,7 +70,6 @@ if REQUEST.form.has_key("newId"): redirect = self.rename(REQUEST.form["newId"]) self.manage_changeProperties(**REQUEST.form) - self.notifyObjectChange(self) if REQUEST: from Products.ZenUtils.Time import SaveMessage REQUEST['message'] = SaveMessage() Modified: trunk/Products/ZenModel/migrate/__init__.py =================================================================== --- trunk/Products/ZenModel/migrate/__init__.py 2007-04-10 22:58:01 UTC (rev 4621) +++ trunk/Products/ZenModel/migrate/__init__.py 2007-04-11 00:38:45 UTC (rev 4622) @@ -71,4 +71,6 @@ import zlocal import evenbetterstandarderrormessage import zCollectorPlugins -import hubqueue \ No newline at end of file +import zWinServices +import hubqueue + Deleted: trunk/Products/ZenModel/migrate/hubqueue.py Modified: trunk/Products/ZenModel/migrate/menus.py =================================================================== --- trunk/Products/ZenModel/migrate/menus.py 2007-04-10 22:58:01 UTC (rev 4621) +++ trunk/Products/ZenModel/migrate/menus.py 2007-04-11 00:38:45 UTC (rev 4622) @@ -115,6 +115,11 @@ 'description': 'Edit', 'id': 'editStatusMonitorConf', 'permissions': ('Manage DMD',)}, + {'action': 'pushConfig', + 'allowed_classes': ['DeviceClass', 'Device'], + 'description': 'Push Changes to Collectors', + 'id': 'pushConfig', + 'permissions': ('Change Device',)}, {'action': 'deviceCustomEdit', 'allowed_classes': ['Device'], 'description': 'Custom', Modified: trunk/Products/ZenRRD/RRDDaemon.py =================================================================== --- trunk/Products/ZenRRD/RRDDaemon.py 2007-04-10 22:58:01 UTC (rev 4621) +++ trunk/Products/ZenRRD/RRDDaemon.py 2007-04-11 00:38:45 UTC (rev 4622) @@ -143,6 +143,11 @@ self.log.debug("Async update of collection properties") self.setPropertyItems(items) + + def remote_updateDeviceList(self, devices): + self.log.debug("Async update of device list") + + def setPropertyItems(self, items): 'extract configuration elements used by this server' table = dict(items) Modified: trunk/Products/ZenRRD/zencommand.py =================================================================== --- trunk/Products/ZenRRD/zencommand.py 2007-04-10 22:58:01 UTC (rev 4621) +++ trunk/Products/ZenRRD/zencommand.py 2007-04-11 00:38:45 UTC (rev 4622) @@ -319,6 +319,7 @@ def updateConfig(self, cfg): + self.lastChange = cfg.lastChange self.device = cfg.device self.ipAddress = cfg.ipAddress self.port = cfg.port @@ -374,13 +375,37 @@ def remote_updateConfig(self, config): self.log.debug("Async configuration update") - self.updateConfig([config]) + self.updateConfig([config], [config[1]]) - def updateConfig(self, config): - current = dict([((c.device,c.command), c) for c in self.schedule]) - update = [] + def remote_updateDeviceList(self, devices): + self.log.debug("Async update device list %s" % devices) + updated = [] + lastChanges = dict(devices) # map device name to last change + keep = [] + for cmd in self.schedule: + if cmd.device in lastChanges: + if cmd.lastChange > lastChanges[cmd.device]: + updated.append(device) + keep.append(cmd) + else: + log.info("Removing all commands for %s", cmd.device) + self.schedule = keep + if updated: + log.info("Fetching the config for %s", updated) + d = self.model().callRemote('getDataSourceCommands', devices) + d.addCallback(self.updateConfig, updated) + d.addErrback(self.error) + + def updateConfig(self, config, expected): + expected = Set(expected) + current = {} + for c in self.schedule: + if c.device in expected: + current[c.device,c.command] = c + # keep all the commands we didn't ask for + update = [c for c in self.schedule if c.device not in expected] for c in config: - (device, ipAddress, port, + (lastChange, device, ipAddress, port, username, password, loginTimeout, commandTimeout, keyPath, maxOids, commandPart) = c @@ -390,9 +415,13 @@ (useSsh, cycleTime, component, eventClass, eventKey, severity, command, points) = cmd obj = current.setdefault((device,command), Cmd()) + del current[(device,command)] obj.updateConfig(CommandConfig(locals())) update.append(obj) + for device, command in current.keys(): + log.info("Deleting command %s from %s", device, command) self.schedule = update + self.processSchedule() def heartbeatCycle(self, *ignored): "There is no master 'cycle' to send the hearbeat" @@ -403,6 +432,7 @@ """Run through the schedule and start anything that needs to be done. Set a timer if we have nothing to do. """ + log.info("%s - schedule has %d commands", '-'*10, len(self.schedule)) if not self.options.cycle: for cmd in self.schedule: if cmd.running() or cmd.lastStart == 0: @@ -531,10 +561,13 @@ yield self.model().callRemote('getDefaultRRDCreateCommand') createCommand = driver.next() - + + devices = [] + if self.options.device: + devices = [self.options.device] yield self.model().callRemote('getDataSourceCommands', - self.options.device) - self.updateConfig(driver.next()) + devices) + self.updateConfig(driver.next(), devices) self.rrd = RRDUtil(createCommand, 60) Modified: trunk/Products/ZenRRD/zenperfsnmp.py =================================================================== --- trunk/Products/ZenRRD/zenperfsnmp.py 2007-04-10 22:58:01 UTC (rev 4621) +++ trunk/Products/ZenRRD/zenperfsnmp.py 2007-04-11 00:38:45 UTC (rev 4622) @@ -263,6 +263,24 @@ not self.options.cycle: reactor.callLater(0, reactor.stop) + def remote_updateDeviceList(self, devices): + SnmpDaemon.remote_updateDeviceList(self, devices) + updated = [] + doomed = Set(self.proxies.keys()) + for device, lastChange in devices: + doomed.discard(device) + proxy = self.proxies.get(device) + if not proxy or proxy.lastChange < lastChange: + updated.append(device) + log.info("Deleting %s", doomed) + for d in doomed: + del self.proxies[d] + if updated: + log.info("Fetching configs: %s", updated) + d = self.model().callRemote('getDevices', updated) + d.addCallback(self.updateDeviceList, updated) + d.addErrback(self.error) + def startUpdateConfig(self, driver): 'Periodically ask the Zope server for basic configuration data.' @@ -282,7 +300,7 @@ log.info("fetching configs for %r", devices) yield self.model().callRemote('getDevices', devices) - self.updateDeviceList(devices, driver.next()) + self.updateDeviceList(driver.next(), devices) log.info("fetching snmp status") yield self.model().callRemote('getSnmpStatus', self.options.device) @@ -296,7 +314,7 @@ - def updateDeviceList(self, requested, responses): + def updateDeviceList(self, responses, requested): 'Update the config for devices devices' if self.options.device: self.log.debug('Gathering performance data for %s ' % @@ -323,7 +341,8 @@ log.warning("Warning: device %s has a duplicate address %s", name, proxy.ip) ips.add(ips) - self.log.info('Configured %d devices' % len(deviceNames)) + self.log.info('Configured %d of %d devices', + len(deviceNames), len(self.proxies)) def updateAgentProxy(self, Modified: trunk/Products/ZenRRD/zenprocess.py =================================================================== --- trunk/Products/ZenRRD/zenprocess.py 2007-04-10 22:58:01 UTC (rev 4621) +++ trunk/Products/ZenRRD/zenprocess.py 2007-04-11 00:38:45 UTC (rev 4622) @@ -172,6 +172,7 @@ protocol = None lastScan = 0. snmpStatus = 0 + lastChange = 0 def __init__(self): # map process name to Process object above @@ -263,7 +264,10 @@ self.rrd = RRDUtil(createCommand, self.snmpCycleInterval) - yield self.model().callRemote('getOSProcessConf', self.options.device) + devices = [] + if self.options.device: + devices = [self.options.device] + yield self.model().callRemote('getOSProcessConf', devices) driver.next() return drive(doFetchConfig) @@ -273,35 +277,59 @@ if doomed in self._devices: del self._devices[doomed] + + def remote_updateDeviceList(self, devices): + self.log.debug("Async update device list %s" % devices) + doomed = Set(self._devices.keys()) + updated = [] + for device, lastChange in devices: + cfg = self._devices.get(device, None) + if not cfg or self._devices[device].lastChange < lastChange: + updated.append(device) + doomed.discard(device) + if updated: + log.info("Fetching the config for %s", updated) + d = self.model().callRemote('getOSProcessConf', devices) + d.addCallback(self.updateDevices, updated) + d.addErrback(self.error) + if doomed: + log.info("Removing %s", doomed) + for device in doomed: + del self._devices[device] + + def remote_updateDevice(self, cfg): - name = self.updateDevice(cfg) - self.log.debug("Async config update for %s", name) + self.log.debug("Async config update for %s", cfg[1][0]) + self.updateDevices([cfg],[]) + - def updateDevice(self, cfg): - (name, addr, snmpConf), procs = cfg - community, version, timeout, tries = snmpConf - d = self._devices.setdefault(name, Device()) - d.name = name - d.address = addr - d.community = community - d.version = version - d.timeout = timeout - d.tries = tries - d.updateConfig(procs) - d.protocol = self.snmpPort.protocol - return name + def updateDevices(self, cfgs, fetched): + names = Set() + for cfg in cfgs: + lastChange, (name, addr, snmpConf), procs = cfg + community, version, timeout, tries = snmpConf + names.add(name) + d = self._devices.setdefault(name, Device()) + d.lastChange = lastChange + d.name = name + d.address = addr + d.community = community + d.version = version + d.timeout = timeout + d.tries = tries + d.updateConfig(procs) + d.protocol = self.snmpPort.protocol + for doomed in Set(fetched) - names: + if doomed in self._devices: + del self._devices[doomed] def start(self, driver): 'Read the basic config needed to do anything' log.debug("fetching config") - yield self.fetchConfig(); - n = driver.next() - removed = Set(self._devices.keys()) - for cfg in n: - removed.discard(self.updateDevice(cfg)) - for r in removed: - del self._devices[r] + devices = self._devices.keys() + yield self.fetchConfig() + self.updateDevices(driver.next(), devices) yield self.model().callRemote('getSnmpStatus', self.options.device) self.updateSnmpStatus(driver.next()) @@ -318,6 +346,7 @@ if d: d.snmpStatus = count + def updateProcessStatus(self, status): down = {} for device, component, count in status: Modified: trunk/Products/ZenRelations/PrimaryPathObjectManager.py =================================================================== --- trunk/Products/ZenRelations/PrimaryPathObjectManager.py 2007-04-10 22:58:01 UTC (rev 4621) +++ trunk/Products/ZenRelations/PrimaryPathObjectManager.py 2007-04-11 00:38:45 UTC (rev 4622) @@ -76,17 +76,6 @@ return self.__primary_parent__.primaryAq() - def _noticeChange(self, obj=None): - # the object may not be hooked in to have acquisition yet - try: - if obj is not None: - self.notifyObjectChange(obj) - else: - self.notifyObjectChange(self) - except AttributeError: - pass - - class PrimaryPathObjectManager( RelCopyContainer, ObjectManager, @@ -102,16 +91,13 @@ def _setObject(self, id, obj, roles=None, user=None, set_owner=1): """Track __primary_parent__ when we are set into an object""" - self._noticeChange() obj.__primary_parent__ = aq_base(self) return ObjectManager._setObject(self, id, obj, roles, user, set_owner) def _delObject(self, id, dp=1): """When deleted clear __primary_parent__.""" - self._noticeChange() obj = self._getOb(id) - self._noticeChange(obj) ObjectManager._delObject(self, id, dp) obj.__primary_parent__ = None @@ -122,15 +108,12 @@ """ def _setObject(self, id, obj, roles=None, user=None, set_owner=1): """Track __primary_parent__ when we are set into an object""" - self._noticeChange() obj.__primary_parent__ = aq_base(self) return ObjectManager._setObject(self, id, obj, roles, user, set_owner) def _delObject(self, id, dp=1): """When deleted clear __primary_parent__.""" - self._noticeChange() obj = self._getOb(id) - self._noticeChange(obj) ObjectManager._delObject(self, id, dp) obj.__primary_parent__ = None Modified: trunk/Products/ZenRelations/RelationshipBase.py =================================================================== --- trunk/Products/ZenRelations/RelationshipBase.py 2007-04-10 22:58:01 UTC (rev 4621) +++ trunk/Products/ZenRelations/RelationshipBase.py 2007-04-11 00:38:45 UTC (rev 4622) @@ -87,8 +87,6 @@ def removeRelation(self, obj=None): """remove an object from a relationship""" - self._noticeChange() - self._noticeChange(obj) self._remoteRemove(obj) self._remove(obj) Modified: trunk/Products/ZenRelations/ZenPropertyManager.py =================================================================== --- trunk/Products/ZenRelations/ZenPropertyManager.py 2007-04-10 22:58:01 UTC (rev 4621) +++ trunk/Products/ZenRelations/ZenPropertyManager.py 2007-04-11 00:38:45 UTC (rev 4622) @@ -197,7 +197,6 @@ if type_converters.has_key(ptype): propvalue=type_converters[ptype](propvalue) self._setProperty(propname, propvalue, type=ptype) - self.notifyObjectChange(self) if REQUEST: return self.callZenScreen(REQUEST) @@ -219,7 +218,6 @@ """ if propname: self._delProperty(propname) - self.notifyObjectChange(self) if REQUEST: return self.callZenScreen(REQUEST) Modified: trunk/Products/ZenUtils/ZCmdBase.py =================================================================== --- trunk/Products/ZenUtils/ZCmdBase.py 2007-04-10 22:58:01 UTC (rev 4621) +++ trunk/Products/ZenUtils/ZCmdBase.py 2007-04-11 00:38:45 UTC (rev 4622) @@ -35,19 +35,21 @@ self.app = app self.db = None if not app: - from ZEO import ClientStorage - from ZODB import DB - addr = (self.options.host, self.options.port) - storage=ClientStorage.ClientStorage(addr, - client=self.options.pcachename, - var=self.options.pcachedir, - cache_size=self.options.pcachesize*1024*1024) - self.db=DB(storage, cache_size=self.options.cachesize) - self.poollock = Lock() + self.zeoConnect() + self.poollock = Lock() self.getDataRoot() self.login() + def zeoConnect(self): + from ZEO.ClientStorage import ClientStorage + storage=ClientStorage((self.options.host, self.options.port), + client=self.options.pcachename, + var=self.options.pcachedir, + cache_size=self.options.pcachesize*1024*1024) + from ZODB import DB + self.db = DB(storage, cache_size=self.options.cachesize) + def login(self, name='admin', userfolder=None): '''Logs in.''' if userfolder is None: |
From: <sv...@ze...> - 2007-04-10 22:58:01
|
Author: ecn Date: 2007-04-10 18:58:01 -0400 (Tue, 10 Apr 2007) New Revision: 4621 Modified: trunk/Products/DataCollector/plugins/zenoss/snmp/DellCPUMap.py trunk/Products/DataCollector/plugins/zenoss/snmp/DellPCIMap.py trunk/Products/DataCollector/plugins/zenoss/snmp/RouteMap.py Log: * tired of seeing modelling errors Modified: trunk/Products/DataCollector/plugins/zenoss/snmp/DellCPUMap.py =================================================================== --- trunk/Products/DataCollector/plugins/zenoss/snmp/DellCPUMap.py 2007-04-10 21:00:50 UTC (rev 4620) +++ trunk/Products/DataCollector/plugins/zenoss/snmp/DellCPUMap.py 2007-04-10 22:58:01 UTC (rev 4621) @@ -44,6 +44,8 @@ cpumap = {} for cpu in cputable.values(): om = self.objectMap(cpu) + if not getattr(om, '_manuf', False): + continue try: cpufam = self.cpufamily[cpu['_familyidx']-1] except IndexError: cpufam = "" if not cpufam.startswith(om._manuf): @@ -55,7 +57,7 @@ rm.append(om) for cache in cachetable.values(): - cpu = cpumap.get(cache['cpusock'], None) + cpu = cpumap.get(cache.get('cpusock', None), None) if cpu is None: continue try: level = self.cacheLevel[cache['level']-1] except IndexError: level = None Modified: trunk/Products/DataCollector/plugins/zenoss/snmp/DellPCIMap.py =================================================================== --- trunk/Products/DataCollector/plugins/zenoss/snmp/DellPCIMap.py 2007-04-10 21:00:50 UTC (rev 4620) +++ trunk/Products/DataCollector/plugins/zenoss/snmp/DellPCIMap.py 2007-04-10 22:58:01 UTC (rev 4621) @@ -29,8 +29,11 @@ if not pcitable: return rm = self.relMap() for card in pcitable.values(): - om = self.objectMap(card) - om.id = self.prepId("%s" % om.slot) - om.setProductKey = "%s %s" % (om._manuf, om._model) + try: + om = self.objectMap(card) + om.id = self.prepId("%s" % om.slot) + om.setProductKey = "%s %s" % (om._manuf, om._model) + except AttributeError: + continue rm.append(om) return rm Modified: trunk/Products/DataCollector/plugins/zenoss/snmp/RouteMap.py =================================================================== --- trunk/Products/DataCollector/plugins/zenoss/snmp/RouteMap.py 2007-04-10 21:00:50 UTC (rev 4620) +++ trunk/Products/DataCollector/plugins/zenoss/snmp/RouteMap.py 2007-04-10 22:58:01 UTC (rev 4621) @@ -55,7 +55,8 @@ om.setTarget = om.id + "/" + str(om.routemask) om.id = om.id + "_" + str(om.routemask) if om.routemask == 32: continue - om.routeproto = self.mapSnmpVal(om.routeproto, self.routeProtoMap) + routeproto = getattr(om, 'routeproto', 'other') + om.routeproto = self.mapSnmpVal(routeproto, self.routeProtoMap) if localOnly and om.routeproto != 'local': continue om.routetype = self.mapSnmpVal(om.routetype, self.routeTypeMap) |