Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Replacing with Egor's version

  • Loading branch information...
commit a547f74eaf9fa289c8a2c15205dba7711c934984 1 parent d5c5a20
Matt Ray authored

Showing 33 changed files with 0 additions and 5,643 deletions. Show diff stats Hide diff stats

  1. +0 16 ZenPacks.community.RDBMS/COPYRIGHT.txt
  2. +0 1  ZenPacks.community.RDBMS/MANIFEST.in
  3. +0 1  ZenPacks.community.RDBMS/ZenPacks/__init__.py
  4. +0 236 ZenPacks.community.RDBMS/ZenPacks/community/RDBMS/DBSrvInst.py
  5. +0 256 ZenPacks.community.RDBMS/ZenPacks/community/RDBMS/Database.py
  6. +0 226 ZenPacks.community.RDBMS/ZenPacks/community/RDBMS/__init__.py
  7. +0 32 ZenPacks.community.RDBMS/ZenPacks/community/RDBMS/configure.zcml
  8. +0 44 ZenPacks.community.RDBMS/ZenPacks/community/RDBMS/dtml/addDBSrvInst.dtml
  9. +0 44 ZenPacks.community.RDBMS/ZenPacks/community/RDBMS/dtml/addDatabase.dtml
  10. +0 99 ZenPacks.community.RDBMS/ZenPacks/community/RDBMS/info.py
  11. +0 47 ZenPacks.community.RDBMS/ZenPacks/community/RDBMS/interfaces.py
  12. 0  ZenPacks.community.RDBMS/ZenPacks/community/RDBMS/modeler/__init__.py
  13. 0  ZenPacks.community.RDBMS/ZenPacks/community/RDBMS/modeler/plugins/__init__.py
  14. +0 1  ZenPacks.community.RDBMS/ZenPacks/community/RDBMS/modeler/plugins/community/__init__.py
  15. +0 111 ZenPacks.community.RDBMS/ZenPacks/community/RDBMS/modeler/plugins/community/snmp/DatabaseMap.py
  16. +0 1  ZenPacks.community.RDBMS/ZenPacks/community/RDBMS/modeler/plugins/community/snmp/__init__.py
  17. +0 3,533 ZenPacks.community.RDBMS/ZenPacks/community/RDBMS/objects/objects.xml
  18. +0 96 ZenPacks.community.RDBMS/ZenPacks/community/RDBMS/reports/Performance_Reports/Database_Util_Report.rpt
  19. +0 53 ZenPacks.community.RDBMS/ZenPacks/community/RDBMS/reports/plugins/databases.py
  20. +0 165 ZenPacks.community.RDBMS/ZenPacks/community/RDBMS/resources/RDBMS.js
  21. +0 133 ZenPacks.community.RDBMS/ZenPacks/community/RDBMS/skins/ZenPacks.community.RDBMS/deviceSwCdatabasesDetail.pt
  22. +0 103 ...ks.community.RDBMS/ZenPacks/community/RDBMS/skins/ZenPacks.community.RDBMS/deviceSwCdbsrvinstancesDetail.pt
  23. +0 24 ZenPacks.community.RDBMS/ZenPacks/community/RDBMS/skins/ZenPacks.community.RDBMS/dialog_addDBSrvInst.pt
  24. +0 24 ZenPacks.community.RDBMS/ZenPacks/community/RDBMS/skins/ZenPacks.community.RDBMS/dialog_addDatabase.pt
  25. +0 14 ZenPacks.community.RDBMS/ZenPacks/community/RDBMS/skins/ZenPacks.community.RDBMS/dialog_deleteDBSrvInst.pt
  26. +0 14 ZenPacks.community.RDBMS/ZenPacks/community/RDBMS/skins/ZenPacks.community.RDBMS/dialog_deleteDatabases.pt
  27. +0 25 ZenPacks.community.RDBMS/ZenPacks/community/RDBMS/skins/ZenPacks.community.RDBMS/dialog_lockDBSrvInst.pt
  28. +0 25 ZenPacks.community.RDBMS/ZenPacks/community/RDBMS/skins/ZenPacks.community.RDBMS/dialog_lockDatabases.pt
  29. +0 51 ZenPacks.community.RDBMS/ZenPacks/community/RDBMS/skins/ZenPacks.community.RDBMS/viewDBSrvInst.pt
  30. +0 129 ZenPacks.community.RDBMS/ZenPacks/community/RDBMS/skins/ZenPacks.community.RDBMS/viewDBSrvInstDatabases.pt
  31. +0 69 ZenPacks.community.RDBMS/ZenPacks/community/RDBMS/skins/ZenPacks.community.RDBMS/viewDatabase.pt
  32. +0 1  ZenPacks.community.RDBMS/ZenPacks/community/__init__.py
  33. +0 69 ZenPacks.community.RDBMS/setup.py
16 ZenPacks.community.RDBMS/COPYRIGHT.txt
... ... @@ -1,16 +0,0 @@
1  ZenPacks.community.RDBMS/MANIFEST.in
... ... @@ -1 +0,0 @@
1   -graft ZenPacks
1  ZenPacks.community.RDBMS/ZenPacks/__init__.py
... ... @@ -1 +0,0 @@
1   -__import__('pkg_resources').declare_namespace(__name__)
236 ZenPacks.community.RDBMS/ZenPacks/community/RDBMS/DBSrvInst.py
... ... @@ -1,236 +0,0 @@
1   -################################################################################
2   -#
3   -# This program is part of the RDBMS Zenpack for Zenoss.
4   -# Copyright (C) 2009, 2010 Egor Puzanov.
5   -#
6   -# This program can be used under the GNU General Public License version 2
7   -# You can find full information here: http://www.zenoss.com/oss
8   -#
9   -################################################################################
10   -
11   -__doc__="""DBSrvInst
12   -
13   -DBSrvInst is a DBSrvInst
14   -
15   -$Id: DBSrvInst.py,v 1.2 2010/09/26 23:59:39 egor Exp $"""
16   -
17   -__version__ = "$Revision: 1.2 $"[11:-2]
18   -
19   -from Globals import InitializeClass, DTMLFile
20   -from ZenPacks.community.deviceAdvDetail.HWStatus import *
21   -from Products.ZenModel.ZenPackPersistence import ZenPackPersistence
22   -from Products.ZenModel.ZenossSecurity import *
23   -from Products.ZenUtils.Utils import prepId
24   -from Products.ZenRelations.RelSchema import *
25   -from Products.ZenWidgets import messaging
26   -
27   -from Products.ZenModel.DeviceComponent import DeviceComponent
28   -from Products.ZenModel.Software import Software
29   -from Products.ZenModel.MEProduct import MEProduct
30   -
31   -def manage_addDBSrvInst(context, id, userCreated, REQUEST=None):
32   - """make a database"""
33   - dbsiid = prepId(id)
34   - dbsi = DBSrvInst(dbsiid)
35   - context._setObject(dbsiid, dbsi)
36   - dbsi = context._getOb(dbsiid)
37   - dbsi.dbsiname = id
38   - if userCreated: dbsi.setUserCreateFlag()
39   - if REQUEST is not None:
40   - REQUEST['RESPONSE'].redirect(context.absolute_url()+'/manage_main')
41   -
42   -addDBSrvInst = DTMLFile('dtml/addDBSrvInst',globals())
43   -
44   -class DBSrvInst(ZenPackPersistence, DeviceComponent, Software, HWStatus):
45   - """
46   - DBSrvInst object
47   - """
48   -
49   - ZENPACKID = 'ZenPacks.community.RDBMS'
50   -
51   - portal_type = meta_type = 'DBSrvInst'
52   -
53   - manage_editDBSrvInstForm = DTMLFile('dtml/manageDBSrvInst',globals())
54   -
55   - isUserCreatedFlag = False
56   - snmpindex = ""
57   - dbsiname = ""
58   - contact = ""
59   - status = 0
60   -
61   - statusmap ={0: (DOT_GREEN, SEV_CLEAN, 'Up'),
62   - 1: (DOT_RED, SEV_CRITICAL, 'Down'),
63   - }
64   -
65   - _properties = Software._properties + (
66   - {'id':'snmpindex', 'type':'string', 'mode':'w'},
67   - {'id':'dbsiname', 'type':'string', 'mode':'w'},
68   - {'id':'contact', 'type':'string', 'mode':'w'},
69   - {'id':'status', 'type':'int', 'mode':'w'},
70   - )
71   -
72   -
73   - _relations = MEProduct._relations + (
74   - ("os", ToOne(ToManyCont, "Products.ZenModel.OperatingSystem", "softwaredbsrvinstances")),
75   - ("databases", ToMany(ToOne, "ZenPacks.community.RDBMS.Database", "dbsrvinstance")),
76   - )
77   -
78   -
79   - factory_type_information = (
80   - {
81   - 'id' : 'DBSrvInst',
82   - 'meta_type' : 'DBSrvInst',
83   - 'description' : """Arbitrary device grouping class""",
84   - 'icon' : 'FileSystem_icon.gif',
85   - 'product' : 'RDBMS',
86   - 'factory' : 'manage_addDBSrvInst',
87   - 'immediate_view' : 'viewDBSrvInst',
88   - 'actions' :
89   - (
90   - { 'id' : 'status'
91   - , 'name' : 'Status'
92   - , 'action' : 'viewDBSrvInst'
93   - , 'permissions' : (ZEN_VIEW,)
94   - },
95   - { 'id' : 'databases'
96   - , 'name' : 'Databases'
97   - , 'action' : 'viewDBSrvInstDatabases'
98   - , 'permissions' : (ZEN_VIEW,)
99   - },
100   - { 'id' : 'events'
101   - , 'name' : 'Events'
102   - , 'action' : 'viewEvents'
103   - , 'permissions' : (ZEN_VIEW,)
104   - },
105   - { 'id' : 'perfConf'
106   - , 'name' : 'Template'
107   - , 'action' : 'objTemplates'
108   - , 'permissions' : (ZEN_CHANGE_DEVICE,)
109   - },
110   - { 'id' : 'viewHistory'
111   - , 'name' : 'Modifications'
112   - , 'action' : 'viewHistory'
113   - , 'permissions' : (ZEN_VIEW_MODIFICATIONS,)
114   - },
115   - )
116   - },
117   - )
118   -
119   -
120   - def setUserCreateFlag(self):
121   - """
122   - Sets self.isUserCreatedFlag to True. This indicated that the
123   - component was created by a user rather than via modelling.
124   - """
125   - self.isUserCreatedFlag = True
126   -
127   -
128   - def isUserCreated(self):
129   - """
130   - Returns the value of isUserCreated. See setUserCreatedFlag() above.
131   - """
132   - return self.isUserCreatedFlag
133   -
134   -
135   - def device(self):
136   - """
137   - Return our device object for DeviceResultInt.
138   - """
139   - os = self.os()
140   - if os: return os.device()
141   -
142   -
143   - def manage_deleteComponent(self, REQUEST=None):
144   - """
145   - Delete OSComponent
146   - """
147   - url = None
148   - if REQUEST is not None:
149   - url = self.device().os.absolute_url()
150   - self.getPrimaryParent()._delObject(self.id)
151   - '''
152   - eventDict = {
153   - 'eventClass': Change_Remove,
154   - 'device': self.device().id,
155   - 'component': self.id or '',
156   - 'summary': 'Deleted by user: %s' % 'user',
157   - 'severity': Event.Info,
158   - }
159   - self.dmd.ZenEventManager.sendEvent(eventDict)
160   - '''
161   - if REQUEST is not None:
162   - REQUEST['RESPONSE'].redirect(url)
163   -
164   -
165   - def manage_updateComponent(self, datamap, REQUEST=None):
166   - """
167   - Update OSComponent
168   - """
169   - url = None
170   - if REQUEST is not None:
171   - url = self.device().os.absolute_url()
172   - self.getPrimaryParent()._updateObject(self, datamap)
173   - '''
174   - eventDict = {
175   - 'eventClass': Change_Set,
176   - 'device': self.device().id,
177   - 'component': self.id or '',
178   - 'summary': 'Updated by user: %s' % 'user',
179   - 'severity': Event.Info,
180   - }
181   - self.dmd.ZenEventManager.sendEvent(eventDict)
182   - '''
183   - if REQUEST is not None:
184   - REQUEST['RESPONSE'].redirect(url)
185   -
186   -
187   - def getPrettyLink(self):
188   - """
189   - Gets a link to this object, plus an icon
190   - """
191   - template = ("<a href='%s' class='prettylink'>"
192   - "<div class='device-icon-container'> "
193   - "<img class='device-icon' src='%s'/> "
194   - "</div>%s</a>")
195   - icon = self.getIconPath()
196   - href = self.getPrimaryUrlPath()
197   - name = self.titleOrId()
198   - return template % (href, icon, name)
199   -
200   - def viewName(self):
201   - """
202   - Return the name of a DB Server Instance
203   - """
204   - return self.dbsiname
205   - name = viewName
206   -
207   - def getRRDTemplates(self):
208   - """
209   - Return the RRD Templates list
210   - """
211   - templates = []
212   - for tname in [self.__class__.__name__]:
213   - templ = self.getRRDTemplateByName(tname)
214   - if templ: templates.append(templ)
215   - return templates
216   -
217   - def manage_editDBSrvInst(self, monitor=False, dbsiname=None, REQUEST=None):
218   - """
219   - Edit a DB Server Instance from a web page.
220   - """
221   - if dbsiname:
222   - self.dbsiname = dbsiname
223   -
224   - self.monitor = monitor
225   - self.index_object()
226   -
227   - if REQUEST:
228   - REQUEST['message'] = "DB Server Instance updated"
229   - messaging.IMessageSender(self).sendToBrowser(
230   - 'DB Server Instance Updated',
231   - 'DB Server Instance %s was updated.' % dbsiname
232   - )
233   - return self.callZenScreen(REQUEST)
234   -
235   -
236   -InitializeClass(DBSrvInst)
256 ZenPacks.community.RDBMS/ZenPacks/community/RDBMS/Database.py
... ... @@ -1,256 +0,0 @@
1   -################################################################################
2   -#
3   -# This program is part of the RDBMS Zenpack for Zenoss.
4   -# Copyright (C) 2009, 2010 Egor Puzanov.
5   -#
6   -# This program can be used under the GNU General Public License version 2
7   -# You can find full information here: http://www.zenoss.com/oss
8   -#
9   -################################################################################
10   -
11   -__doc__="""Database
12   -
13   -Database is a Database
14   -
15   -$Id: Database.py,v 1.4 2010/09/27 00:02:29 egor Exp $"""
16   -
17   -__version__ = "$Revision: 1.4 $"[11:-2]
18   -
19   -from Globals import InitializeClass, DTMLFile
20   -from AccessControl import ClassSecurityInfo
21   -from ZenPacks.community.deviceAdvDetail.HWStatus import *
22   -from Products.ZenModel.OSComponent import OSComponent
23   -from Products.ZenModel.ZenDate import ZenDate
24   -from Products.ZenModel.ZenPackPersistence import ZenPackPersistence
25   -from Products.ZenModel.ZenossSecurity import *
26   -from Products.ZenUtils.Utils import convToUnits, prepId
27   -from Products.ZenRelations.RelSchema import *
28   -from Products.ZenWidgets import messaging
29   -
30   -
31   -def manage_addDatabase(context, id, userCreated, REQUEST=None):
32   - """make a database"""
33   - dbid = prepId(id)
34   - db = Database(dbid)
35   - context._setObject(dbid, db)
36   - db = context._getOb(dbid)
37   - db.dbname = id
38   - if userCreated: db.setUserCreateFlag()
39   - if REQUEST is not None:
40   - REQUEST['RESPONSE'].redirect(context.absolute_url()+'/manage_main')
41   -
42   -addDatabase = DTMLFile('dtml/addDatabase',globals())
43   -
44   -class Database(ZenPackPersistence, OSComponent, HWStatus):
45   - """
46   - Database object
47   - """
48   -
49   - ZENPACKID = 'ZenPacks.community.RDBMS'
50   -
51   - portal_type = meta_type = 'Database'
52   -
53   - manage_editDatabaseForm = DTMLFile('dtml/manageDatabase',globals())
54   -
55   - dbname = ""
56   - type = "RDBMS Database"
57   - contact = ""
58   - version = ""
59   - activeTime = ""
60   - totalBlocks = 0L
61   - blockSize = 1L
62   - status = 1
63   -
64   - statusmap ={1: (DOT_GREY, SEV_WARNING, 'Unknown'),
65   - 2: (DOT_GREEN, SEV_CLEAN, 'Active'),
66   - 3: (DOT_YELLOW, SEV_WARNING, 'Available'),
67   - 4: (DOT_ORANGE, SEV_ERROR, 'Restricted'),
68   - 5: (DOT_RED, SEV_CRITICAL, 'Unavailable'),
69   - }
70   -
71   - _properties = OSComponent._properties + (
72   - {'id':'dbname', 'type':'string', 'mode':'w'},
73   - {'id':'type', 'type':'string', 'mode':'w'},
74   - {'id':'contact', 'type':'string', 'mode':'w'},
75   - {'id':'version', 'type':'string', 'mode':'w'},
76   - {'id':'activeTime', 'type':'string', 'mode':'w'},
77   - {'id':'totalBlocks', 'type':'long', 'mode':'w'},
78   - {'id':'blockSize', 'type':'long', 'mode':'w'},
79   - {'id':'status', 'type':'int', 'mode':'w'},
80   - )
81   -
82   - _relations = OSComponent._relations + (
83   - ("os", ToOne(ToManyCont, "Products.ZenModel.OperatingSystem", "softwaredatabases")),
84   - ("dbsrvinstance", ToOne(ToMany, "ZenPacks.community.RDBMS.DBSrvInst", "databases")),
85   - )
86   -
87   - factory_type_information = (
88   - {
89   - 'id' : 'Database',
90   - 'meta_type' : 'Database',
91   - 'description' : """Arbitrary device grouping class""",
92   - 'icon' : 'FileSystem_icon.gif',
93   - 'product' : 'RDBMS',
94   - 'factory' : 'manage_addDatabase',
95   - 'immediate_view' : 'viewDatabase',
96   - 'actions' :
97   - (
98   - { 'id' : 'status'
99   - , 'name' : 'Status'
100   - , 'action' : 'viewDatabase'
101   - , 'permissions' : (ZEN_VIEW,)
102   - },
103   - { 'id' : 'events'
104   - , 'name' : 'Events'
105   - , 'action' : 'viewEvents'
106   - , 'permissions' : (ZEN_VIEW, )
107   - },
108   - { 'id' : 'perfConf'
109   - , 'name' : 'Template'
110   - , 'action' : 'objTemplates'
111   - , 'permissions' : (ZEN_CHANGE_DEVICE, )
112   - },
113   - { 'id' : 'viewHistory'
114   - , 'name' : 'Modifications'
115   - , 'action' : 'viewHistory'
116   - , 'permissions' : (ZEN_VIEW_MODIFICATIONS,)
117   - },
118   - )
119   - },
120   - )
121   -
122   - security = ClassSecurityInfo()
123   -
124   - security.declareProtected(ZEN_CHANGE_DEVICE, 'setDBSrvInst')
125   - def setDBSrvInst(self, instname):
126   - """
127   - Set the dbsrvinstance relationship to the DB Server Instance specified
128   - by the given instance name.
129   - """
130   - dbsrvinst = None
131   - for inst in self.os().softwaredbsrvinstances():
132   - if inst.dbsiname != instname: continue
133   - dbsrvinst = inst
134   - break
135   - if dbsrvinst: self.dbsrvinstance.addRelation(dbsrvinst)
136   - else: log.warn("DB Server Instance:%s not found", instname)
137   -
138   - security.declareProtected(ZEN_VIEW, 'getDBSrvInst')
139   - def getDBSrvInst(self):
140   - try: return self.dbsrvinstance()
141   - except: return None
142   -
143   - def getDBSrvInstLink(self):
144   - dbsi = self.dbsrvinstance()
145   - if dbsi: return dbsi.urlLink(text=str(dbsi.dbsiname),
146   - attrs={'target':'_top'})
147   - else: return ""
148   -
149   - def dbSrvInstName(self):
150   - """
151   - Return the Database Server Instance Name
152   - """
153   - dbsi = self.dbsrvinstance()
154   - return dbsi and dbsi.dbsiname or ''
155   -
156   - def totalBytes(self):
157   - """
158   - Return the number of allocated bytes
159   - """
160   - return long(self.totalBlocks) * long(self.blockSize)
161   -
162   - def totalString(self):
163   - """
164   - Return the number of allocated bytes in human readable form ie 10MB
165   - """
166   - sas = self.totalBytes()
167   - return convToUnits(sas)
168   -
169   - def usedBytes(self):
170   - """
171   - Return the number of used bytes
172   - """
173   - su = self.cacheRRDValue('sizeUsed_sizeUsed', 0)
174   - return long(su) * long(self.blockSize)
175   -
176   - def usedString(self):
177   - """
178   - Return the number of used bytes in human readable form ie 10MB
179   - """
180   - sus = self.usedBytes()
181   - return convToUnits(sus)
182   -
183   - def blockSizeString(self):
184   - """
185   - Return the size of unit in bytes in human readable form ie 10MB
186   - """
187   - sus = long(self.blockSize)
188   - return convToUnits(sus)
189   -
190   - def availString(self):
191   - """
192   - Return the Available bytes in human readable form ie 10MB
193   - """
194   - sa = long(self.totalBytes()) - long(self.usedBytes())
195   - if 0 > sa: sa = 0
196   - return convToUnits(sa)
197   -
198   - def capacity(self):
199   - """
200   - Return the percentage capacity of a database using its rrd file
201   - """
202   - __pychecker__='no-returnvalues'
203   - usedBytes = long(self.usedBytes())
204   - totalBytes = long(self.totalBytes())
205   - if usedBytes > 0 and totalBytes > 0:
206   - return int(100.0 * usedBytes / totalBytes)
207   - return 'Unknown'
208   -
209   - def getRRDNames(self):
210   - """
211   - Return the datapoint name of this Database
212   - """
213   - return ['sizeUsed_sizeUsed']
214   -
215   - def viewName(self):
216   - """
217   - Return the name of a Database
218   - """
219   - return self.dbname
220   - name = viewName
221   -
222   - def getRRDTemplates(self):
223   - """
224   - Return the RRD Templates list
225   - """
226   - templates = []
227   - for tname in [self.__class__.__name__]:
228   - templ = self.getRRDTemplateByName(tname)
229   - if templ: templates.append(templ)
230   - return templates
231   -
232   - def manage_editDatabase(self, monitor=False,
233   - dbname=None, type=None, blockSizes=None,
234   - totalBlocks=None, REQUEST=None):
235   - """
236   - Edit a Database from a web page.
237   - """
238   - if dbname:
239   - self.dbname = dbname
240   - self.type = type
241   - self.blockSize = blockSize
242   - self.totalBlocks = totalBlocks
243   -
244   - self.monitor = monitor
245   - self.index_object()
246   -
247   - if REQUEST:
248   - REQUEST['message'] = "Database updated"
249   - messaging.IMessageSender(self).sendToBrowser(
250   - 'Database Updated',
251   - 'Database %s was updated.' % dbname
252   - )
253   - return self.callZenScreen(REQUEST)
254   -
255   -
256   -InitializeClass(Database)
226 ZenPacks.community.RDBMS/ZenPacks/community/RDBMS/__init__.py
... ... @@ -1,226 +0,0 @@
1   -
2   -import Globals
3   -import os.path
4   -
5   -skinsDir = os.path.join(os.path.dirname(__file__), 'skins')
6   -from Products.CMFCore.DirectoryView import registerDirectory
7   -if os.path.isdir(skinsDir):
8   - registerDirectory(skinsDir, globals())
9   -
10   -from Products.ZenUtils.Utils import prepId
11   -from Products.ZenWidgets import messaging
12   -from Database import manage_addDatabase
13   -from DBSrvInst import manage_addDBSrvInst
14   -
15   -def addDatabase(self, id, userCreated, REQUEST=None):
16   - """Add a Database.
17   - """
18   - dbid = prepId(id)
19   - manage_addDatabase(self.softwaredatabases, id, userCreated)
20   - self._p_changed = True
21   - if REQUEST:
22   - messaging.IMessageSender(self).sendToBrowser(
23   - 'Database Created',
24   - 'Database %s was created.' % id
25   - )
26   - REQUEST['RESPONSE'].redirect(
27   - self.softwaredatabases._getOb(dbid).absolute_url())
28   - return self.callZenScreen(REQUEST)
29   -
30   -def deleteDatabases(self, componentNames=[], REQUEST=None):
31   - """Delete Databases"""
32   - self.deleteDeviceComponents(self.softwaredatabases, componentNames, REQUEST)
33   - if REQUEST:
34   - messaging.IMessageSender(self).sendToBrowser(
35   - 'Databases Deleted',
36   - 'Databases %s were deleted.' % (', '.join(componentNames))
37   - )
38   - REQUEST['RESPONSE'].redirect(self.absolute_url())
39   - return self.callZenScreen(REQUEST)
40   -
41   -def unlockDatabases(self, componentNames=[], REQUEST=None):
42   - """Unlock Databases"""
43   - self.unlockDeviceComponents(self.softwaredatabases, componentNames, REQUEST)
44   - if REQUEST:
45   - messaging.IMessageSender(self).sendToBrowser(
46   - 'Databases Unlocked',
47   - 'Databases %s were unlocked.' % (', '.join(componentNames))
48   - )
49   - REQUEST['RESPONSE'].redirect(self.absolute_url())
50   - return self.callZenScreen(REQUEST)
51   -
52   -def lockDatabasesFromDeletion(self, componentNames=[],
53   - sendEventWhenBlocked=None, REQUEST=None):
54   - """Lock Databases from deletion"""
55   - self.lockDeviceComponentsFromDeletion(self.softwaredatabases, componentNames,
56   - sendEventWhenBlocked, REQUEST)
57   - if REQUEST:
58   - messaging.IMessageSender(self).sendToBrowser(
59   - 'Databases Locked',
60   - 'Databases %s were locked from deletion.' % (
61   - ', '.join(componentNames))
62   - )
63   - REQUEST['RESPONSE'].redirect(self.absolute_url())
64   - return self.callZenScreen(REQUEST)
65   -
66   -def lockDatabasesFromUpdates(self, componentNames=[],
67   - sendEventWhenBlocked=None, REQUEST=None):
68   - """Lock Databases from updates"""
69   - self.lockDeviceComponentsFromUpdates(self.softwaredatabases, componentNames,
70   - sendEventWhenBlocked, REQUEST)
71   - if REQUEST:
72   - messaging.IMessageSender(self).sendToBrowser(
73   - 'Databases Locked',
74   - 'Databases %s were locked from updates and deletion.' % (
75   - ', '.join(componentNames))
76   - )
77   - REQUEST['RESPONSE'].redirect(self.absolute_url())
78   - return self.callZenScreen(REQUEST)
79   -
80   -def addDBSrvInst(self, id, userCreated, REQUEST=None):
81   - """Add a DBSrvInst.
82   - """
83   - dbsiid = prepId(id)
84   - manage_addDBSrvInst(self.softwaredbsrvinstances, id, userCreated)
85   - self._p_changed = True
86   - if REQUEST:
87   - messaging.IMessageSender(self).sendToBrowser(
88   - 'Database Server Instance Created',
89   - 'Database Server Instance %s was created.' % id
90   - )
91   - REQUEST['RESPONSE'].redirect(
92   - self.softwaredatabases._getOb(dbid).absolute_url())
93   - return self.callZenScreen(REQUEST)
94   -
95   -def deleteDBSrvInsts(self, componentNames=[], REQUEST=None):
96   - """Delete DBSrvInsts"""
97   -# databases = []
98   -# for dbsi in self.softwaredbsrvinstances():
99   -# if dbsi.id not in componentNames: continue
100   -# databases.extend(db.id for db in dbsi.databases())
101   -# if databases:
102   -# self.deleteDeviceComponents(self.softwaredatabases, databases, None)
103   - self.deleteDeviceComponents(self.softwaredbsrvinstances, componentNames, REQUEST)
104   - if REQUEST:
105   - messaging.IMessageSender(self).sendToBrowser(
106   - 'Database Server Instances Deleted',
107   - 'Database Server Instances %s were deleted.' % (', '.join(componentNames))
108   - )
109   - REQUEST['RESPONSE'].redirect(self.absolute_url())
110   - return self.callZenScreen(REQUEST)
111   -
112   -def unlockDBSrvInsts(self, componentNames=[], REQUEST=None):
113   - """Unlock DBSrvInsts"""
114   - self.unlockDeviceComponents(self.softwaredbsrvinstances, componentNames, REQUEST)
115   - if REQUEST:
116   - messaging.IMessageSender(self).sendToBrowser(
117   - 'Database Server Instances Unlocked',
118   - 'Database Server Instances %s were unlocked.' % (', '.join(componentNames))
119   - )
120   - REQUEST['RESPONSE'].redirect(self.absolute_url())
121   - return self.callZenScreen(REQUEST)
122   -
123   -def lockDBSrvInstsFromDeletion(self, componentNames=[],
124   - sendEventWhenBlocked=None, REQUEST=None):
125   - """Lock DBSrvInsts from deletion"""
126   - self.lockDeviceComponentsFromDeletion(self.softwaredbsrvinstances, componentNames,
127   - sendEventWhenBlocked, REQUEST)
128   - if REQUEST:
129   - messaging.IMessageSender(self).sendToBrowser(
130   - 'Database Server Instances Locked',
131   - 'Database Server Instances %s were locked from deletion.' % (
132   - ', '.join(componentNames))
133   - )
134   - REQUEST['RESPONSE'].redirect(self.absolute_url())
135   - return self.callZenScreen(REQUEST)
136   -
137   -def lockDBSrvInstsFromUpdates(self, componentNames=[],
138   - sendEventWhenBlocked=None, REQUEST=None):
139   - """Lock DBSrvInsts from updates"""
140   - self.lockDeviceComponentsFromUpdates(self.softwaredbsrvinstances, componentNames,
141   - sendEventWhenBlocked, REQUEST)
142   - if REQUEST:
143   - messaging.IMessageSender(self).sendToBrowser(
144   - 'Database Server Instances Locked',
145   - 'Database Server Instances %s were locked from updates and deletion.' % (
146   - ', '.join(componentNames))
147   - )
148   - REQUEST['RESPONSE'].redirect(self.absolute_url())
149   - return self.callZenScreen(REQUEST)
150   -
151   -from Products.ZenModel.OperatingSystem import OperatingSystem
152   -from Products.ZenRelations.RelSchema import *
153   -OperatingSystem._relations += (("softwaredatabases", ToManyCont(ToOne,
154   - "ZenPacks.community.RDBMS.Database", "os")),
155   - ("softwaredbsrvinstances", ToManyCont(ToOne,
156   - "ZenPacks.community.RDBMS.DBSrvInst", "os")),
157   - )
158   -OperatingSystem.addDatabase = addDatabase
159   -OperatingSystem.deleteDatabases = deleteDatabases
160   -OperatingSystem.unlockDatabases = unlockDatabases
161   -OperatingSystem.lockDatabasesFromDeletion = lockDatabasesFromDeletion
162   -OperatingSystem.lockDatabasesFromUpdates = lockDatabasesFromUpdates
163   -OperatingSystem.addDBSrvInst = addDBSrvInst
164   -OperatingSystem.deleteDBSrvInsts = deleteDBSrvInsts
165   -OperatingSystem.unlockDBSrvInsts = unlockDBSrvInsts
166   -OperatingSystem.lockDBSrvInstsFromDeletion = lockDBSrvInstsFromDeletion
167   -OperatingSystem.lockDBSrvInstsFromUpdates = lockDBSrvInstsFromUpdates
168   -
169   -from Products.ZenModel.ZenPack import ZenPackBase
170   -from Products.ZenUtils.ZenScriptBase import ZenScriptBase
171   -class ZenPack(ZenPackBase):
172   - """ Database loader
173   - """
174   -
175   - def _removeMenu(self, menuName):
176   - zm = getattr(self.dmd.zenMenus, menuName, None)
177   - if not zm: return
178   - for mi in zm.zenMenuItems():
179   - zm.zenMenuItems._delObject(mi.id)
180   - self.dmd.zenMenus._delObject(menuName)
181   -
182   - def _addMenu(self, mN, mD):
183   - if hasattr(self.dmd.zenMenus, mN): self._removeMenu(mN)
184   - self.dmd.zenMenus.manage_addZenMenu(mN)
185   - zm = getattr(self.dmd.zenMenus, mN)
186   - miparams = (('add%s'%mN, 'Add %s...'%mN, 'dialod_add%s'%mN, 90.0),
187   - ('delete%ss'%mN, 'Delete %s...'%mN, 'dialod_delete%ss'%mN, 80.0),
188   - ('lock%ss'%mN, 'Lock %s...'%mN, 'dialod_lock%ss'%mN, 70.0),
189   - ('changeMonitoring', 'Monitoring...', 'dialod_changeMonitoring', 0.0))
190   - for param in miparams:
191   - zm.manage_addZenMenuItem(id=param[0],
192   - description=param[1],
193   - action=param[2],
194   - permissions=('View',),
195   - isdialog=True,
196   - isglobal=True,
197   - ordering=param[3])
198   -
199   - def install(self, app):
200   - self._removeMenu('Database')
201   - self._addMenu('Database', 'Database')
202   - self._removeMenu('DBSrvInst')
203   - self._addMenu('DBSrvInst', 'Database Server Instance')
204   - ZenPackBase.install(self, app)
205   - for d in self.dmd.Devices.getSubDevices():
206   - d.os.buildRelations()
207   -
208   - def upgrade(self, app):
209   - ZenPackBase.upgrade(self, app)
210   - self._removeMenu('Database')
211   - self._addMenu('Database', 'Database')
212   - self._removeMenu('DBSrvInst')
213   - self._addMenu('DBSrvInst', 'Database Server Instance')
214   - for d in self.dmd.Devices.getSubDevices():
215   - d.os.buildRelations()
216   -
217   - def remove(self, app, junk):
218   - self._removeMenu('Database')
219   - self._removeMenu('DBSrvInst')
220   - ZenPackBase.remove(self, app, junk)
221   - OperatingSystem._relations = tuple([x for x in OperatingSystem._relations if x[0] not in ('softwaredatabases','softwaredbsrvinstances')])
222   - for d in self.dmd.Devices.getSubDevices():
223   - d.os.buildRelations()
224   -
225   -
226   -
32 ZenPacks.community.RDBMS/ZenPacks/community/RDBMS/configure.zcml
... ... @@ -1,32 +0,0 @@
1   -<?xml version="1.0" encoding="utf-8"?>
2   -<configure xmlns="http://namespaces.zope.org/zope"
3   - xmlns:browser="http://namespaces.zope.org/browser"
4   - xmlns:zcml="http://namespaces.zope.org/zcml">
5   -
6   - <configure zcml:condition="installed Products.Zuul">
7   -
8   - <adapter factory=".info.rdbmsDatabaseInfo"
9   - for=".Database.Database"
10   - provides=".interfaces.IDatabaseInfo"
11   - />
12   -
13   - <adapter factory=".info.rdbmsDBSrvInstInfo"
14   - for=".DBSrvInst.DBSrvInst"
15   - provides=".interfaces.IDBSrvInstInfo"
16   - />
17   -
18   - <browser:resourceDirectory
19   - name="rdbms"
20   - directory="resources"
21   - />
22   -
23   - <browser:viewlet
24   - name="js-rdbms"
25   - paths="/++resource++rdbms/RDBMS.js"
26   - weight="10"
27   - manager="Products.ZenUI3.browser.interfaces.IJavaScriptSrcManager"
28   - class="Products.ZenUI3.browser.javascript.JavaScriptSrcBundleViewlet"
29   - permission="zope2.Public"
30   - />
31   - </configure>
32   -</configure>
44 ZenPacks.community.RDBMS/ZenPacks/community/RDBMS/dtml/addDBSrvInst.dtml
... ... @@ -1,44 +0,0 @@
1   -<dtml-var manage_page_header>
2   -
3   -<dtml-var "manage_form_title(this(), _,
4   - form_title='Add Database Server Instance',
5   - help_product='RelationshipManager',
6   - help_topic='DBSrvInst_Add.stx'
7   - )">
8   -
9   -<form action="manage_addDBSrvInst" method="post">
10   -<table cellspacing="0" cellpadding="2" border="0">
11   - <tr>
12   - <td align="left" valign="top">
13   - <div class="form-label">
14   - Id
15   - </div>
16   - </td>
17   - <td align="left" valign="top">
18   - <input type="text" name="id" size="40" />
19   - </td>
20   - </tr>
21   - <tr>
22   - <td align="left" valign="top">
23   - <div class="form-label">
24   - Title
25   - </div>
26   - </td>
27   - <td align="left" valign="top">
28   - <input type="text" name="title" size="40" />
29   - </td>
30   - </tr>
31   - <tr>
32   - <td align="left" valign="top">
33   - </td>
34   - <td align="left" valign="top">
35   - <div class="form-element">
36   - <input class="form-element" type="submit" name="submit"
37   - value=" Add " />
38   - </div>
39   - </td>
40   - </tr>
41   -</table>
42   -</form>
43   -
44   -<dtml-var manage_page_footer>
44 ZenPacks.community.RDBMS/ZenPacks/community/RDBMS/dtml/addDatabase.dtml
... ... @@ -1,44 +0,0 @@
1   -<dtml-var manage_page_header>
2   -
3   -<dtml-var "manage_form_title(this(), _,
4   - form_title='Add Database',
5   - help_product='RelationshipManager',
6   - help_topic='Database_Add.stx'
7   - )">
8   -
9   -<form action="manage_addDatabase" method="post">
10   -<table cellspacing="0" cellpadding="2" border="0">
11   - <tr>
12   - <td align="left" valign="top">
13   - <div class="form-label">
14   - Id
15   - </div>
16   - </td>
17   - <td align="left" valign="top">
18   - <input type="text" name="id" size="40" />
19   - </td>
20   - </tr>
21   - <tr>
22   - <td align="left" valign="top">
23   - <div class="form-label">
24   - Title
25   - </div>
26   - </td>
27   - <td align="left" valign="top">
28   - <input type="text" name="title" size="40" />
29   - </td>
30   - </tr>
31   - <tr>
32   - <td align="left" valign="top">
33   - </td>
34   - <td align="left" valign="top">
35   - <div class="form-element">
36   - <input class="form-element" type="submit" name="submit"
37   - value=" Add " />
38   - </div>
39   - </td>
40   - </tr>
41   -</table>
42   -</form>
43   -
44   -<dtml-var manage_page_footer>
99 ZenPacks.community.RDBMS/ZenPacks/community/RDBMS/info.py
... ... @@ -1,99 +0,0 @@
1   -################################################################################
2   -#
3   -# This program is part of the RDBMS Zenpack for Zenoss.
4   -# Copyright (C) 2009, 2010 Egor Puzanov.
5   -#
6   -# This program can be used under the GNU General Public License version 2
7   -# You can find full information here: http://www.zenoss.com/oss
8   -#
9   -################################################################################
10   -
11   -__doc__="""info.py
12   -
13   -Representation of Databases.
14   -
15   -$Id: info.py,v 1.3 2010/09/28 16:18:47 egor Exp $"""
16   -
17   -__version__ = "$Revision: 1.3 $"[11:-2]
18   -
19   -from zope.interface import implements
20   -from Products.Zuul.infos import ProxyProperty
21   -from Products.Zuul.infos.component import ComponentInfo
22   -from Products.Zuul.decorators import info
23   -from ZenPacks.community.RDBMS import interfaces
24   -
25   -
26   -class DatabaseInfo(ComponentInfo):
27   -
28   - type = ProxyProperty("type")
29   - contact = ProxyProperty("contact")
30   - version = ProxyProperty("version")
31   - activeTime = ProxyProperty("activeTime")
32   -
33   - @property
34   - def name(self):
35   - return self._object.dbname
36   -
37   - @property
38   - @info
39   - def dbSrvInst(self):
40   - return self._object.getDBSrvInst()
41   -
42   - @property
43   - def blockSizeString(self):
44   - return self._object.blockSizeString()
45   -
46   - @property
47   - def totalBytesString(self):
48   - return self._object.totalString()
49   -
50   - @property
51   - def usedBytesString(self):
52   - return self._object.usedString()
53   -
54   - @property
55   - def availBytesString(self):
56   - return self._object.availString()
57   -
58   - @property
59   - def capacity(self):
60   - cap = self._object.capacity()
61   - if cap != 'Unknown': cap = '%s%%' % cap
62   - return cap
63   -
64   - @property
65   - def status(self):
66   - if not hasattr(self._object, 'statusString'): return 'Unknown'
67   - else: return self._object.statusString()
68   -
69   -class rdbmsDatabaseInfo(DatabaseInfo):
70   - implements(interfaces.IDatabaseInfo)
71   -
72   -class DBSrvInstInfo(ComponentInfo):
73   -
74   - contact = ProxyProperty("contact")
75   -
76   - @property
77   - @info
78   - def manufacturer(self):
79   - pc = self._object.productClass()
80   - if (pc):
81   - return pc.manufacturer()
82   -
83   - @property
84   - @info
85   - def product(self):
86   - return self._object.productClass()
87   -
88   - @property
89   - def name(self):
90   - return self._object.dbsiname
91   -
92   - @property
93   - def status(self):
94   - if not hasattr(self._object, 'statusString'): return 'Unknown'
95   - else: return self._object.statusString()
96   -
97   -class rdbmsDBSrvInstInfo(DBSrvInstInfo):
98   - implements(interfaces.IDBSrvInstInfo)
99   -
47 ZenPacks.community.RDBMS/ZenPacks/community/RDBMS/interfaces.py
... ... @@ -1,47 +0,0 @@
1   -################################################################################
2   -#
3   -# This program is part of the RDBMS Zenpack for Zenoss.
4   -# Copyright (C) 2009, 2010 Egor Puzanov.
5   -#
6   -# This program can be used under the GNU General Public License version 2
7   -# You can find full information here: http://www.zenoss.com/oss
8   -#
9   -################################################################################
10   -
11   -__doc__="""interfaces
12   -
13   -describes the form field to the user interface.
14   -
15   -$Id: interfaces.py,v 1.3 2010/09/27 00:05:28 egor Exp $"""
16   -
17   -__version__ = "$Revision: 1.3 $"[11:-2]
18   -
19   -from Products.Zuul.interfaces import IComponentInfo
20   -from Products.Zuul.form import schema
21   -from Products.Zuul.utils import ZuulMessageFactory as _t
22   -
23   -
24   -class IDatabaseInfo(IComponentInfo):
25   - """
26   - Info adapter for Database components.
27   - """
28   - status = schema.Text(title=u"Status", readonly=True, group='Overview')
29   - dbSrvInst = schema.Entity(title=u"DB Server Instance", readonly=True, group='Details')
30   - type = schema.Text(title=u"Type", readonly=True, group='Details')
31   - version = schema.Text(title=u"Version", readonly=True, group='Details')
32   - contact = schema.Text(title=u"Contact", readonly=True, group='Details')
33   - activeTime = schema.Text(title=u"Active Time", readonly=True, group='Details')
34   - blockSizeString = schema.Text(title=u"Units Size", readonly=True, group='Details')
35   - totalBytesString = schema.Text(title=u"Size Allocated", readonly=True, group='Details')
36   - usedBytesString = schema.Text(title=u"Size Used", readonly=True, group='Details')
37   - capacity = schema.Text(title=u"Utilization", readonly=True, group='Details')
38   -
39   -class IDBSrvInstInfo(IComponentInfo):
40   - """
41   - Info adapter for DB Server Instance components.
42   - """
43   - status = schema.Text(title=u"Status", readonly=True, group='Overview')
44   - contact = schema.Text(title=u"Contact", readonly=True, group='Details')
45   - manufacturer = schema.Entity(title=u"Manufacturer", readonly=True,
46   - group='Details')
47   - product = schema.Entity(title=u"Model", readonly=True, group='Details')
0  ZenPacks.community.RDBMS/ZenPacks/community/RDBMS/modeler/__init__.py
No changes.
0  ZenPacks.community.RDBMS/ZenPacks/community/RDBMS/modeler/plugins/__init__.py
No changes.
1  ZenPacks.community.RDBMS/ZenPacks/community/RDBMS/modeler/plugins/community/__init__.py
... ... @@ -1 +0,0 @@
1   -# __init__.py
111 ZenPacks.community.RDBMS/ZenPacks/community/RDBMS/modeler/plugins/community/snmp/DatabaseMap.py
... ... @@ -1,111 +0,0 @@