summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMatthew Sartori <msartori@chromium.org>2015-06-04 10:39:41 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-06-12 19:36:27 +0000
commite1bec9fce7a11b4066d42bd9a21692c14d6ae5a6 (patch)
treeb780655862134d6a478c312524d22682921528a1 /scripts
parenta4375fc3df7af4fdb57b3b318f110c7355c45243 (diff)
downloadchromite-e1bec9fce7a11b4066d42bd9a21692c14d6ae5a6.tar.gz
mobmonitor: Mob* Monitor Checkfile Collection
This CL implements a recurring background task using cherrypy plugins that will periodically collect checkfiles from the specified directory. BUG=chromium:490788 TEST=Unittests and tested collection on local machine. Change-Id: Ia92a755e4712fd26fa9215b760ecb759b72df35b Reviewed-on: https://chromium-review.googlesource.com/276241 Tested-by: Matthew Sartori <msartori@chromium.org> Reviewed-by: Simran Basi <sbasi@chromium.org> Commit-Queue: Matthew Sartori <msartori@chromium.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/mobmonitor.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/scripts/mobmonitor.py b/scripts/mobmonitor.py
index 1f5dddf94..36abe191a 100644
--- a/scripts/mobmonitor.py
+++ b/scripts/mobmonitor.py
@@ -10,11 +10,15 @@ import cherrypy
from chromite.lib import remote_access
from chromite.lib import commandline
+from chromite.mobmonitor.checkfile import manager
class MobMonitorRoot(object):
"""The central object supporting the Mob* Monitor web interface."""
+ def __init__(self, checkfile_manager):
+ self.checkfile_manager = checkfile_manager
+
@cherrypy.expose
def index(self):
"""Presents a welcome message."""
@@ -58,6 +62,9 @@ def ParseArguments(argv):
"""Creates the argument parser."""
parser = commandline.ArgumentParser(description=__doc__)
+ parser.add_argument('-d', '--checkdir',
+ default='/etc/mobmonitor/checkfiles/',
+ help='The Mob* Monitor checkfile directory.')
parser.add_argument('-p', '--port', type=int, default=9999,
help='The Mob* Monitor port.')
@@ -68,10 +75,15 @@ def main(argv):
options = ParseArguments(argv)
options.Freeze()
- mobmonitor = MobMonitorRoot()
-
# Start the Mob* Monitor web interface.
cherrypy.config.update({'server.socket_port':
remote_access.NormalizePort(options.port)})
+ # Setup the mobmonitor
+ checkfile_manager = manager.CheckFileManager(checkdir=options.checkdir)
+ mobmonitor = MobMonitorRoot(checkfile_manager)
+
+ # Start the checkfile collection background task.
+ checkfile_manager.StartCollection()
+
cherrypy.quickstart(mobmonitor)