view.html 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. {% extends "portal/layout.html" %}
  2. {% block content %}
  3. <link rel="stylesheet" href="{{ url_for('static', filename='select2/select2.css') }}"/>
  4. <link rel="stylesheet" href="{{ url_for('static', filename='css/select2-bootstrap.css') }}"/>
  5. <script type="text/javascript" src="{{ url_for('static', filename='select2/select2.min.js') }}"></script>
  6. <input type="hidden" id="tpl_id" value="{{ data.tpl.id }}">
  7. <div class="panel panel-default">
  8. <div class="panel-heading">模板基本信息</div>
  9. <div class="panel-body">
  10. name: {{ data.tpl.tpl_name }}
  11. {% if data.tpl.parent %}
  12. <span class="cut-line">¦</span>
  13. parent: <a target="_blank"
  14. href="{{ url_for('template_view_get', tpl_id=data.tpl.parent.id) }}">{{ data.tpl.parent.tpl_name }}</a>
  15. {% endif %}
  16. <div class="pull-right">
  17. {% if data.tpl.writable(g.user) %}
  18. <a href="{{ url_for('template_update_get', tpl_id=data.tpl.id) }}"
  19. style="text-decoration: none;">
  20. <span class="glyphicon glyphicon-edit orange"></span>
  21. </a>
  22. {% endif %}
  23. </div>
  24. </div>
  25. </div>
  26. <div class="panel panel-default">
  27. <div class="panel-heading">该模板中的策略列表</div>
  28. <div class="panel-body">
  29. <div style="line-height: 35px;">
  30. max: 最大报警次数 P:报警级别(&lt;3: 既发短信也发邮件 &gt;=3: 只发邮件) run:生效时间,不指定就是全天生效
  31. </div>
  32. </div>
  33. <table class="table table-hover table-bordered table-striped" style="margin-bottom: 0px;">
  34. <thead>
  35. <tr>
  36. <th>metric/<span class="text-success">tags</span><span class="gray"> [note]</span></th>
  37. <th>condition</th>
  38. <th>max</th>
  39. <th>P</th>
  40. <th>run</th>
  41. </tr>
  42. </thead>
  43. <tbody>
  44. {% for s in data.ss %}
  45. <tr>
  46. <td>
  47. {{ s.metric }}{% if s.tags %}<span class="gray">/</span><span class="text-success">{{ s.tags }}</span>{% endif %}
  48. <span class="gray">{% if s.note %}[{{ s.note }}]{% endif %}</span>
  49. </td>
  50. <td>
  51. {{ s.func }}{{ s.op }}{{ s.right_value }}
  52. </td>
  53. <td>{{ s.max_step }}</td>
  54. <td>{{ s.priority }}</td>
  55. <td>{% if s.run_begin and s.run_end %}{{ s.run_begin }}-{{ s.run_end }}{% endif %}</td>
  56. </tr>
  57. {% else %}
  58. <tr>
  59. <td colspan="5">no records</td>
  60. </tr>
  61. {% endfor %}
  62. </tbody>
  63. </table>
  64. </div>
  65. <div class="panel panel-warning">
  66. <div class="panel-heading">模板报警配置,对模板中的所有策略生效</div>
  67. <div class="panel-body">
  68. <div class="pull-right">
  69. <a target="_blank" href="/team/list">修改报警组内成员</a>
  70. </div>
  71. {% if data.tpl.action %}
  72. 告警接收组: {{ data.tpl.action.uic_href() | safe }}<br>
  73. {% else %}
  74. 没有配置报警接收人哦<br>
  75. {% endif %}
  76. <hr/>
  77. {% if data.tpl.action.url %}
  78. <div class="mt10">
  79. Callback: {{ data.tpl.action.url }}
  80. </div>
  81. <pre><code>#callback request payload:
  82. {
  83. "endpoint": event.Endpoint,
  84. "metric": event.Metric(),
  85. "status": event.Status,
  86. "step": event.CurrentStep,
  87. "priority": event.Priority(),
  88. "time": event.FormattedTime(),
  89. "tpl_id": event.TplId(),
  90. "exp_id": event.ExpressionId(),
  91. "stra_id": event.StrategyId(),
  92. "tags": "srv=falcon,mount=sda"
  93. }
  94. # for more infomation, look the code https://github.com/open-falcon/falcon-plus/blob/master/common/model/event.go
  95. </code></pre>
  96. <div class="mt10">
  97. <label class="checkbox-inline">
  98. <input type="checkbox" id="before_callback_sms"
  99. {% if data.tpl.action.before_callback_sms == 1 %}checked="checked"{% endif %}> 回调之前发提醒短信
  100. </label>
  101. <label class="checkbox-inline">
  102. <input type="checkbox" id="before_callback_mail"
  103. {% if data.tpl.action.before_callback_mail == 1 %}checked="checked"{% endif %}> 回调之前发提醒邮件
  104. </label>
  105. <label class="checkbox-inline">
  106. <input type="checkbox" id="after_callback_sms"
  107. {% if data.tpl.action.after_callback_sms == 1 %}checked="checked"{% endif %}> 回调之后发结果短信
  108. </label>
  109. <label class="checkbox-inline">
  110. <input type="checkbox" id="after_callback_mail"
  111. {% if data.tpl.action.after_callback_mail == 1 %}checked="checked"{% endif %}> 回调之后发结果邮件
  112. </label>
  113. </div>
  114. {% endif %}
  115. </div>
  116. </div>
  117. {% endblock %}