Skip to content

Commit

Permalink
Fix division by zero error.
Browse files Browse the repository at this point in the history
Fixes zenoss#4.
  • Loading branch information
cluther committed Mar 13, 2012
1 parent 1b7a9d4 commit 7539228
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
8 changes: 4 additions & 4 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ Depending on what version of Zenoss you're running you will need a different
package. Download the appropriate package for your Zenoss version from the list
below.

* Zenoss 4.1: [Latest Package for Python 2.7][]
* Zenoss 3.0 - 4.0: [Latest Package for Python 2.6][]
* Zenoss 4.1 - 4.2: [Packages for Zenoss 4][]
* Zenoss 3.0 - 4.0: [Packages for Zenoss 3][]

Then copy it to your Zenoss server and run the following commands as the zenoss
user.
Expand Down Expand Up @@ -163,6 +163,6 @@ remodeled. This occur once every 12 hours.


[Zenoss]: <http://www.zenoss.com/>
[Latest Package for Python 2.7]: <https://github.com/downloads/zenoss/ZenPacks.zenoss.PostgreSQL/ZenPacks.zenoss.PostgreSQL-1.0.3-py2.7.egg>
[Latest Package for Python 2.6]: <https://github.com/downloads/zenoss/ZenPacks.zenoss.PostgreSQL/ZenPacks.zenoss.PostgreSQL-1.0.3-py2.6.egg>
[Packages for Zenoss 4]: <http://zenpacks.zenoss.com/pypi/github/3.2/ZenPacks.zenoss.PostgreSQL/>
[Packages for Zenoss 3]: <http://zenpacks.zenoss.com/pypi/github/4.2/ZenPacks.zenoss.PostgreSQL/>
[git repository]: <https://github.com/zenoss/ZenPacks.zenoss.PostgreSQL>
8 changes: 6 additions & 2 deletions ZenPacks/zenoss/PostgreSQL/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,14 @@ def getDatabaseStats(self):

for row in cursor.fetchall():
xactTotal = row[3] + row[4]
xactRollbackPct = (float(row[4]) / xactTotal) * 100
xactRollbackPct = 0
if xactTotal > 0:
xactRollbackPct = (float(row[4]) / xactTotal) * 100

tupTotal = row[7] + row[8]
tupFetchedPct = (float(row[8]) / tupTotal) * 100
tupFetchedPct = 0
if tupTotal > 0:
tupFetchedPct = (float(row[8]) / tupTotal) * 100

databaseStats[row[0]] = dict(
size=row[1],
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# or saved. Do not modify them directly here.
# NB: PACKAGES is deprecated
NAME = "ZenPacks.zenoss.PostgreSQL"
VERSION = "1.0.3"
VERSION = "1.0.4"
AUTHOR = "Zenoss"
LICENSE = ""
NAMESPACE_PACKAGES = ['ZenPacks', 'ZenPacks.zenoss']
Expand Down

0 comments on commit 7539228

Please sign in to comment.