diff --git a/.config.json.un~ b/.config.json.un~ new file mode 100644 index 0000000..d2b3a23 Binary files /dev/null and b/.config.json.un~ differ diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..c23ecac --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..c6d4b0b --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..359f297 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/monitor.iml b/.idea/monitor.iml new file mode 100644 index 0000000..070ad19 --- /dev/null +++ b/.idea/monitor.iml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..2119daa --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,583 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + nodes + console.log + + + + + + + + + + + true + DEFINITION_ORDER + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1499042529793 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/config.json b/config.json index 47e689e..02f1be0 100644 --- a/config.json +++ b/config.json @@ -1,18 +1,18 @@ { - "id":"zulu-hacker", + "id":"michaels-MBP", "key":"4q-h8r5-247&!570p=[0v8]x360", "api":"dev.the-phi.com", - "delay":0.5, + "delay":10.0, "store":{ "class":{"read":"CouchdbReader","write":"CouchdbWriter"}, "args":{"uri":"http://dev.the-phi.com:5984","dbname":"mike-db","uid":"logs"} }, - "procs":["kate","firefox"], - "folders":["/home/steve/tmp","/home/steve/git","/home/steve/Downloads"], + "procs":["mail","safari", "chrome", "terminal"], + "folders":["/Users/michaelmead/Downloads"], "actions":{ "folders":{"threshold":"10mb","action":"archive","key":""}, - "apps":{"firefox":"","kate":"" } + "apps":{"mail":"","safari":"","chrome":"" } } - - + + } diff --git a/src/api/.index.py.un~ b/src/api/.index.py.un~ new file mode 100644 index 0000000..430d989 Binary files /dev/null and b/src/api/.index.py.un~ differ diff --git a/src/api/index.py b/src/api/index.py index 6b2744a..4b49339 100644 --- a/src/api/index.py +++ b/src/api/index.py @@ -114,10 +114,10 @@ def get_summary(id): print p print id r = gReader.view(id,key=p['uid']) - + except Exception,e: print (e) - return json.dumps(r) + return json.dumps(r) @app.route("/1/sys/usage/trend") def get_usage_trend(): """ @@ -138,7 +138,7 @@ def get_usage_trend(): def get_usage_detail(): """ This function returns detailed information about usage per application monitored. It will return the 24 most recent observations in the logs - + @param node node identifier e.g: apps@zulu.io @return {node_x:{app_1:{memory_usage:[],cpu_usage:[]}},...} """ @@ -155,7 +155,7 @@ def get_usage_detail(): def app_status() : """ This function aggregates the number of crashes/running/idle instances found in the past 24 log entries - + @param nid node identifier e.g: app@zulu.io @param aid application identifier e.g: kate, firefox, chrome ... specified in the configuraiton """ @@ -163,7 +163,7 @@ def app_status() : try: nid = request.args.get('node') # Node identifier aid = request.args.get('app') # application identifier - + gReader = factory.instance(type=class_read,args=p) r = gReader.view('summary/app_status_details',key=p['uid']) # @@ -172,7 +172,7 @@ def app_status() : r = r[nid][aid] except Exception,e: print e - return r + return json.dumps(r) #@app.route('/get/') #def procs(id): #try: diff --git a/src/api/static/js/.dashboard.js.un~ b/src/api/static/js/.dashboard.js.un~ new file mode 100644 index 0000000..046d026 Binary files /dev/null and b/src/api/static/js/.dashboard.js.un~ differ diff --git a/src/api/static/js/dashboard.js b/src/api/static/js/dashboard.js index 88d1bd9..f1a3b0c 100755 --- a/src/api/static/js/dashboard.js +++ b/src/api/static/js/dashboard.js @@ -17,12 +17,11 @@ dashboard = { }, initChartist: function(){ - var getData = $.get('/get/1'); - + var getData = $.get('/1/app/usage/trend'); + getData.done(function(results) { var data = JSON.parse(results) - - var app = data['apps@lab']; + var app = data['Chrome']; function getCpuUsage (app){ cpu_usage = [] @@ -41,7 +40,6 @@ dashboard = { } return memory_usage } - function getStatus (app){ statusList = [] for (var i in app){ @@ -49,27 +47,24 @@ dashboard = { } return statusList } + // monitoring apps chart var dataChart = { labels: ['9:00AM', '12:00AM', '3:00PM', '6:00PM', '9:00PM', '12:00PM', '3:00AM', '6:00AM'], - series: [ - [287, 385, 490, 562, 594, 626, 698, 895, 952], - [67, 152, 193, 240, 387, 435, 535, 642, 744], - [23, 113, 67, 108, 190, 239, 307, 410, 410], - ] + series: [app.memory_used, app.cpu, ] // TODO: Check the order, the graph is by index not name. }; var optionsChart = { lineSmooth: false, low: 0, - high: 1000, + high: 100, showArea: true, height: "245px", axisX: { showGrid: false, }, lineSmooth: Chartist.Interpolation.simple({ - divisor: 3 + divisor: 1 }), showLine: true, showPoint: false, @@ -88,15 +83,10 @@ dashboard = { Chartist.Line('#chartHours', dataChart, optionsChart, responsiveChart); // cpu and memory -------------------------- - cpu_usage = getCpuUsage(app) - memory_usage = getMemoryUsage(app) var data = { labels: ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], - series: [ - cpu_usage,memory_usage - // [542, 543, 520, 680, 653, 753, 326, 434, 568, 610, 756, 895], - // [230, 293, 380, 480, 503, 553, 600, 664, 698, 710, 736, 795] - ] + series: [app.cpu, app.memory_used] + }; var options = { @@ -120,26 +110,6 @@ dashboard = { Chartist.Line('#chartActivity', data, options, responsiveOptions); - var dataPreferences = { - series: [ - [25, 30, 20, 25] - ] - }; - - var optionsPreferences = { - donut: true, - donutWidth: 40, - startAngle: 0, - total: 100, - showLabel: false, - axisX: { - showGrid: false - } - }; - - Chartist.Pie('#chartPreferences', dataPreferences, optionsPreferences); - -//summary Run|Idle|Crash pie chart status = getStatus(app) statusList = status.split(','); @@ -195,8 +165,8 @@ dashboard = { } Chartist.Pie('#chartPreferences', { - labels: percentage, - series: statusByNum + labels: [1,1,1], + series: [1,2,3] }); }) }, @@ -261,23 +231,23 @@ g.summary.factory = function (url,pointer) { r = JSON.parse(r.responseText) pointer(r) console.log(r) + //monitorStatus(r.idle, r.crash, r.running) //observer.notify() - + } - object.init = function (observer) { + object.init = function (observer) { observer = observer - + var httpclient = HttpClient.instance() //httpclient.setAsync(false) httpclient.get(this.url, this.callback) setTimeout(function(){ observer.notify() },TIME_ELLAPSED) ; - + //observer.notify() } - - return object + return object -} \ No newline at end of file +} diff --git a/src/api/templates/dashboard.html b/src/api/templates/dashboard.html index 7daac92..bd71083 100644 --- a/src/api/templates/dashboard.html +++ b/src/api/templates/dashboard.html @@ -38,14 +38,13 @@ - - - + - + @@ -56,12 +55,12 @@ var lobservers = [ g.summary.factory('/1/get/summary/app_resources',function(r){ - + //r = JSON.parse(r.responseText) jx.dom.set.value('total_cpu',r.cpu_usage) jx.dom.set.value('total_mem',r.memory_usage) jx.dom.set.value('mem_units',r.units) - + }), g.summary.factory('/1/get/summary/folder_size',function(r){ //console.log(r.responseText) @@ -74,19 +73,19 @@ jx.dom.set.value('folder_units',r.units) }), g.summary.factory('/1/get/summary/app_status',function(r){ - + jx.dom.set.value('total_app_crashes',r.crash) }) ] - + jx.utils.patterns.observer(lobservers,"init") - //dashboard.initChartist(); + dashboard.initChartist(); }); - + @@ -107,7 +106,7 @@