|
|
@ -1,5 +1,21 @@
|
|
|
|
var MONTHS = { 1: 'Jan', 2: 'Feb', 3: 'Mar', 4: 'Apr', 5: 'May', 6: 'Jun', 7: 'Jul', 8: 'Aug', 9: 'Sep', 10: 'Oct', 11: 'Nov', 12: 'Dec' }
|
|
|
|
var MONTHS = { 1: 'Jan', 2: 'Feb', 3: 'Mar', 4: 'Apr', 5: 'May', 6: 'Jun', 7: 'Jul', 8: 'Aug', 9: 'Sep', 10: 'Oct', 11: 'Nov', 12: 'Dec' }
|
|
|
|
var monitor = {}
|
|
|
|
var monitor = {}
|
|
|
|
|
|
|
|
monitor.utils = {}
|
|
|
|
|
|
|
|
monitor.utils.get = {}
|
|
|
|
|
|
|
|
monitor.utils.get.time = function (item) {
|
|
|
|
|
|
|
|
// date = ([item.day + '-' + MONTHS[item.month] + '-' + item.year, hour + ':' + item.minute]).join(' ')
|
|
|
|
|
|
|
|
var hour = item.hour > 9 ? item.hour : ('0' + item.hour)
|
|
|
|
|
|
|
|
if (hour > 12) {
|
|
|
|
|
|
|
|
var units = 'PM'
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
var units = 'AM'
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return ([hour+':'+item.minute,units]).join(' ')
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
monitor.utils.get.dateTime = function (item) {
|
|
|
|
|
|
|
|
var time = monitor.utils.get.time(item)
|
|
|
|
|
|
|
|
return ([item.day+'-'+MONTHS[item.month]+'-'+item.year,time]).join(' ')
|
|
|
|
|
|
|
|
}
|
|
|
|
monitor.processes = {}
|
|
|
|
monitor.processes = {}
|
|
|
|
monitor.processes.fetch = function(){
|
|
|
|
monitor.processes.fetch = function(){
|
|
|
|
var httpclient = HttpClient.instance()
|
|
|
|
var httpclient = HttpClient.instance()
|
|
|
@ -66,7 +82,8 @@ monitor.processes.render = function(label,data) {
|
|
|
|
return row
|
|
|
|
return row
|
|
|
|
})
|
|
|
|
})
|
|
|
|
jx.dom.set.value('latest_processes','') ;
|
|
|
|
jx.dom.set.value('latest_processes','') ;
|
|
|
|
jx.dom.set.value('latest_processes_label',label)
|
|
|
|
jx.dom.set.value('latest_processes_label', label)
|
|
|
|
|
|
|
|
|
|
|
|
var options = {
|
|
|
|
var options = {
|
|
|
|
width: $('#latest_processes').width(), height:'auto'
|
|
|
|
width: $('#latest_processes').width(), height:'auto'
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -95,6 +112,11 @@ monitor.processes.render = function(label,data) {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
jx.dom.hide('has_anomaly')
|
|
|
|
jx.dom.hide('has_anomaly')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// var hour = item.hour < 10? ('0'+item.hour): item.hour
|
|
|
|
|
|
|
|
// date = ([item.day + '-' + MONTHS[item.month] + '-' + item.year, hour + ':' + item.minute]).join(' ')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
jx.dom.set.value('node_last_lookup',monitor.utils.get.dateTime(item))
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
options.autoload = true
|
|
|
|
options.autoload = true
|
|
|
@ -144,7 +166,7 @@ monitor.processes.trend.render = function (logs, key,label) {
|
|
|
|
conf.options = { legend: { position: 'bottom' } }
|
|
|
|
conf.options = { legend: { position: 'bottom' } }
|
|
|
|
conf.options.scales = {}
|
|
|
|
conf.options.scales = {}
|
|
|
|
conf.options.scales.yAxes = [
|
|
|
|
conf.options.scales.yAxes = [
|
|
|
|
{id:'0',scaleLabel:{display:true,labelString:' % CPU & MEMORY USAGE'},ticks:{min:0,max:100,beginAtZero:true},gridLines: {display:false}}
|
|
|
|
{id:'0',scaleLabel:{display:true,labelString:'CPU & MEMORY %'},ticks:{min:0,max:100,beginAtZero:true},gridLines: {display:false}}
|
|
|
|
// {id:'1',position:'right',scaleLabel:{display:true,labelString:'PROCESS COUNT'},ticks:{min:0,stepSize:1,beginAtZero:true},gridLines: {display:false}}
|
|
|
|
// {id:'1',position:'right',scaleLabel:{display:true,labelString:'PROCESS COUNT'},ticks:{min:0,stepSize:1,beginAtZero:true},gridLines: {display:false}}
|
|
|
|
]
|
|
|
|
]
|
|
|
|
conf.options.scales.xAxes = [
|
|
|
|
conf.options.scales.xAxes = [
|
|
|
@ -153,7 +175,7 @@ monitor.processes.trend.render = function (logs, key,label) {
|
|
|
|
gridLines: {display:false},
|
|
|
|
gridLines: {display:false},
|
|
|
|
|
|
|
|
|
|
|
|
time: {
|
|
|
|
time: {
|
|
|
|
format:'DD-MMM HH:mm'
|
|
|
|
format:'HH:mm'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -166,12 +188,13 @@ monitor.processes.trend.render = function (logs, key,label) {
|
|
|
|
var cpu = {label: 'CPU Usage (%)', data: [] ,backgroundColor:'transparent',borderColor:COLORS[187],fill:false,borderWidth:1}
|
|
|
|
var cpu = {label: 'CPU Usage (%)', data: [] ,backgroundColor:'transparent',borderColor:COLORS[187],fill:false,borderWidth:1}
|
|
|
|
var mem = {label : 'Memory Usage(%)',data:[],backgroundColor:'transparent',borderColor:COLORS[32],fill:false,borderWidth:1}
|
|
|
|
var mem = {label : 'Memory Usage(%)',data:[],backgroundColor:'transparent',borderColor:COLORS[32],fill:false,borderWidth:1}
|
|
|
|
// var proc= {yAxisID:'1',label : 'Proc Count',data:[],backgroundColor:'transparent',borderColor:COLORS[542],fill:false,borderWidth:1}
|
|
|
|
// var proc= {yAxisID:'1',label : 'Proc Count',data:[],backgroundColor:'transparent',borderColor:COLORS[542],fill:false,borderWidth:1}
|
|
|
|
var months={1:"Jan",2:"Feb",3:"Mar",4:"Apr",5:"May",6:"Jun",7:"Jul",8:"Aug",9:"Sep",10:"Oct",11:"Nov",12:"Dec"}
|
|
|
|
// var months={1:"Jan",2:"Feb",3:"Mar",4:"Apr",5:"May",6:"Jun",7:"Jul",8:"Aug",9:"Sep",10:"Oct",11:"Nov",12:"Dec"}
|
|
|
|
jx.utils.patterns.visitor(logs,function(item){
|
|
|
|
jx.utils.patterns.visitor(logs,function(item){
|
|
|
|
//x = new Date(item.year,item.month-1,item.day,item.hour,item.minute)
|
|
|
|
//x = new Date(item.year,item.month-1,item.day,item.hour,item.minute)
|
|
|
|
day = item.day.length > 1? (['0',item.day]).join(''): item.day
|
|
|
|
// day = item.day.length > 1? (['0',item.day]).join(''): item.day
|
|
|
|
month = months[item.month]
|
|
|
|
// month = months[item.month]
|
|
|
|
x = ([month,day,item.hour+':'+item.minute]).join(' ')
|
|
|
|
// x = ([month, day, item.hour + ':' + item.minute]).join(' ')
|
|
|
|
|
|
|
|
x = monitor.utils.get.time(item).replace(/AM|PM/g,'')
|
|
|
|
y = item[key]
|
|
|
|
y = item[key]
|
|
|
|
if (_x[x] == null ){//||(_x[x] == null && _y[y] == null)) {
|
|
|
|
if (_x[x] == null ){//||(_x[x] == null && _y[y] == null)) {
|
|
|
|
_x[x] = 1
|
|
|
|
_x[x] = 1
|
|
|
@ -186,7 +209,8 @@ monitor.processes.trend.render = function (logs, key,label) {
|
|
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var item = logs[logs.length - 1]
|
|
|
|
|
|
|
|
jx.dom.set.value('trend_last_lookup',monitor.utils.get.dateTime(item))
|
|
|
|
|
|
|
|
|
|
|
|
conf.data.datasets = [cpu,mem]
|
|
|
|
conf.data.datasets = [cpu,mem]
|
|
|
|
x_axis = jx.utils.unique(x_axis)
|
|
|
|
x_axis = jx.utils.unique(x_axis)
|
|
|
@ -217,7 +241,8 @@ monitor.processes.summary.init = function(logs){
|
|
|
|
if (date == null) {
|
|
|
|
if (date == null) {
|
|
|
|
|
|
|
|
|
|
|
|
// date = new Date(item.year,item.month-1,item.day,item.hour,item.minute)
|
|
|
|
// date = new Date(item.year,item.month-1,item.day,item.hour,item.minute)
|
|
|
|
date = ([item.day+'-'+MONTHS[item.month]+'-'+item.year,item.hour+':'+item.minute]).join(' ')
|
|
|
|
// date = ([item.day + '-' + MONTHS[item.month] + '-' + item.year, item.hour + ':' + item.minute]).join(' ')
|
|
|
|
|
|
|
|
date = monitor.utils.get.dateTime(item)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (item.status == 'running'){
|
|
|
|
if (item.status == 'running'){
|
|
|
|
xr += 1
|
|
|
|
xr += 1
|
|
|
@ -329,10 +354,11 @@ monitor.sandbox.init = function () {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
monitor.sandbox.render = function (logs) {
|
|
|
|
monitor.sandbox.render = function (logs) {
|
|
|
|
months = { 1: 'Jan', 2: 'Feb', 3: 'Mar', 4: 'Apr', 5: 'May', 6: 'Jun', 7: 'Jul', 8: 'Aug', 9: 'Sep', 10: 'Oct', 11: 'Nov', 12: 'Dec' }
|
|
|
|
// months = { 1: 'Jan', 2: 'Feb', 3: 'Mar', 4: 'Apr', 5: 'May', 6: 'Jun', 7: 'Jul', 8: 'Aug', 9: 'Sep', 10: 'Oct', 11: 'Nov', 12: 'Dec' }
|
|
|
|
|
|
|
|
|
|
|
|
var d = ([logs[0].day, '-', MONTHS[logs[0].month], '-', logs[0].year, ' ', logs[0].hour, ':', logs[0].minute]).join('')
|
|
|
|
// var d = ([logs[0].day, '-', MONTHS[logs[0].month], '-', logs[0].year, ' ', logs[0].hour, ':', logs[0].minute]).join('')
|
|
|
|
jx.dom.set.value('sandbox_date', d)
|
|
|
|
var item = logs[logs.length -1]
|
|
|
|
|
|
|
|
jx.dom.set.value('sandbox_date', monitor.utils.get.datetime(item))
|
|
|
|
|
|
|
|
|
|
|
|
var options = { width: $('#sandbox_status').width()-8, height: 'auto' }
|
|
|
|
var options = { width: $('#sandbox_status').width()-8, height: 'auto' }
|
|
|
|
options.data = jx.utils.patterns.visitor(logs, function (item) {
|
|
|
|
options.data = jx.utils.patterns.visitor(logs, function (item) {
|
|
|
|