Trees | Indices | Help |
|
---|
|
1 ########################################################################### 2 # 3 # This program is part of Zenoss Core, an open source monitoring platform. 4 # Copyright (C) 2007, Zenoss Inc. 5 # 6 # This program is free software; you can redistribute it and/or modify it 7 # under the terms of the GNU General Public License version 2 as published by 8 # the Free Software Foundation. 9 # 10 # For complete information please visit: http://www.zenoss.com/oss/ 11 # 12 ########################################################################### 13 14 __doc__="""BasicDataSource 15 16 Defines attributes for how a datasource will be graphed 17 and builds the nessesary DEF and CDEF statements for it. 18 """ 19 20 import Products.ZenModel.RRDDataSource as RRDDataSource 21 from AccessControl import ClassSecurityInfo, Permissions 22 from Globals import InitializeClass 23 from Products.ZenEvents.ZenEventClasses import Cmd_Fail 24 2527 import string 28 for c in string.whitespace: 29 oid = oid.replace(c, '') 30 oid = oid.strip('.') 31 numbers = oid.split('.') 32 map(int, numbers) 33 if len(numbers) < 3: 34 raise ValueError("OID too short") 35 return oid36 3739 40 sourcetypes = ('SNMP', 'COMMAND') 41 42 sourcetype = 'SNMP' 43 eventClass = Cmd_Fail 44 oid = '' 45 46 usessh = False 47 48 _properties = RRDDataSource.RRDDataSource._properties + ( 49 {'id':'oid', 'type':'string', 'mode':'w'}, 50 {'id':'usessh', 'type':'boolean', 'mode':'w'}, 51 ) 52 53 _relations = RRDDataSource.RRDDataSource._relations + ( 54 ) 55 56 # Screen action bindings (and tab definitions) 57 factory_type_information = ( 58 { 59 'immediate_view' : 'editBasicDataSource', 60 'actions' : 61 ( 62 { 'id' : 'edit' 63 , 'name' : 'Data Source' 64 , 'action' : 'editBasicDataSource' 65 , 'permissions' : ( Permissions.view, ) 66 }, 67 ) 68 }, 69 ) 70 71 security = ClassSecurityInfo() 72 73103 104 InitializeClass(BasicDataSource) 10575 if self.sourcetype == "SNMP": 76 return self.oid 77 if self.sourcetype == "COMMAND": 78 if self.usessh: 79 return self.commandTemplate + " over SSH" 80 else: 81 return self.commandTemplate 82 return RRDDataSource.RRDDataSource.getDescription(self)83 84 89 9092 'add some validation' 93 if REQUEST: 94 oid = REQUEST.get('oid', '') 95 if oid: 96 try: 97 REQUEST.form['oid'] = checkOid(oid) 98 except ValueError: 99 REQUEST['message'] = "%s is an invalid OID" % oid 100 return self.callZenScreen(REQUEST) 101 return RRDDataSource.RRDDataSource.zmanage_editProperties( 102 self, REQUEST)
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0beta1 on Thu Oct 25 16:28:22 2007 | http://epydoc.sourceforge.net |