statistic.tpl.php 4.7 KB

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