main.tpl.php 6.3 KB

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