|
|
@ -18,17 +18,10 @@ dashboard = {
|
|
|
|
|
|
|
|
|
|
|
|
initChartist: function(){
|
|
|
|
initChartist: function(){
|
|
|
|
var getData = $.get('/1/app/usage/trend');
|
|
|
|
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('getData...', getData);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getData.done(function(results) {
|
|
|
|
getData.done(function(results) {
|
|
|
|
var data = JSON.parse(results)
|
|
|
|
var data = JSON.parse(results)
|
|
|
|
console.log('data...', data)
|
|
|
|
|
|
|
|
var app = data['Chrome'];
|
|
|
|
var app = data['Chrome'];
|
|
|
|
console.log('app...', app)
|
|
|
|
|
|
|
|
console.log('cpu', app.cpu)
|
|
|
|
|
|
|
|
console.log('memory', app.memory_used)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getCpuUsage (app){
|
|
|
|
function getCpuUsage (app){
|
|
|
|
cpu_usage = []
|
|
|
|
cpu_usage = []
|
|
|
@ -47,7 +40,6 @@ dashboard = {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return memory_usage
|
|
|
|
return memory_usage
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function getStatus (app){
|
|
|
|
function getStatus (app){
|
|
|
|
statusList = []
|
|
|
|
statusList = []
|
|
|
|
for (var i in app){
|
|
|
|
for (var i in app){
|
|
|
@ -56,17 +48,10 @@ dashboard = {
|
|
|
|
return statusList
|
|
|
|
return statusList
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
monitorStatus = function(idle, crash, running){ // TODO: make this async with g.summary at bottom
|
|
|
|
|
|
|
|
return idle, crash, running
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// monitoring apps chart
|
|
|
|
// monitoring apps chart
|
|
|
|
var dataChart = {
|
|
|
|
var dataChart = {
|
|
|
|
labels: ['9:00AM', '12:00AM', '3:00PM', '6:00PM', '9:00PM', '12:00PM', '3:00AM', '6:00AM'],
|
|
|
|
labels: ['9:00AM', '12:00AM', '3:00PM', '6:00PM', '9:00PM', '12:00PM', '3:00AM', '6:00AM'],
|
|
|
|
series: [app.cpu, app.memory_used, [0.1, 2, 4, 0.8], ] // Add memory available?
|
|
|
|
series: [app.memory_used, app.cpu, ] // TODO: Check the order, the graph is by index not name.
|
|
|
|
//[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 = {
|
|
|
|
var optionsChart = {
|
|
|
@ -98,15 +83,10 @@ dashboard = {
|
|
|
|
Chartist.Line('#chartHours', dataChart, optionsChart, responsiveChart);
|
|
|
|
Chartist.Line('#chartHours', dataChart, optionsChart, responsiveChart);
|
|
|
|
|
|
|
|
|
|
|
|
// cpu and memory --------------------------
|
|
|
|
// cpu and memory --------------------------
|
|
|
|
cpu_usage = getCpuUsage(app)
|
|
|
|
|
|
|
|
memory_usage = getMemoryUsage(app)
|
|
|
|
|
|
|
|
var data = {
|
|
|
|
var data = {
|
|
|
|
labels: ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
|
|
|
labels: ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
|
|
|
series: [app.cpu, app.memory_used
|
|
|
|
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]
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var options = {
|
|
|
|
var options = {
|
|
|
@ -130,26 +110,6 @@ dashboard = {
|
|
|
|
|
|
|
|
|
|
|
|
Chartist.Line('#chartActivity', data, options, responsiveOptions);
|
|
|
|
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)
|
|
|
|
status = getStatus(app)
|
|
|
|
statusList = status.split(',');
|
|
|
|
statusList = status.split(',');
|
|
|
|
|
|
|
|
|
|
|
@ -203,7 +163,7 @@ dashboard = {
|
|
|
|
for (i in percentage){
|
|
|
|
for (i in percentage){
|
|
|
|
percentage[i] = percentage[i].toString()+'%';
|
|
|
|
percentage[i] = percentage[i].toString()+'%';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
console.log("running", running)
|
|
|
|
|
|
|
|
Chartist.Pie('#chartPreferences', {
|
|
|
|
Chartist.Pie('#chartPreferences', {
|
|
|
|
labels: percentage,
|
|
|
|
labels: percentage,
|
|
|
|
series: [1,2,3]
|
|
|
|
series: [1,2,3]
|
|
|
@ -271,7 +231,7 @@ g.summary.factory = function (url,pointer) {
|
|
|
|
r = JSON.parse(r.responseText)
|
|
|
|
r = JSON.parse(r.responseText)
|
|
|
|
pointer(r)
|
|
|
|
pointer(r)
|
|
|
|
console.log(r)
|
|
|
|
console.log(r)
|
|
|
|
monitorStatus(r.idle, r.crash, r.running)
|
|
|
|
//monitorStatus(r.idle, r.crash, r.running)
|
|
|
|
|
|
|
|
|
|
|
|
//observer.notify()
|
|
|
|
//observer.notify()
|
|
|
|
|
|
|
|
|
|
|
|