From e2194b8da469e9d3278c28eb9673d040f3d267ac Mon Sep 17 00:00:00 2001 From: Michael Mead Date: Wed, 5 Jul 2017 18:37:21 -0500 Subject: [PATCH] starting to link up charts --- .config.json.un~ | Bin 0 -> 13697 bytes .../inspectionProfiles/profiles_settings.xml | 7 + .idea/misc.xml | 4 + .idea/modules.xml | 8 + .idea/monitor.iml | 19 + .idea/vcs.xml | 6 + .idea/workspace.xml | 583 ++++++++++++++++++ config.json | 8 +- src/api/.index.py.un~ | Bin 0 -> 14394 bytes src/api/index.py | 12 +- src/api/static/js/.dashboard.js.un~ | Bin 0 -> 2414 bytes src/api/static/js/dashboard.js | 50 +- src/api/templates/dashboard.html | 33 +- 13 files changed, 682 insertions(+), 48 deletions(-) create mode 100644 .config.json.un~ create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/monitor.iml create mode 100644 .idea/vcs.xml create mode 100644 .idea/workspace.xml create mode 100644 src/api/.index.py.un~ create mode 100644 src/api/static/js/.dashboard.js.un~ diff --git a/.config.json.un~ b/.config.json.un~ new file mode 100644 index 0000000000000000000000000000000000000000..d2b3a239e8ffc32f28dec0f855865d6bc61487bf GIT binary patch literal 13697 zcmeI(OHUI~6bJAD@lhY(0~LXUFfn2brilrgY6P`DQDjpRFvd*iR3@~Pv;~cig?s%7 z#sxc8egYGgE>vXY!myGUKY(kz|LNTJ(BN?B*`AwR=FIfL-1D0|?cCm(2nruEbLrxS z)0%qs{>ReB(&);%_v`$h-p$L)WBr+x?$4ioF1AmM_q=i(=eVhEBH?=T^JO>n(#-`W zKUaM2rd)T>o%Jd{qQq z$J(YT;ag!v%kDFPOo9WYmQ@okntBi$C#P25h8&Lbx67;}{d-J>IO5KP8)S{{i-r8c z#TjpU)-Sn(LvKPl`&{$1u-Jcg25U-JO-j>$Z8q@+|D*dz>ELx#BPS$x30~^jo^+X;5j{k}f`*%NMG zP&nRS;=ISVdKZG}8PCrbd@q}ZDK=Dnn0I0TfPBt#T)*uTcHKjg6QzOzGlA88qm z097Xm5rty)F^>AK&+tGFzj#HB!vUb^B5CqsG5P}zI{BPueX7Iw0NG3Ut2s%CC={FD z=a|>O+Ofz%oFL5tzmk)Lh(a;>D2KfEWu7Gt;qZDdY8muZT*ORXEEd1V5w}-wEN}~K z_Y(LDZnGg>ioqMM&9}c+i>}sL-uB|(whY$lZL=X=ioNe}I(T((hQ$rqBcxRr_fc+= z5K$=RzRlqdhvHb;(8a*IEs$4jn+@qwtbL24jd52NHgG#go9r(tI?76t(sU@szRAJn zTEq4zX$#!7W0Qo4LXP#fxS`cF$C}x#L3@le2kc5s5+Vx4)HgWPyc0NN@f(~iP*-W2 z4e3%WeVrrC`lJTz3DO>*D>O-nC=^3q<3MwM_l9dHX$#ENnIuFMik(L|&Wz~|U_D8i z0&-<02@!=H=GC|_W5XQgohPwC^%Q9d#GyQZZ90hsSr8PC@_L-|RgUu3Ni6lrEw!0S zKs`;G0dPeo2@!=1r>AFi0O&802iPsY|vhdEC>n*G#v+eg$bG|o7sp- z`fEp>7^LCM(WoKd25~s>sl-uMnq6>+$Kr_3afoXtVBmF=eFdx?$khHy64O-3z+CH~ zn08FrP7P+v<&Wlg1FnbcBv1jVbG%7XnhrUTU2%|o*7vvl7$cPl7X79$p&O#K5 zeOS?RE3zOc9L1qH#r|y-%U;ea1=TxiB1hU2vBNNhV?S2Z5m^uvj^l9X*iyY&rt!2o Nu!G~EYc+o_{{!V&k469h literal 0 HcmV?d00001 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..860941b 100644 --- a/config.json +++ b/config.json @@ -1,17 +1,17 @@ { - "id":"zulu-hacker", + "id":"seeker-hacker", "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"], + "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 0000000000000000000000000000000000000000..430d989f943aab1482fa52ec757886b7b580884f GIT binary patch literal 14394 zcmeI(&yUn(7zgk!F0wE91C<|&h|NNrLDx|dH&M*Q#E2*=2n1wZ*Rh#)*TPPxv>kRw zO$;W+i$8-Nj6o9{){^vTw*m#<&BbnSzm{@VS;f$zTm@yrj7 zGx4+II6G7lWW6ME&!*j|;rBXmT2J;X`D9hriDGqSi^ZkYnVb9e>&d|$tzYn|EE@)! z{9k-@Ojc~2>#__Y{A8E^U4iFhL|#eRR#lbww5(IIf@5dS;W&TaEk7TX_2oht1Gf*A zp1qjcVTYS!Ef+YxB&)S6D>BYj$IfND7v*f?mv<-#wy9vX9mJV?DBpzLXeKyV(1B`_ zvIFB0SuGtE#W>WVdw}Vlms7n!bQ@Kc^h+z)Y@}S^h5^=!ieen7I1Ef`|Hru2U zx9QF=6rBZ~n<*Q}Rp+o5G^&hASXEL6uXjOvkhKoWj?yfZ)})%Ao-U|Bvx%|*n{?q| zK4Ph;GA5x8)x%7M>yKQ+DyqknS~?MUet`a3^x9cB={LeC&Ag}`)U$pZG~3HwnzjfErKQT4ggUg3GA+7FW`-5*0hRyKbPM0cg)msD*V106 z<0bt^qOKpLwV884zZuWhdZAxiC|%)*?-}I+V@zi4wXm$nI9napCcB=Jv%NyD{M!{Y zn<*Qx$-b6~YGNMhP(965=#n!;b;Gm;I$J0m$jRS!HeEi}p;X|4G}0GnGV z8Mw*L_Tol0F%NaD4zm^7m6^rW#AWc3<8tCiO?(A`S8 zf>n-XDXAvrp$_E{rbHLb6XiHlP*C1Rxr14bZE2|{=AjPlQKm&#y+*XNBd4HV9JeB` zv)(immbX*#aF&BxTdIk9sAGGaZP8W>WV>}>o6Hx#hs%32VA@J~fl$WTNeBK zP0T|bt9RK7ZPFpDalV^_awp{uW;wQ{rJ9(BI<)UGExIZq+C56`4HsS9Kx?`+`7VxU zd}+6rwB-xATfP?oG`zD^E&!FISj4g*V{LU1-)BVhPnQr63S$10Z}>w#++q0-b?C!B zfZjv@31G_^EHKr?Jk$aHkb%)#F#%5raIl211Na#OqIXgPROKzSxOj&NKKD^Vu#*ASi)vyX>UdpZ zFSJTVUYkp=&@aFMw1+YRo{X?yR1@=12kdhOL$CA*Z13Qy(3') #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 0000000000000000000000000000000000000000..046d0263df5e51e0d0b07c21692bd4bfe3806064 GIT binary patch literal 2414 zcmWH`%$*;a=aT=Ffyr@GUZc@rW&w#;oGfddCw{x)+a?s8r*Mz|nCtOw@wrY642&`i z3=A9!Pyl3$g7`qp2*j*F3<4k;h8ZHGnHRHwWSJP^FMwo$fC)l@NsyEX5X*sh|A7E( z6o@klXb=LC(M*lt=wM*@DgiWK7>I#!$S4h@K~bRwi`%lqB8BwS5|_l1LKm$STAMb4BNL>98Hiy36tSSl)Bp*LMkXi}XbFIk*@iDNwed%$p?+dP0a}cL zVvq&N&7jx?#i$-gY&1qep+HLjjL}|jj50#9Cn)H}pv5jIv%!mAaOQ={f-)}yG)saa z3|0_>gh7!BDx@_*oY4pbg#s-Bu)3R%oF!pV1gbYd5vT>rlF9jb#rZj@dO7*&8tTx3 yR!>h)T?ba`YCP^Nm7J9Uj+cpm2!;$ literal 0 HcmV?d00001 diff --git a/src/api/static/js/dashboard.js b/src/api/static/js/dashboard.js index 88d1bd9..32d7e59 100755 --- a/src/api/static/js/dashboard.js +++ b/src/api/static/js/dashboard.js @@ -17,12 +17,20 @@ dashboard = { }, initChartist: function(){ - var getData = $.get('/get/1'); - + var getData = $.get('/1/app/usage/trend'); + var appStatus = $.get('/1/app/status?node=apps@seeker-hacker&app=terminal'); + console.log('appstatus...', appStatus) + console.log('appstatus statusText...', appStatus.status) + console.log('appstatus responseText...', appStatus.responseText) + console.log('getData...', getData); + getData.done(function(results) { var data = JSON.parse(results) - - var app = data['apps@lab']; + console.log('data...', data) + var app = data['Chrome']; + console.log('app...', app) + console.log('cpu', app.cpu) + console.log('memory', app.memory_used) function getCpuUsage (app){ cpu_usage = [] @@ -52,24 +60,24 @@ dashboard = { // 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.cpu, app.memory_used, [0.1, 2, 4, 0.8], ] // Add memory available? + //[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], + //] }; 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, @@ -92,8 +100,8 @@ dashboard = { memory_usage = getMemoryUsage(app) var data = { labels: ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], - series: [ - cpu_usage,memory_usage + series: [app.cpu, app.memory_used + //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] ] @@ -196,7 +204,7 @@ dashboard = { Chartist.Pie('#chartPreferences', { labels: percentage, - series: statusByNum + series: [1,2,3] }); }) }, @@ -263,21 +271,21 @@ g.summary.factory = function (url,pointer) { console.log(r) //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 -} \ No newline at end of file + return object + +} 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 @@