comments & documentation

community
Steve L. Nyemba 7 years ago
parent 99c3cbb2e6
commit 93186b81fa

@ -50,6 +50,10 @@ factory = DataSourceFactory()
@app.route('/1/get/apps')
def get_apps():
"""
This function returns the labels of applications for every node registered
e.g: apps@zulu.org
"""
r = []
try:
gReader = factory.instance(type=class_read,args=p)
@ -59,6 +63,11 @@ def get_apps():
return json.dumps(r)
@app.route('/1/get/summary/<id>')
def get_summary(id):
"""
This function returns the summary i.e an overall assessment of resource usage
It will pull information out of the user's data-store (database & document) specified in the configuration
@param id {app_resources|app_status|folder_size}
"""
r = []
try:
gReader = factory.instance(type=class_read,args=p)
@ -77,7 +86,10 @@ def get_summary(id):
@app.route("/1/sys/usage/trend")
def get_usage_trend():
"""
This function returns trends for the 24 most recent observations in the logs
This function returns cpu/memory usage for the entire system being monitored. It will return the 24 most recent observations in the logs
No parameters should be passed.
@return {memory_usage:[],cpu_usage:[],app_count:value,memory_available:[]}
"""
r = {}
try:
@ -91,7 +103,12 @@ def get_usage_trend():
def get_usage_detail():
"""
This function returns trends for the 24 most recent observations in the logs
This function returns detailed information about usage per application monitored. It will return the 24 most recent observations in the logs
No parameters should be passed
@return {app_1:{memory_usage:[],cpu_usage:[]},app_2:{memory_usage:[],cpu_usage:[]},...}
@TODO:
- add node references because if the same application lives on other nodes the info will be overriden
- parameters to be passed will be the node information
"""
r = {}
try:
@ -100,7 +117,24 @@ def get_usage_detail():
except Exception,e:
print (e)
return json.dumps(r)
@app.route('/1/app/status/<id>')
def app_status(id) :
"""
This function aggregates the number of crashes/running/idle instances found in the past 24 log entries
@TODO: The back-end doesn't allow nodes to be specified
@param id node that contains an app
"""
r = []
try:
gReader = factory.instance(type=class_read,args=p)
r = gReader.view('summary/app_status_details',key=p['uid'])
#
#@TODO: Once the back-end enables the nodes in which the application is running, uncomment the line below
#
#r = r[id]
except Exception,e:
print e
return r
@app.route('/get/<id>')
def procs(id):
try:

Loading…
Cancel
Save