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.

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