forked from philberty/vigilant
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
39 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,32 @@ | ||
__all__ = [ 'StatsAggregator.py', 'StatsData.py', 'StatsServer.py', 'ServerUtil.py' ] | ||
import sys | ||
import traceback | ||
import ServerUtil | ||
|
||
from StatsApp import app | ||
from gevent.pywsgi import WSGIServer | ||
from StatsAggregator import UDPStatsServer | ||
|
||
class WatchyDServer: | ||
def __init__ (self, cacheLimit, backends, wbind='localhost', wport=8080, | ||
ubind='localhost', uport=8081): | ||
self.web_bind = wbind | ||
self.web_port = wport | ||
self.udp_server = UDPStatsServer (host=ubind, port=uport, | ||
climit=cacheLimit, backends=backends) | ||
|
||
def listen (self): | ||
try: | ||
self.udp_server.start () | ||
ServerUtil.info ('WSGIServer:[gevent] starting http://%s:%i/' \ | ||
% (self.web_bind, self.web_port)) | ||
http_server = WSGIServer ((self.web_bind, self.web_port), app) | ||
http_server.serve_forever() | ||
except KeyboardInterrupt: | ||
ServerUtil.warning ('Caught keyboard interupt stopping') | ||
except: | ||
ServerUtil.error ("%s" % traceback.format_exc ()) | ||
ServerUtil.error ("%s" % sys.exc_info ()[1]) | ||
finally: | ||
ServerUtil.info ("Shutting down Stats Aggregator") | ||
self.udp_server.running = False | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters