statistic.tpl.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <div class="container">
  2. <div class="row clearfix">
  3. <div class="col-md-12 column">
  4. <ul class="nav nav-tabs">
  5. <li>
  6. <a href="/">概述</a>
  7. </li>
  8. <li>
  9. <a class="active" 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-3 column">
  33. <ul><?php echo $module_str;?></ul>
  34. </div>
  35. <div class="col-md-9 column">
  36. <?php if($module && $interface){?>
  37. <div class="row clearfix">
  38. <div class="col-md-12 column text-center">
  39. <?php echo $date_btn_str;?>
  40. </div>
  41. </div>
  42. <div class="row clearfix">
  43. <div class="col-md-12 column height-400" id="req-container" >
  44. </div>
  45. </div>
  46. <div class="row clearfix">
  47. <div class="col-md-12 column height-400" id="time-container" >
  48. </div>
  49. </div>
  50. <?php if($module && $interface){?>
  51. <script>
  52. Highcharts.setOptions({
  53. global: {
  54. useUTC: false
  55. }
  56. });
  57. $('#req-container').highcharts({
  58. chart: {
  59. type: 'spline'
  60. },
  61. title: {
  62. text: '<?php echo "$date $interface_name";?> 请求量曲线'
  63. },
  64. subtitle: {
  65. text: ''
  66. },
  67. xAxis: {
  68. type: 'datetime',
  69. dateTimeLabelFormats: {
  70. hour: '%H:%M'
  71. }
  72. },
  73. yAxis: {
  74. title: {
  75. text: '请求量(次/5分钟)'
  76. },
  77. min: 0
  78. },
  79. tooltip: {
  80. formatter: function() {
  81. return '<p style="color:'+this.series.color+';font-weight:bold;">'
  82. + this.series.name +
  83. '</p><br /><p style="color:'+this.series.color+';font-weight:bold;">时间:' + Highcharts.dateFormat('%m月%d日 %H:%M', this.x) +
  84. '</p><br /><p style="color:'+this.series.color+';font-weight:bold;">数量:'+ this.y + '</p>';
  85. }
  86. },
  87. credits: {
  88. enabled: false,
  89. },
  90. series: [{
  91. name: '成功曲线',
  92. data: [
  93. <?php echo $success_series_data;?>
  94. ],
  95. lineWidth: 2,
  96. marker:{
  97. radius: 1
  98. },
  99. pointInterval: 300*1000
  100. },
  101. {
  102. name: '失败曲线',
  103. data: [
  104. <?php echo $fail_series_data;?>
  105. ],
  106. lineWidth: 2,
  107. marker:{
  108. radius: 1
  109. },
  110. pointInterval: 300*1000,
  111. color : '#9C0D0D'
  112. }]
  113. });
  114. $('#time-container').highcharts({
  115. chart: {
  116. type: 'spline'
  117. },
  118. title: {
  119. text: '<?php echo "$date $interface_name";?> 请求耗时曲线'
  120. },
  121. subtitle: {
  122. text: ''
  123. },
  124. xAxis: {
  125. type: 'datetime',
  126. dateTimeLabelFormats: {
  127. hour: '%H:%M'
  128. }
  129. },
  130. yAxis: {
  131. title: {
  132. text: '平均耗时(单位:秒)'
  133. },
  134. min: 0
  135. },
  136. tooltip: {
  137. formatter: function() {
  138. return '<p style="color:'+this.series.color+';font-weight:bold;">'
  139. + this.series.name +
  140. '</p><br /><p style="color:'+this.series.color+';font-weight:bold;">时间:' + Highcharts.dateFormat('%m月%d日 %H:%M', this.x) +
  141. '</p><br /><p style="color:'+this.series.color+';font-weight:bold;">平均耗时:'+ this.y + '</p>';
  142. }
  143. },
  144. credits: {
  145. enabled: false,
  146. text: "jumei.com",
  147. href: "http://www.jumei.com"
  148. },
  149. series: [{
  150. name: '成功曲线',
  151. data: [
  152. <?php echo $success_time_series_data;?>
  153. ],
  154. lineWidth: 2,
  155. marker:{
  156. radius: 1
  157. },
  158. pointInterval: 300*1000
  159. },
  160. {
  161. name: '失败曲线',
  162. data: [
  163. <?php echo $fail_time_series_data;?>
  164. ],
  165. lineWidth: 2,
  166. marker:{
  167. radius: 1
  168. },
  169. pointInterval: 300*1000,
  170. color : '#9C0D0D'
  171. }]
  172. });
  173. </script>
  174. <?php }?>
  175. <table class="table table-hover table-condensed table-bordered">
  176. <thead>
  177. <tr>
  178. <th>时间</th><th>调用总数</th><th>平均耗时</th><th>成功调用总数</th><th>成功平均耗时</th><th>失败调用总数</th><th>失败平均耗时</th><th>成功率</th>
  179. </tr>
  180. </thead>
  181. <tbody>
  182. <?php echo $table_data;?>
  183. </tbody>
  184. </table>
  185. <?php }?>
  186. </div>
  187. </div>
  188. </div>