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.

166 lines
5.8 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.fail %}
  41. <span class="label label-danger">Failure</span>
  42. {% elif event.start %}
  43. <span class="label label-start">Started</span>
  44. {% else %}
  45. <span class="label label-success">OK</span>
  46. {% endif %}
  47. </td>
  48. <td class="details">
  49. {% if event.delta %}
  50. <div class="delta">
  51. <span class="icon-timer"></span>
  52. {{ event.delta|mins_secs }}
  53. </div>
  54. {% endif %}
  55. {% if event.scheme == "email" %}
  56. {{ event.ua }}
  57. <span class="ua-body">
  58. {% if event.body %}
  59. - {{ event.body|truncatechars:150 }}
  60. {% endif %}
  61. </span>
  62. {% else %}
  63. {{ event.scheme|upper }}
  64. {{ event.method }}
  65. {% if event.remote_addr %}
  66. from {{ event.remote_addr }}
  67. {% endif %}
  68. <span class="ua-body">
  69. {% if event.ua %}
  70. - {{ event.ua }}
  71. {% endif %}
  72. {% if event.body %}
  73. - {{ event.body|truncatechars:150 }}
  74. {% endif %}
  75. </span>
  76. {% endif %}
  77. </td>
  78. </tr>
  79. {% endif %}
  80. {% if event.check_status %}
  81. <tr class="missing" data-dt="{{ event.created.isoformat }}">
  82. <td class="n-cell">
  83. <span class="icon-missing"></span>
  84. </td>
  85. <td class="date"></td>
  86. <td class="time"></td>
  87. <td class="alert-info" colspan="2">
  88. {% if event.channel.kind == "email" %}
  89. Sent email alert to {{ event.channel.value }}
  90. {% elif event.channel.kind == "slack" %}
  91. Sent Slack alert
  92. {% if event.channel.slack_channel %}
  93. to {{ event.channel.slack_channel }}
  94. {% endif %}
  95. {% elif event.channel.kind == "pd" %}
  96. Sent alert to PagerDuty
  97. {% elif event.channel.kind == "pagertree" %}
  98. Sent alert to PagerTree
  99. {% elif event.channel.kind == "opsgenie" %}
  100. Sent alert to OpsGenie
  101. {% elif event.channel.kind == "hipchat" %}
  102. Sent alert to HipChat
  103. {% elif event.channel.kind == "po" %}
  104. Sent a Pushover notification
  105. {% elif event.channel.kind == "webhook" %}
  106. Called webhook {{ event.channel.url_down }}
  107. {% else %}
  108. Sent alert to {{ event.channel.kind|capfirst }}
  109. {% endif %}
  110. {% if event.error %}
  111. <br />
  112. <strong>Error: {{ event.error }}</strong>
  113. {% endif %}
  114. </td>
  115. </tr>
  116. {% endif %}
  117. {% endfor %}
  118. </table>
  119. {% if show_limit_notice and limit < 1000 %}
  120. <p class="alert alert-info">
  121. <strong>Showing last {{ limit }} pings.</strong>
  122. Want to see more?
  123. <a href="{% url 'hc-pricing' %}">
  124. Upgrade your account!
  125. </a>
  126. </p>
  127. {% endif %}
  128. </div>
  129. {% else %}
  130. <div class="alert alert-info">Log is empty. This check has not received any pings yet.</div>
  131. {% endif %}
  132. </div>
  133. </div>
  134. <div id="ping-details-modal" class="modal">
  135. <div class="modal-dialog">
  136. <div class="modal-content">
  137. <div id="ping-details-body">Loading</div>
  138. <div class="modal-footer">
  139. <button type="button" class="btn btn-default" data-dismiss="modal">Got It!</button>
  140. </div>
  141. </div>
  142. </div>
  143. </div>
  144. {% endblock %}
  145. {% block scripts %}
  146. {% compress js %}
  147. <script src="{% static 'js/jquery-2.1.4.min.js' %}"></script>
  148. <script src="{% static 'js/bootstrap.min.js' %}"></script>
  149. <script src="{% static 'js/moment.min.js' %}"></script>
  150. <script src="{% static 'js/log.js' %}"></script>
  151. {% endcompress %}
  152. {% endblock %}