main.tpl.php 5.5 KB

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