aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2016-04-07 21:43:18 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2016-04-07 21:43:18 +0200
commit55eb4abf89c3670ef98d2d74392034a3c6c19f6f (patch)
tree242c5933c120e426c6505bc6a915cc82b59cb7e2
parentRemoved now useless configuration variable. (diff)
downloadnewspipe-55eb4abf89c3670ef98d2d74392034a3c6c19f6f.tar.gz
newspipe-55eb4abf89c3670ef98d2d74392034a3c6c19f6f.tar.bz2
newspipe-55eb4abf89c3670ef98d2d74392034a3c6c19f6f.zip
Won't use munin.
-rwxr-xr-xsrc/manager.py3
-rw-r--r--src/scripts/__init__.py0
-rw-r--r--src/scripts/probes.py74
3 files changed, 0 insertions, 77 deletions
diff --git a/src/manager.py b/src/manager.py
index 14139ec2..b6ff87a0 100755
--- a/src/manager.py
+++ b/src/manager.py
@@ -70,9 +70,6 @@ def fetch_asyncio(user_id, feed_id):
classic_crawler.retrieve_feed(loop, g.user, feed_id)
loop.close()
-from scripts.probes import ArticleProbe, FeedProbe
-manager.add_command('probe_articles', ArticleProbe())
-manager.add_command('probe_feeds', FeedProbe())
if __name__ == '__main__':
manager.run()
diff --git a/src/scripts/__init__.py b/src/scripts/__init__.py
deleted file mode 100644
index e69de29b..00000000
--- a/src/scripts/__init__.py
+++ /dev/null
diff --git a/src/scripts/probes.py b/src/scripts/probes.py
deleted file mode 100644
index 94ca25fc..00000000
--- a/src/scripts/probes.py
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/usr/bin/python3
-import sys
-from datetime import datetime, timedelta
-from flask.ext.script import Command, Option
-
-from web.controllers \
- import UserController, FeedController, ArticleController
-DEFAULT_HEADERS = {'Content-Type': 'application/json', 'User-Agent': 'munin'}
-LATE_AFTER = 60
-FETCH_RATE = 3
-
-
-class AbstractMuninPlugin(Command):
- urn = None
-
- def execute(self):
- raise NotImplementedError()
-
- def config(self):
- raise NotImplementedError()
-
- def get_options(self):
- if sys.argv[-1] == 'config':
- return [Option(dest='config', default=sys.argv[-1] == 'config')]
- return []
-
- def run(self, config=False):
- if config:
- self.config()
- else:
- self.execute()
-
-
-class FeedProbe(AbstractMuninPlugin):
-
- def config(self):
- print("graph_title PyAgg - Feeds counts")
- print("graph_vlabel feeds")
- print("feeds.label Late feeds")
- print("feeds_total.label Total feeds")
- print("feeds.warning 15")
- print("feeds.critical 30")
- print("graph_category web")
- print("graph_scale yes")
-
- def execute(self):
- delta = datetime.now() - timedelta(minutes=LATE_AFTER + FETCH_RATE + 1)
- total = FeedController().read().count()
-
- print("feeds.value %d"
- % len(FeedController().list_late(delta, limit=total)))
- print("feeds_total.value %d" % FeedController().read().count())
-
-
-class ArticleProbe(AbstractMuninPlugin):
-
- def config(self):
- print("graph_title Pyagg - Articles adding rate")
- print("graph_vlabel Articles per sec")
- print("articles.label Overall rate")
- print("articles.type DERIVE")
- print("articles.min 0")
- for id_ in sorted(user.id for user in UserController().read()):
- print("articles_user_%s.label Rate for user %s" % (id_, id_))
- print("articles_user_%s.type DERIVE" % id_)
- print("articles_user_%s.min 0" % id_)
- print("graph_category web")
- print("graph_scale yes")
-
- def execute(self):
- counts = ArticleController().count_by_user_id()
- print("articles.value %s" % sum(counts.values()))
- for user, count in counts.items():
- print("articles_user_%s.value %s" % (user, count))
bgstack15