summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Hagander2009-02-15 11:24:19 +0000
committerMagnus Hagander2009-02-15 11:24:19 +0000
commitca24399458ca482cd7ee4f60046d3c065a36f65a (patch)
treeef38b09585e2b4631bbe3889e91d90b0ee0a3a35
parent9624276bc095a1fd41919dde57987c56c7e8807a (diff)
Aggregate log reports and don't report on transient errors
(by default anything less than 4 error reports are ignored) git-svn-id: file:///Users/dpage/pgweb/svn-repo/trunk@2413 8f5c7a92-453e-0410-a47f-ad33c8a6b003
-rwxr-xr-xplanet/logmailer.py16
-rw-r--r--planet/planet.ini.sample1
2 files changed, 10 insertions, 7 deletions
diff --git a/planet/logmailer.py b/planet/logmailer.py
index 7a74b367..ca20c864 100755
--- a/planet/logmailer.py
+++ b/planet/logmailer.py
@@ -23,10 +23,15 @@ class LogChecker(object):
def Check(self):
c = self.db.cursor()
- c.execute("""SELECT ts,name,info FROM planet.aggregatorlog
+ c.execute("""
+ SELECT name,info,count(*) as num FROM planet.aggregatorlog
INNER JOIN planet.feeds ON feed=feeds.id
WHERE success='f' AND ts > CURRENT_TIMESTAMP-'24 hours'::interval
- ORDER BY name,ts""")
+ GROUP BY name,info
+ HAVING count(*) > %s
+ ORDER BY num,name;
+""" % self.cfg.get('notify','minerrors'))
+
if c.rowcount > 0:
s = """
One or more of the blogs fetched in the past 24 hours caused an error
@@ -34,11 +39,8 @@ as listed below.
"""
last = ""
- for r in c:
- if not last == r[1]:
- last = r[1]
- s += "\n"
- s += "%s %-20s %s\n" % (r[0].strftime("%Y%m%d %H:%M:%S"), r[1][:20], r[2])
+ for name,info,num in c:
+ s += "(%3s times) %s (%s)\n" % (num, name, info)
s += "\n\n"
diff --git a/planet/planet.ini.sample b/planet/planet.ini.sample
index f63dc677..42dff94f 100644
--- a/planet/planet.ini.sample
+++ b/planet/planet.ini.sample
@@ -11,3 +11,4 @@ password=yeahthatssecret
[notify]
+minerrors=3