Skip to content

Commit

Permalink
Merge pull request #32 from zenoss/feature/ZPS-8554.1
Browse files Browse the repository at this point in the history
Revert the changes in develope branch
  • Loading branch information
odubrovyk authored Aug 30, 2023
2 parents d317b5b + 375d940 commit 771bf49
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 21 deletions.
8 changes: 0 additions & 8 deletions ZenPacks/zenoss/PostgreSQL/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,8 @@ class ZenPack(ZenPackBase):
('zPostgreSQLPassword', '', 'password'),
('zPostgreSQLUseSSL', False, 'boolean'),
('zPostgreSQLDefaultDB', 'postgres', 'string'),
('zPostgreSQLTableRegex', '', 'string'),
]

packZProperties_data = {
'zPostgreSQLTableRegex': {
'description': "Filter tables from all databases if name matches regex provided",
'label': "Regex Table Filter",
'type': "string" },
}

def install(self, app):
super(ZenPack, self).install(app)
self.patchPostgreSQLDriver()
Expand Down
13 changes: 1 addition & 12 deletions ZenPacks/zenoss/PostgreSQL/modeler/plugins/zenoss/PostgreSQL.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
###########################################################################

import logging
import re
log = logging.getLogger('zen.PostgreSQL')

from Products.DataCollector.plugins.CollectorPlugin import PythonPlugin
Expand All @@ -28,7 +27,6 @@ class PostgreSQL(PythonPlugin):
'zPostgreSQLPassword',
'zPostgreSQLUseSSL',
'zPostgreSQLDefaultDB',
'zPostgreSQLTableRegex',
)

def collect(self, device, unused):
Expand All @@ -41,7 +39,6 @@ def collect(self, device, unused):
device.zPostgreSQLDefaultDB)

results = {}
pattern = re.compile(getattr(device, 'zPostgreSQLTableRegex', '').strip())

log.info("Getting database list")
try:
Expand All @@ -58,15 +55,7 @@ def collect(self, device, unused):

log.info("Getting tables list for {0}".format(dbName))
try:

tables = pg.getTablesInDatabase(dbName)
if pattern.pattern:
for key in tables.keys():
if not pattern.match(key):
del tables[key]

results['databases'][dbName]['tables'] = tables

results['databases'][dbName]['tables'] = pg.getTablesInDatabase(dbName)
except Exception, ex:
log.warn("Error getting tables list for {0}: {1}".format(
dbName, ex))
Expand Down
1 change: 0 additions & 1 deletion docs/body.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ individual devices.
- *zPostgreSQLUsername* - Must be a superuser. Default: postgres
- *zPostgreSQLPassword* - Password for user. No default.
- *zPostgreSQLDefaultDB* - Default database. Default: postgres
- *zPostgreSQLTableRegex* - Filter tables of all databases with Regex. Default: ""

In addition to setting these properties you must add the ''zenoss.PostgreSQL''
modeler plugin to a device class or individual device. This modeler plugin will
Expand Down

0 comments on commit 771bf49

Please sign in to comment.