index.html 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. {{template "main" .}}
  2. <!-- Navbar -->
  3. <nav class="main-header navbar navbar-expand navbar-white navbar-light">
  4. <!-- Left navbar links -->
  5. <ul class="navbar-nav">
  6. <li class="nav-item">
  7. <a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a>
  8. </li>
  9. <li class="nav-item d-none d-sm-inline-block">
  10. <a href="/" class="nav-link">Dashboard</a>
  11. </li>
  12. </ul>
  13. </nav>
  14. <!-- /.navbar -->
  15. <!-- Content Wrapper. Contains page content -->
  16. <div class="content-wrapper">
  17. <!-- Content Header (Page header) -->
  18. <section class="content-header">
  19. <div class="container-fluid">
  20. <div class="row mb-2">
  21. <div class="col-sm-6">
  22. <h1>PrometheusAlert</h1>
  23. </div>
  24. </div>
  25. </div><!-- /.container-fluid -->
  26. </section>
  27. <!-- Main content -->
  28. <section class="content">
  29. <div class="container-fluid">
  30. <div class="row">
  31. <div class="col-md-6">
  32. <!-- DONUT CHART -->
  33. <div class="card card-danger">
  34. <div class="card-header">
  35. <h3 class="card-title">接收告警</h3>
  36. <div class="card-tools">
  37. <button type="button" class="btn btn-tool" data-card-widget="collapse">
  38. <i class="fas fa-minus"></i>
  39. </button>
  40. <button type="button" class="btn btn-tool" data-card-widget="remove">
  41. <i class="fas fa-times"></i>
  42. </button>
  43. </div>
  44. </div>
  45. <div class="card-body">
  46. <canvas id="donutChart" style="min-height: 250px; height: 250px; max-height: 250px; max-width: 100%;"></canvas>
  47. </div>
  48. <!-- /.card-body -->
  49. </div>
  50. <!-- /.card -->
  51. </div>
  52. <!-- /.col (LEFT) -->
  53. <div class="col-md-6">
  54. <!-- BAR CHART -->
  55. <div class="card card-success">
  56. <div class="card-header">
  57. <h3 class="card-title">发送告警</h3>
  58. <div class="card-tools">
  59. <button type="button" class="btn btn-tool" data-card-widget="collapse">
  60. <i class="fas fa-minus"></i>
  61. </button>
  62. <button type="button" class="btn btn-tool" data-card-widget="remove">
  63. <i class="fas fa-times"></i>
  64. </button>
  65. </div>
  66. </div>
  67. <div class="card-body">
  68. <div class="chart">
  69. <canvas id="barChart" style="min-height: 250px; height: 250px; max-height: 250px; max-width: 100%;"></canvas>
  70. </div>
  71. </div>
  72. <!-- /.card-body -->
  73. </div>
  74. <!-- /.card -->
  75. </div>
  76. <!-- /.col (RIGHT) -->
  77. </div>
  78. <!-- /.row -->
  79. <!--<div class="row">
  80. <table class="table table-hover">
  81. <thead>
  82. <tr>
  83. <th>名称</th>
  84. <th>模版类型</th>
  85. <th>模版用途</th>
  86. <th>路径</th>
  87. </tr>
  88. </thead>
  89. <tbody id="tpllist" >
  90. <tr>
  91. <th>1</th>
  92. <th>2</th>
  93. <th>3</th>
  94. <th>4</th>
  95. </tr>
  96. </tbody>
  97. </table>
  98. </div>-->
  99. </div><!-- /.container-fluid -->
  100. </section>
  101. <!-- /.content -->
  102. </div>
  103. <!-- /.content-wrapper -->
  104. {{template "endhtml"}}
  105. <script>
  106. $(function () {
  107. /* ChartJS
  108. * -------
  109. * Here we will create a few charts using ChartJS
  110. */
  111. var areaChartData = {
  112. labels : ['Telegram', '七陌短信', '七陌语音电话', '阿里云短信', '阿里云语音电话', ' 百度云短信', 'Bark(iPhone推送)', '钉钉', 'Email', '飞书', '华为云短信', '容联云语音电话', ' 百度Hi(如流)', '腾讯云短信', '腾讯云语音电话', 'Webhook', '企业微信', ' 企业微信应用', '语音播报'],
  113. datasets: [
  114. {
  115. label : 'Send Alerts to',
  116. backgroundColor : 'rgba(60,141,188,0.9)',
  117. borderColor : 'rgba(60,141,188,0.8)',
  118. pointRadius : false,
  119. pointColor : '#3b8bba',
  120. pointStrokeColor : 'rgba(60,141,188,1)',
  121. pointHighlightFill : '#fff',
  122. pointHighlightStroke: 'rgba(60,141,188,1)',
  123. data : [{{.ChartsJson.Telegram}}, {{.ChartsJson.Smoordx}}, {{.ChartsJson.Smoordh}}, {{.ChartsJson.Alydx}}, {{.ChartsJson.Alydh}}, {{.ChartsJson.Bdydx}}, {{.ChartsJson.Bark}}, {{.ChartsJson.Dingding}}, {{.ChartsJson.Email}}, {{.ChartsJson.Feishu}}, {{.ChartsJson.Hwdx}}, {{.ChartsJson.Rlydx}}, {{.ChartsJson.Ruliu}}, {{.ChartsJson.Txdx}}, {{.ChartsJson.Txdh}}, {{.ChartsJson.Webhook}}, {{.ChartsJson.Weixin}}, {{.ChartsJson.Workwechat}}, {{.ChartsJson.Voice}}]
  124. },
  125. ]
  126. }
  127. //-------------
  128. //- DONUT CHART -
  129. //-------------
  130. // Get context with jQuery - using jQuery's .get() method.
  131. var donutChartCanvas = $('#donutChart').get(0).getContext('2d')
  132. var donutData = {
  133. labels: [
  134. 'zabbix',
  135. 'grafana',
  136. 'graylog',
  137. 'prometheus',
  138. 'prometheusalert',
  139. 'aliyun',
  140. ],
  141. datasets: [
  142. {
  143. data: [{{.ChartsJson.Zabbix}},{{.ChartsJson.Grafana}},{{.ChartsJson.Graylog}},{{.ChartsJson.Prometheus}},{{.ChartsJson.Prometheusalert}},{{.ChartsJson.Aliyun}}],
  144. backgroundColor : ['#f56954', '#00a65a', '#f39c12', '#00c0ef', '#3c8dbc'],
  145. }
  146. ]
  147. }
  148. var donutOptions = {
  149. maintainAspectRatio : false,
  150. responsive : true,
  151. }
  152. //Create pie or douhnut chart
  153. // You can switch between pie and douhnut using the method below.
  154. new Chart(donutChartCanvas, {
  155. type: 'doughnut',
  156. data: donutData,
  157. options: donutOptions
  158. })
  159. //-------------
  160. //- BAR CHART -
  161. //-------------
  162. var barChartCanvas = $('#barChart').get(0).getContext('2d')
  163. var barChartData = $.extend(true, {}, areaChartData)
  164. var temp0 = areaChartData.datasets[0]
  165. barChartData.datasets[0] = temp0
  166. var barChartOptions = {
  167. responsive : true,
  168. maintainAspectRatio : false,
  169. datasetFill : false
  170. }
  171. new Chart(barChartCanvas, {
  172. type: 'bar',
  173. data: barChartData,
  174. options: barChartOptions
  175. })
  176. })
  177. </script>
  178. {{template "jshtml"}}