mirror of https://github.com/MISP/misp-modules
new: [internal] Add /healthcheck endpoint
parent
57e04d6b6c
commit
c65c65621f
|
@ -161,6 +161,11 @@ def load_package_modules():
|
||||||
return mhandlers, modules
|
return mhandlers, modules
|
||||||
|
|
||||||
|
|
||||||
|
class Healthcheck(tornado.web.RequestHandler):
|
||||||
|
def get(self):
|
||||||
|
self.write(b'{"status": true}')
|
||||||
|
|
||||||
|
|
||||||
class ListModules(tornado.web.RequestHandler):
|
class ListModules(tornado.web.RequestHandler):
|
||||||
global loaded_modules
|
global loaded_modules
|
||||||
global mhandlers
|
global mhandlers
|
||||||
|
@ -168,12 +173,12 @@ class ListModules(tornado.web.RequestHandler):
|
||||||
def get(self):
|
def get(self):
|
||||||
ret = []
|
ret = []
|
||||||
for module in loaded_modules:
|
for module in loaded_modules:
|
||||||
x = {}
|
ret.append({
|
||||||
x['name'] = module
|
'name': module,
|
||||||
x['type'] = mhandlers['type:' + module]
|
'type': mhandlers['type:' + module],
|
||||||
x['mispattributes'] = mhandlers[module].introspection()
|
'mispattributes': mhandlers[module].introspection(),
|
||||||
x['meta'] = mhandlers[module].version()
|
'meta': mhandlers[module].version()
|
||||||
ret.append(x)
|
})
|
||||||
log.debug('MISP ListModules request')
|
log.debug('MISP ListModules request')
|
||||||
self.write(json.dumps(ret))
|
self.write(json.dumps(ret))
|
||||||
|
|
||||||
|
@ -268,7 +273,11 @@ def main():
|
||||||
mispmod = importlib.import_module(module)
|
mispmod = importlib.import_module(module)
|
||||||
mispmod.register(mhandlers, loaded_modules)
|
mispmod.register(mhandlers, loaded_modules)
|
||||||
|
|
||||||
service = [(r'/modules', ListModules), (r'/query', QueryModule)]
|
service = [
|
||||||
|
(r'/modules', ListModules),
|
||||||
|
(r'/query', QueryModule),
|
||||||
|
(r'/healthcheck', Healthcheck),
|
||||||
|
]
|
||||||
|
|
||||||
application = tornado.web.Application(service)
|
application = tornado.web.Application(service)
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue