statistic.tpl.php 4.7 KB

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