main.tpl.php 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. <div class="container">
  2. <div class="row clearfix">
  3. <div class="col-md-12 column">
  4. <ul class="nav nav-tabs">
  5. <li class="active">
  6. <a href="/">概述</a>
  7. </li>
  8. <li>
  9. <a href="/?fn=statistic">监控</a>
  10. </li>
  11. <li>
  12. <a href="/?fn=log">日志</a>
  13. </li>
  14. <li class="disabled">
  15. <a href="#">告警</a>
  16. </li>
  17. <li class="dropdown pull-right">
  18. <a href="#" data-toggle="dropdown" class="dropdown-toggle">其它<strong class="caret"></strong></a>
  19. <ul class="dropdown-menu">
  20. <li>
  21. <a href="#">探测节点</a>
  22. </li>
  23. <li>
  24. <a href="#">节点管理</a>
  25. </li>
  26. </ul>
  27. </li>
  28. </ul>
  29. </div>
  30. </div>
  31. <div class="row clearfix">
  32. <div class="col-md-12 column">
  33. <div class="row clearfix">
  34. <div class="col-md-12 column text-center">
  35. <?php echo $date_btn_str;?>
  36. </div>
  37. </div>
  38. <div class="row clearfix">
  39. <div class="col-md-6 column" id="suc-pie">
  40. </div>
  41. <div class="col-md-6 column" id="code-pie">
  42. </div>
  43. </div>
  44. <div class="row clearfix">
  45. <div class="col-md-12 column" id="req-container" >
  46. </div>
  47. </div>
  48. <div class="row clearfix">
  49. <div class="col-md-12 column" id="time-container" >
  50. </div>
  51. </div>
  52. <div class="text-center">
  53. <button class="btn btn-primary" type="button">分别统计</button>
  54. <button class="btn btn-primary" type="button">汇总统计</button>
  55. </div>
  56. <table class="table table-hover table-condensed table-bordered">
  57. <thead>
  58. <tr>
  59. <th>时间</th><th>调用总数</th><th>平均耗时</th><th>成功调用总数</th><th>成功平均耗时</th><th>失败调用总数</th><th>失败平均耗时</th><th>成功率</th>
  60. </tr>
  61. </thead>
  62. <tbody>
  63. <?php echo $table_data;?>
  64. </tbody>
  65. </table>
  66. </div>
  67. </div>
  68. </div>
  69. <script>
  70. Highcharts.setOptions({
  71. global: {
  72. useUTC: false
  73. }
  74. });
  75. $(function () {
  76. $('#suc-pie').highcharts({
  77. chart: {
  78. plotBackgroundColor: null,
  79. plotBorderWidth: null,
  80. plotShadow: false
  81. },
  82. title: {
  83. text: '<?php echo $date;?> 可用性'
  84. },
  85. tooltip: {
  86. pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
  87. },
  88. plotOptions: {
  89. pie: {
  90. allowPointSelect: true,
  91. cursor: 'pointer',
  92. dataLabels: {
  93. enabled: true,
  94. color: '#000000',
  95. connectorColor: '#000000',
  96. format: '<b>{point.name}</b>: {point.percentage:.1f} %'
  97. }
  98. }
  99. },
  100. series: [{
  101. type: 'pie',
  102. name: '可用性',
  103. data: [
  104. {
  105. name: '可用',
  106. y: <?php echo $global_rate;?>,
  107. sliced: true,
  108. selected: true,
  109. color: '#2f7ed8'
  110. },
  111. {
  112. name: '不可用',
  113. y: <?php echo (100-$global_rate);?>,
  114. sliced: true,
  115. selected: true,
  116. color: '#910000'
  117. }
  118. ]
  119. }]
  120. });
  121. });
  122. $(function () {
  123. $('#code-pie').highcharts({
  124. chart: {
  125. plotBackgroundColor: null,
  126. plotBorderWidth: null,
  127. plotShadow: false
  128. },
  129. title: {
  130. text: '<?php echo $date;?> 返回码分布'
  131. },
  132. tooltip: {
  133. pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
  134. },
  135. plotOptions: {
  136. pie: {
  137. allowPointSelect: true,
  138. cursor: 'pointer',
  139. dataLabels: {
  140. enabled: true,
  141. color: '#000000',
  142. connectorColor: '#000000',
  143. format: '<b>{point.name}</b>: {point.percentage:.1f} %'
  144. }
  145. }
  146. },
  147. series: [{
  148. type: 'pie',
  149. name: '返回码分布',
  150. data: [
  151. <?php echo $code_pie_data;?>
  152. ]
  153. }]
  154. });
  155. });
  156. $(function () {
  157. $('#req-container').highcharts({
  158. chart: {
  159. type: 'spline'
  160. },
  161. title: {
  162. text: '<?php echo "$date $interface_name";?> 请求量曲线'
  163. },
  164. subtitle: {
  165. text: ''
  166. },
  167. xAxis: {
  168. type: 'datetime',
  169. dateTimeLabelFormats: {
  170. hour: '%H:%M'
  171. }
  172. },
  173. yAxis: {
  174. title: {
  175. text: '请求量(次/5分钟)'
  176. },
  177. min: 0
  178. },
  179. tooltip: {
  180. formatter: function() {
  181. return '<p style="color:'+this.series.color+';font-weight:bold;">'
  182. + this.series.name +
  183. '</p><br /><p style="color:'+this.series.color+';font-weight:bold;">时间:' + Highcharts.dateFormat('%m月%d日 %H:%M', this.x) +
  184. '</p><br /><p style="color:'+this.series.color+';font-weight:bold;">数量:'+ this.y + '</p>';
  185. }
  186. },
  187. credits: {
  188. enabled: false,
  189. },
  190. series: [ {
  191. name: '成功曲线',
  192. data: [
  193. <?php echo $success_series_data;?>
  194. ],
  195. lineWidth: 2,
  196. marker:{
  197. radius: 1
  198. },
  199. pointInterval: 300*1000
  200. },
  201. {
  202. name: '失败曲线',
  203. data: [
  204. <?php echo $fail_series_data;?>
  205. ],
  206. lineWidth: 2,
  207. marker:{
  208. radius: 1
  209. },
  210. pointInterval: 300*1000,
  211. color : '#9C0D0D'
  212. }]
  213. });
  214. });
  215. $(function () {
  216. $('#time-container').highcharts({
  217. chart: {
  218. type: 'spline'
  219. },
  220. title: {
  221. text: '<?php echo "$date $interface_name";?> 请求耗时曲线'
  222. },
  223. subtitle: {
  224. text: ''
  225. },
  226. xAxis: {
  227. type: 'datetime',
  228. dateTimeLabelFormats: {
  229. hour: '%H:%M'
  230. }
  231. },
  232. yAxis: {
  233. title: {
  234. text: '平均耗时(单位:秒)'
  235. },
  236. min: 0
  237. },
  238. tooltip: {
  239. formatter: function() {
  240. return '<p style="color:'+this.series.color+';font-weight:bold;">'
  241. + this.series.name +
  242. '</p><br /><p style="color:'+this.series.color+';font-weight:bold;">时间:' + Highcharts.dateFormat('%m月%d日 %H:%M', this.x) +
  243. '</p><br /><p style="color:'+this.series.color+';font-weight:bold;">平均耗时:'+ this.y + '</p>';
  244. }
  245. },
  246. credits: {
  247. enabled: false,
  248. text: "jumei.com",
  249. href: "http://www.jumei.com"
  250. },
  251. series: [ {
  252. name: '成功曲线',
  253. data: [
  254. <?php echo $success_time_series_data;?>
  255. ],
  256. lineWidth: 2,
  257. marker:{
  258. radius: 1
  259. },
  260. pointInterval: 300*1000
  261. },
  262. {
  263. name: '失败曲线',
  264. data: [
  265. <?php echo $fail_time_series_data;?>
  266. ],
  267. lineWidth: 2,
  268. marker:{
  269. radius: 1
  270. },
  271. pointInterval: 300*1000,
  272. color : '#9C0D0D'
  273. } ]
  274. });
  275. });
  276. </script>