You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

168 lines
5.9 KiB

8 years ago
9 years ago
  1. {% extends "base.html" %}
  2. {% load compress humanize staticfiles hc_extras %}
  3. {% block title %}My Checks - {% site_name %}{% endblock %}
  4. {% block content %}
  5. <div class="row">
  6. <div class="col-sm-12">
  7. <ol class="breadcrumb">
  8. <li><a href="{% url 'hc-checks' %}">Checks</a></li>
  9. <li>
  10. <a href="{% url 'hc-details' check.code %}">
  11. {{ check.name_then_code }}
  12. </a>
  13. </li>
  14. <li class="active">Log</li>
  15. <li id="format-switcher-container" class="pull-right">
  16. <div id="format-switcher" class="btn-group" data-toggle="buttons">
  17. <label class="btn btn-default btn-xs" data-format="utc">
  18. <input type="radio" name="date-format" checked>
  19. UTC
  20. </label>
  21. <label class="btn btn-default btn-xs active" data-format="local">
  22. <input type="radio" name="date-format">
  23. Local Time
  24. </label>
  25. </div>
  26. </li>
  27. </ol>
  28. {% if events %}
  29. <div class="table-responsive">
  30. <table class="table" id="log">
  31. {% for event in events %}
  32. {% if event.n %}
  33. <tr class="ok" data-dt="{{ event.created.isoformat }}" data-url="{% url 'hc-ping-details' check.code event.n %}">
  34. <td class="n-cell">
  35. <span class="hash">#</span>{{ event.n }}
  36. </td>
  37. <td class="date"></td>
  38. <td class="time"></td>
  39. <td class="text-right">
  40. {% if event.kind == "fail" %}
  41. <span class="label label-danger">Failure</span>
  42. {% elif event.kind == "start" %}
  43. <span class="label label-start">Started</span>
  44. {% elif event.kind == "ign" %}
  45. <span class="label label-ign">Ignored</span>
  46. {% else %}
  47. <span class="label label-success">OK</span>
  48. {% endif %}
  49. </td>
  50. <td class="details">
  51. {% if event.delta %}
  52. <div class="delta">
  53. <span class="icon-timer"></span>
  54. {{ event.delta|mins_secs }}
  55. </div>
  56. {% endif %}
  57. {% if event.scheme == "email" %}
  58. {{ event.ua }}
  59. <span class="ua-body">
  60. {% if event.body %}
  61. - {{ event.body|truncatechars:150 }}
  62. {% endif %}
  63. </span>
  64. {% else %}
  65. {{ event.scheme|upper }}
  66. {{ event.method }}
  67. {% if event.remote_addr %}
  68. from {{ event.remote_addr }}
  69. {% endif %}
  70. <span class="ua-body">
  71. {% if event.ua %}
  72. - {{ event.ua }}
  73. {% endif %}
  74. {% if event.body %}
  75. - {{ event.body|truncatechars:150 }}
  76. {% endif %}
  77. </span>
  78. {% endif %}
  79. </td>
  80. </tr>
  81. {% endif %}
  82. {% if event.check_status %}
  83. <tr class="missing" data-dt="{{ event.created.isoformat }}">
  84. <td class="n-cell">
  85. <span class="icon-missing"></span>
  86. </td>
  87. <td class="date"></td>
  88. <td class="time"></td>
  89. <td class="alert-info" colspan="2">
  90. {% if event.channel.kind == "email" %}
  91. Sent email alert to {{ event.channel.value }}
  92. {% elif event.channel.kind == "slack" %}
  93. Sent Slack alert
  94. {% if event.channel.slack_channel %}
  95. to {{ event.channel.slack_channel }}
  96. {% endif %}
  97. {% elif event.channel.kind == "pd" %}
  98. Sent alert to PagerDuty
  99. {% elif event.channel.kind == "pagertree" %}
  100. Sent alert to PagerTree
  101. {% elif event.channel.kind == "opsgenie" %}
  102. Sent alert to OpsGenie
  103. {% elif event.channel.kind == "hipchat" %}
  104. Sent alert to HipChat
  105. {% elif event.channel.kind == "po" %}
  106. Sent a Pushover notification
  107. {% elif event.channel.kind == "webhook" %}
  108. Called webhook {{ event.channel.url_down }}
  109. {% else %}
  110. Sent alert to {{ event.channel.kind|capfirst }}
  111. {% endif %}
  112. {% if event.error %}
  113. <br />
  114. <strong>Error: {{ event.error }}</strong>
  115. {% endif %}
  116. </td>
  117. </tr>
  118. {% endif %}
  119. {% endfor %}
  120. </table>
  121. {% if show_limit_notice and limit < 1000 %}
  122. <p class="alert alert-info">
  123. <strong>Showing last {{ limit }} pings.</strong>
  124. Want to see more?
  125. <a href="{% url 'hc-pricing' %}">
  126. Upgrade your account!
  127. </a>
  128. </p>
  129. {% endif %}
  130. </div>
  131. {% else %}
  132. <div class="alert alert-info">Log is empty. This check has not received any pings yet.</div>
  133. {% endif %}
  134. </div>
  135. </div>
  136. <div id="ping-details-modal" class="modal">
  137. <div class="modal-dialog">
  138. <div class="modal-content">
  139. <div id="ping-details-body">Loading</div>
  140. <div class="modal-footer">
  141. <button type="button" class="btn btn-default" data-dismiss="modal">Got It!</button>
  142. </div>
  143. </div>
  144. </div>
  145. </div>
  146. {% endblock %}
  147. {% block scripts %}
  148. {% compress js %}
  149. <script src="{% static 'js/jquery-2.1.4.min.js' %}"></script>
  150. <script src="{% static 'js/bootstrap.min.js' %}"></script>
  151. <script src="{% static 'js/moment.min.js' %}"></script>
  152. <script src="{% static 'js/log.js' %}"></script>
  153. {% endcompress %}
  154. {% endblock %}