CC-2750: Ability to query health status for pypo, liquidsoap, media monitor, and recorder
-progress being made
This commit is contained in:
parent
b5684bb5b1
commit
659e412eb7
21 changed files with 2018 additions and 39 deletions
|
@ -13,6 +13,9 @@ api_base = 'api'
|
|||
# URL to get the version number of the server API
|
||||
version_url = 'version/api_key/%%api_key%%'
|
||||
|
||||
#URL to register a components IP Address with the central web server
|
||||
register_component = 'register-component/format/json/api_key/%%api_key%%/component/%%component%%'
|
||||
|
||||
# Hostname
|
||||
base_url = 'localhost'
|
||||
base_port = 80
|
||||
|
|
|
@ -134,6 +134,9 @@ class ApiClientInterface:
|
|||
def set_storage_dir(self):
|
||||
pass
|
||||
|
||||
def register_component(self):
|
||||
pass
|
||||
|
||||
# Put here whatever tests you want to run to make sure your API is working
|
||||
def test(self):
|
||||
pass
|
||||
|
@ -542,6 +545,25 @@ class AirTimeApiClient(ApiClientInterface):
|
|||
|
||||
return response
|
||||
|
||||
"""
|
||||
Purpose of this method is to contact the server with a "Hey its me!" message.
|
||||
This will allow the server to register the component's (component = media-monitor, pypo etc.)
|
||||
ip address, and later use it to query monit via monit's http service, or download log files
|
||||
via a http server.
|
||||
"""
|
||||
def register_component(self, component):
|
||||
logger = logging.getLogger()
|
||||
try:
|
||||
url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["register_component"])
|
||||
|
||||
url = url.replace("%%api_key%%", self.config["api_key"])
|
||||
url = url.replace("%%component%%", component)
|
||||
req = urllib2.Request(url)
|
||||
response = urllib2.urlopen(req).read()
|
||||
except Exception, e:
|
||||
logger.error("Exception: %s", e)
|
||||
logger.error("Response: %s", response)
|
||||
|
||||
################################################################################
|
||||
# OpenBroadcast API Client
|
||||
################################################################################
|
||||
|
|
|
@ -34,6 +34,7 @@ logger.info("\n\n*** Media Monitor bootup ***\n\n")
|
|||
try:
|
||||
config = AirtimeMediaConfig(logger)
|
||||
api_client = apc.api_client_factory(config.cfg)
|
||||
api_client.register_component("media-monitor")
|
||||
|
||||
logger.info("Setting up monitor")
|
||||
response = None
|
||||
|
|
|
@ -124,6 +124,9 @@ if __name__ == '__main__':
|
|||
g.test_api()
|
||||
sys.exit()
|
||||
|
||||
api_client = api_client.api_client_factory(config)
|
||||
api_client.register_component("pypo")
|
||||
|
||||
q = Queue()
|
||||
|
||||
pp = PypoPush(q)
|
||||
|
@ -134,8 +137,6 @@ if __name__ == '__main__':
|
|||
pf.daemon = True
|
||||
pf.start()
|
||||
|
||||
#while True: time.sleep(3600)
|
||||
|
||||
#pp.join()
|
||||
pf.join()
|
||||
logger.info("pypo fetch exit")
|
||||
|
|
|
@ -167,6 +167,7 @@ class CommandListener(Thread):
|
|||
def __init__(self):
|
||||
Thread.__init__(self)
|
||||
self.api_client = api_client.api_client_factory(config)
|
||||
self.api_client.register_component("show-recorder")
|
||||
self.logger = logging.getLogger('root')
|
||||
self.sr = None
|
||||
self.current_schedule = {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue