zenoss / ZenPacks.zenoss.PostgreSQL

PostgreSQL Monitoring
GNU General Public License v2.0
8 stars 7 forks source link

"postgres failure: float division" when running on a new database #4

Closed szpak closed 12 years ago

szpak commented 12 years ago

Hi,

When I tried to use ZenPacks.zenoss.PostgreSQL on a quite new/empty database I've got "postgres failure: float division". I suspect there is no check for 0 on some value. I modified poll_postgres.py to get some stact trace and when running via "Test Against Device" I've got:

Preparing Command... Executing command $ZENHOME/libexec/pollpostgres.py <**> server against <_> File "/opt/zenoss/libexec/poll_postgres.py", line 187, in printJSON data = self.getData() File "/opt/zenoss/libexec/poll_postgres.py", line 125, in getData databases = pg.getDatabaseStats() File "/opt/zenoss/ZenPacks/ZenPacks.zenoss.PostgreSQL-1.0.3-py2.6.egg/ZenPacks/zenoss/PostgreSQL/util.py", line 172, in getDatabaseStats xactRollbackPct = (float(row[4]) / xactTotal) * 100 * float division *\ print_tb: {"events": [{"eventClassKey": "postgresFailure", "summary": "postgres failure: float division", "severity": 4, "eventKey": "postgresFailure"}]} DONE in 1 seconds

ZenPacks.zenoss.PostgreSQL 1.0.3 (for Python 2.6) zenoss-3.2.0-1258.el5 PostgreSQL 9.1

Regards Marcin

cluther commented 12 years ago

Thanks for the report. I'm sure you're right about a simple division by zero.

I'll get it fixed up shortly.