-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
171 lines (143 loc) · 4.67 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<!DOCTYPE html>
<html>
<head>
<style>
body{
background-color: black
}
#notfound{
color: #dddddd
}
#errorfound{
color: #FFAEAE
}
</style>
</head>
<body>
<script src="dist/jquery.js"></script>
<script src="dist/jquery.jqplot.js"></script>
<script type="text/javascript" src="dist/plugins/jqplot.dateAxisRenderer.min.js"></script>
<script type="text/javascript" src="dist/plugins/jqplot.logAxisRenderer.min.js"></script>
<script type="text/javascript" src="dist/plugins/jqplot.canvasTextRenderer.min.js"></script>
<script type="text/javascript" src="dist/plugins/jqplot.canvasAxisTickRenderer.min.js"></script>
<script type="text/javascript" src="dist/plugins/jqplot.highlighter.min.js"></script>
<script type="text/javascript" src="jquery-ui-1.10.1.custom/js/jquery-ui-1.10.1.custom.js"></script>
<link rel="stylesheet" type="text/css" href="dist/jquery.jqplot.min.css" />
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.0/themes/smoothness/jquery-ui.css" />
<link rel="stylesheet" type="text/css" href="jquery-ui-1.10.1.custom/css/smoothness/jquery-ui-1.10.1.custom.css" />
<input type="text" id="datepicker" />
<div id="chart1" class="ui-widget-content ui-corner-bottom" style="height:768px;width:1024px; background: none repeat scroll 0 0 #393939;"></div>
<script>
$(function() {
$( "#datepicker" ).datepicker({
onSelect: function(selectedDate) {
data = selectedDate.split("/");
getData(data[1], data[0], data[2])
}
});
});
function get_plot_options(){
plotOptions = {
seriesColors: ["rgba(78, 135, 194, 0.7)", "rgb(211, 235, 59)"],
title: {
text: 'Web page response time [seconds] for '.concat(graphDate),
textColor: '#DDDDDD',
},
highlighter: {
show: true,
sizeAdjust: 1,
tooltipOffset: 9
},
grid: {
background: 'rgba(57,57,57,0.0)',
drawBorder: false,
shadow: false,
gridLineColor: '#666666',
gridLineWidth: 2
},
seriesDefaults: {
color: 'yellow',
rendererOptions: {
smooth: true,
animation: {
show: true
}
},
showMarker: false
},
axesDefaults: {
rendererOptions: {
baselineWidth: 1.5,
baselineColor: '#444444',
drawBaseline: false
},
pad: 0,
numberTicks: 20
},
axes: {
xaxis: {
renderer: $.jqplot.DateAxisRenderer,
tickRenderer: $.jqplot.CanvasAxisTickRenderer,
tickInterval: 3600000,
pad: 1,
tickOptions: {
formatString: "'%H:%M'",
angle: -90,
textColor: '#dddddd'
},
drawMajorGridlines: false
},
yaxis: {
tickOptions: {
textColor: '#dddddd'
}
}
}
};
return plotOptions;
}
function getData(day, month, year){
graphDate = year.concat("-").concat(month).concat("-").concat(day)
$.ajax({
url: graphDate.concat("-web_check.log"), //"2013-03-14-web_check.log",
type: 'GET',
error: function(){
$("#notfound").remove();
$("#chart1").append('<div id="notfound"><br/><br/><br/><h1>No data log file found for date '.concat(graphDate).concat('</h1></div>'));
},
success: function(result) {
$("#notfound").remove();
$("#errorfound").remove();
data = result.split(" ");
var plotData = new Array();
for (var i = 0; i <= (data.length/6); i++) {
response_code = data[i*6 + 5]
if(typeof response_code === 'undefined')
continue;
if( response_code === "OK(200)" ){
plotData[i] = new Array(data[i*6 + 1], parseFloat(data[i*6 + 3], 10));
}
if(response_code.indexOf('ERROR') !== -1){
if($("#errorfound").length <= 0)
$("#chart1").append('<div id="errorfound"><br/><h1>There was at least one error response </h1></div>');
}
}
plotGraph(plotData, graphDate);
}
});
}
$(function () {
var dt = new Date();
month = String(dt.getMonth() + 1)
if(month.length === 1)
month = "0".concat(month)
getData(String(dt.getDate()), month, String(dt.getFullYear())) ;
})
function plotGraph(responseData, graphDate) {
$.jqplot._noToImageButton = true;
var plot1 = $.jqplot("chart1", [responseData], get_plot_options()).replot();
$('.jqplot-highlighter-tooltip').addClass('ui-corner-all')
}
</script>
</body>
</html>